Port FT22 code
This commit is contained in:
49
Core/Inc/slave_monitoring.h
Normal file
49
Core/Inc/slave_monitoring.h
Normal file
@ -0,0 +1,49 @@
|
||||
#ifndef INC_SLAVE_MONITORING_H
|
||||
#define INC_SLAVE_MONITORING_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define N_SLAVES 6
|
||||
#define N_CELLS_SERIES 17
|
||||
#define N_CELLS_PARALLEL 5
|
||||
#define N_TEMP_SENSORS 32
|
||||
|
||||
#define SLAVE_TIMEOUT 500
|
||||
#define SLAVE_PANIC_OT 0
|
||||
#define SLAVE_PANIC_UT 1
|
||||
#define SLAVE_PANIC_OV 2
|
||||
#define SLAVE_PANIC_UV 3
|
||||
|
||||
typedef enum {
|
||||
SLAVE_ERR_NONE,
|
||||
SLAVE_ERR_TIMEOUT,
|
||||
SLAVE_ERR_OT,
|
||||
SLAVE_ERR_UT,
|
||||
SLAVE_ERR_OV,
|
||||
SLAVE_ERR_UV
|
||||
} SlaveErrorKind;
|
||||
|
||||
typedef struct {
|
||||
SlaveErrorKind kind;
|
||||
uint32_t data; // Cell/temperature ID etc
|
||||
} SlaveError;
|
||||
|
||||
typedef struct {
|
||||
uint8_t id;
|
||||
SlaveError error;
|
||||
uint16_t voltages[N_CELLS_SERIES];
|
||||
int16_t temperatures[N_TEMP_SENSORS];
|
||||
uint32_t last_message;
|
||||
} SlaveHandle;
|
||||
|
||||
extern SlaveHandle slaves[N_SLAVES];
|
||||
extern uint16_t min_voltage;
|
||||
extern int16_t max_temp;
|
||||
|
||||
void slaves_init();
|
||||
void slaves_check();
|
||||
|
||||
void slaves_handle_panic(uint8_t *data);
|
||||
void slaves_handle_log(uint8_t *data);
|
||||
|
||||
#endif // INC_SLAVE_MONITORING_H
|
||||
Reference in New Issue
Block a user