31 lines
589 B
C
31 lines
589 B
C
#ifndef INC_SHUNT_MONITORING_H
|
|
#define INC_SHUNT_MONITORING_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#include "stm32f3xx_hal.h"
|
|
|
|
#define THRESH_OVERCURRENT 300000 // mA
|
|
#define THRESH_OVERTEMP 1000 // 1/10 °C
|
|
|
|
typedef struct {
|
|
int32_t current;
|
|
int32_t voltage_bat;
|
|
int32_t voltage_veh;
|
|
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();
|
|
|
|
void shunt_handle_can_msg(uint16_t id, const uint8_t *data);
|
|
|
|
#endif // INC_SHUNT_MONITORING_H
|