i2c_target.c 702 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "i2c_target.h"
  2. #include "adc.h"
  3. #include "battery.h"
  4. #include "ti/driverlib/dl_i2c.h"
  5. #include "ti_msp_dl_config.h"
  6. #include <stdint.h>
  7. #include <stdio.h>
  8. // Global buffer for I2C
  9. BatteryData battery_data;
  10. BatteryLimitMsg battery_limits;
  11. // Flag for Pi INTERRUPTS:
  12. volatile bool piRxComplete;
  13. volatile bool piTxComplete;
  14. uint8_t piTxPacket[I2C_TX_MAX_PACKET_SIZE_PI];
  15. uint8_t piRxPacket[I2C_RX_MAX_PACKET_SIZE_PI];
  16. uint32_t piTxLen, piTxCount;
  17. uint32_t piRxLen, piRxCount;
  18. /*
  19. - command: as defined in the Wiki for Pi 0x01, 0x02, 0x03, refer to i2c_target.h
  20. file
  21. - slot_id: battery slot numner from 0 to NUM_SLOTS-1
  22. - data: pointer to SET battery limits
  23. - len: length of the data
  24. */