config.h 1.0 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 (50)
  8. #define TEMPERATURE_MAX_C (60)
  9. #define MAX_CYCLES (2)
  10. #define TARGET_BASE_ADDRESS (0x49)
  11. #define MEASUREMENT_CHECK_INTERVAL 3200000 //Do not know yet the exact timing
  12. typedef struct{
  13. uint8_t txBuffer[I2C_TX_MAX_PACKET_SIZE];
  14. uint8_t txLen;
  15. uint8_t txCount;
  16. bool txComplete;
  17. }tx_Packet;
  18. typedef struct{
  19. uint8_t rxBuffer[I2C_RX_MAX_PACKET_SIZE];
  20. uint8_t rxLen;
  21. uint8_t rxCount;
  22. bool rxComplete;
  23. }rx_Packet;
  24. /* Indicates status of I2C */
  25. enum I2cControllerStatus {
  26. I2C_STATUS_IDLE = 0,
  27. I2C_STATUS_TX_STARTED,
  28. I2C_STATUS_TX_INPROGRESS,
  29. I2C_STATUS_TX_COMPLETE,
  30. I2C_STATUS_RX_STARTED,
  31. I2C_STATUS_RX_INPROGRESS,
  32. I2C_STATUS_RX_COMPLETE,
  33. I2C_STATUS_ERROR,
  34. } gI2cControllerStatus;
  35. // Global variables declared in i2c_hal.c
  36. extern tx_Packet txPacket;
  37. extern rx_Packet rxPacket;
  38. #endif