2023-03-12 21:06:23 +01:00
|
|
|
#ifndef INC_SHUNT_MONITORING_H
|
|
|
|
#define INC_SHUNT_MONITORING_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "stm32f3xx_hal.h"
|
|
|
|
|
|
|
|
#define THRESH_OVERCURRENT 300000 // mA
|
2023-04-30 00:57:42 +02:00
|
|
|
#define THRESH_OVERTEMP 1000 // 1/10 °C
|
2023-03-12 21:06:23 +01:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int32_t current;
|
2023-04-24 19:20:21 +02:00
|
|
|
int32_t voltage_bat;
|
|
|
|
int32_t voltage_veh;
|
2023-03-12 21:06:23 +01:00
|
|
|
int32_t voltage3;
|
|
|
|
int32_t busbartemp;
|
|
|
|
int32_t power;
|
|
|
|
int32_t energy;
|
|
|
|
int32_t current_counter;
|
|
|
|
|
|
|
|
uint32_t last_message;
|
|
|
|
} ShuntData;
|
|
|
|
extern ShuntData shunt_data;
|
|
|
|
|
|
|
|
void shunt_init();
|
|
|
|
void shunt_check();
|
|
|
|
|
2023-03-15 18:07:38 +01:00
|
|
|
void shunt_handle_can_msg(uint16_t id, const uint8_t *data);
|
2023-03-12 21:06:23 +01:00
|
|
|
|
|
|
|
#endif // INC_SHUNT_MONITORING_H
|