/* * PSE_unit.h * * Created on: Aug 9, 2023 * Author: leo */ #ifndef INC_PSE_UNIT_H_ #define INC_PSE_UNIT_H_ #include #include "stm32f1xx_hal.h" #include "lvgl.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{ uint16_t tim_presc; uint16_t tim_period; 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; TIM_HandleTypeDef* tim; } pse_stepper_conf; typedef struct{ lv_obj_t* flow; lv_obj_t* volume; lv_obj_t* enabled; } pse_home_display; 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_home_display* home_display; // Widgets for updating the home screen } pse_unit; void load_units(pse_unit* units, pse_syringe* syringes, pse_stepper_conf* stepper_confs, pse_home_display* home_displays, uint8_t unit_num, uint16_t ws_ind); void load_units_short(pse_unit* units, uint8_t unit_num, uint16_t ws_ind); void save_units(pse_unit* units, uint8_t unit_num, uint16_t ws_ind); #endif