pse-firmware/Core/Inc/PSE_unit.h
2023-08-24 16:51:15 +02:00

51 lines
1.2 KiB
C

/*
* PSE_unit.h
*
* Created on: Aug 9, 2023
* Author: leo
*/
#ifndef INC_PSE_UNIT_H_
#define INC_PSE_UNIT_H_
#include <stdint.h>
#include "stm32f1xx_hal.h"
typedef struct{
char name[16]; // brand / name
uint16_t diameter; // diameter (in µm)
} pse_syringe;
typedef enum {PORT_X, PORT_Y, PORT_Z, PORT_E} pse_ports;
typedef struct{
uint32_t step_itvl;
uint8_t step_max;
uint32_t tick_counter;
int32_t steps_counter;
uint8_t stopAtHome;
GPIO_TypeDef* EN_GPIO_Port;
uint16_t EN_GPIO_Pin;
GPIO_TypeDef* DIR_GPIO_Port;
uint16_t DIR_GPIO_Pin;
GPIO_TypeDef* STEP_GPIO_Port;
uint16_t STEP_GPIO_Pin;
} pse_stepper_conf;
typedef struct{
uint8_t enabled;
pse_ports port; // physical port on which this unit is connected
uint32_t flow; // flow (in µL.min-1)
uint32_t volume; // current volume dispensed (in µL)
uint32_t set_volume; // volume to stop at (0 for no max)
pse_syringe* syringe; // associated syringe
pse_stepper_conf* stepper_conf; // hardware configuration for the associated stepper
} pse_unit;
void load_units(pse_unit* units, pse_syringe* syringes, pse_stepper_conf* stepper_confs, uint8_t unit_num);
void save_units(pse_unit* units, uint8_t unit_num);
#endif