config.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #include <stdint.h>
  2. #include <stdbool.h>
  3. #ifndef CONFIG_H_
  4. #define CONFIG_H_
  5. #define I2C_TX_MAX_PACKET_SIZE (8)
  6. #define I2C_RX_MAX_PACKET_SIZE (12)
  7. #define BATTERY_THRESHOLD (20)
  8. #define TEMPERATURE_MAX_C (60)
  9. #define MAX_CYCLES (2)
  10. #define TARGET_BASE_ADDRESS (0x48)
  11. #define MEASUREMENT_CHECK_INTERVAL 320000 //Do not know yet the exact timing
  12. #define HEALTHY_BATTERY_VALUE (3800)
  13. // soft overvoltage treshold before getting into the soft overvoltage state
  14. #define SOV_THRESHOLD_MV 6000
  15. // hard overvoltage treshold for getting into the hard overvoltage state (error)
  16. #define HOV_THRESHOLD_MV 8000
  17. // define the temperature error state
  18. #define OVERTEMPERATURE_TRESHOLD 43
  19. #define CONTROLLER_HYSTERESIS 5
  20. typedef struct{
  21. uint8_t txBuffer[I2C_TX_MAX_PACKET_SIZE];
  22. uint8_t txLen;
  23. uint8_t txCount;
  24. bool txComplete;
  25. }tx_Packet;
  26. typedef struct{
  27. uint8_t rxBuffer[I2C_RX_MAX_PACKET_SIZE];
  28. uint8_t rxLen;
  29. uint8_t rxCount;
  30. bool rxComplete;
  31. }rx_Packet;
  32. // Global variables declared in i2c_hal.c
  33. extern tx_Packet txPacket;
  34. extern rx_Packet rxPacket;
  35. #endif