/*
 * Check_Shunt_Limits.h
 *
 *  Created on: Jun 16, 2022
 *      Author: max
 */

#ifndef INC_CHECK_SHUNT_LIMITS_H_
#define INC_CHECK_SHUNT_LIMITS_H_

#include "CAN_Communication.h"
#include "main.h"

#include <stdint.h>

#define SHUNT_OVERCURRENT 0x0FFFFFFF // Shunt Overcurrent Limit
#define SHUNT_TIMEOUT 500            // Timeout after 500ms
#define SHUNT_OVERTEMP 0xFFFFFFFF    // Overtermperature of the Busbar

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 ampere_seconds;

  uint32_t last_message;
} ShuntData;
extern ShuntData shunt_data;

void CheckShuntLimits();

#endif /* INC_CHECK_SHUNT_LIMITS_H_ */
