ams-master-23/Core/Inc/shunt_monitoring.h

33 lines
716 B
C

#ifndef INC_SHUNT_MONITORING_H
#define INC_SHUNT_MONITORING_H
#include <stdint.h>
#include "stm32f3xx_hal.h"
#define SHUNT_TIMEOUT 300 // ms
#define SHUNT_THRESH_OVERCURRENT 300000 // mA
#define SHUNT_THRESH_OVERTEMP 1000 // 1/10 °C
typedef struct {
int32_t current; // mA
int32_t voltage_bat; // mV
int32_t voltage_veh; // mV
int32_t voltage3; // mV
int32_t busbartemp;
int32_t power;
int32_t energy;
float current_counter; // mAs
uint32_t last_message;
uint32_t last_current_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