i2c_target.c 687 B

1234567891011121314151617181920212223242526272829
  1. #include "i2c_target.h"
  2. #include "battery.h"
  3. /*
  4. - command: as defined in the Wiki for Pi 0x01, 0x02, 0x03, refer to i2c_target.h file
  5. - slot_id: battery slot numner from 0 to NUM_SLOTS-1
  6. - data: pointer to SET battery limits
  7. - len: length of the data
  8. */
  9. void ProcessI2CCommand(uint8_t command, uint8_t slot_id, uint8_t *data, uint8_t len) {
  10. switch(command) {
  11. case CMD_GET_BATTERY_STATUS:
  12. // Transmit the battery state for the given slot
  13. case CMD_GET_BATTERY_DATA: {
  14. // Create a data message and transmit it
  15. }
  16. case CMD_SET_BATTERY_LIMIT: {
  17. }
  18. }
  19. }