#ifndef INC_SHUNT_MONITORING_H
#define INC_SHUNT_MONITORING_H

#include <stdint.h>

#include "stm32f3xx_hal.h"

#define THRESH_OVERCURRENT 300000 // mA

typedef struct {
  int32_t current;
  int32_t voltage1;
  int32_t voltage2;
  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
