mcu_slave_interface.h 709 B

123456789101112131415161718192021222324252627282930
  1. //This file is an interface for I2C communication between MSPM0G3507 (Controller) and MSPM0L1304 (Target)
  2. #ifndef MCU_SLAVE_INTERACE_H_
  3. #include <stdint.h>
  4. #include "ti/driverlib/dl_i2c.h"
  5. #include "ti_msp_dl_config.h"
  6. // Handles I2C command coming into Target MCU:
  7. typedef enum{
  8. CMD_SET_CURRENT= 0x05,
  9. CMD_GET_MEASUREMENT= 0x06,
  10. CMD_GET_BATTERY_STATE= 0x07,
  11. CMD_SET_HOV_CLEAR= 0x08
  12. }mcu_I2C_command;
  13. //Command structures:
  14. typedef struct{
  15. uint8_t slot_id;
  16. int16_t current;
  17. }SetChargeDischargeCurrent;
  18. typedef struct __attribute__((packed)){
  19. uint16_t voltage;
  20. int16_t current;
  21. uint16_t temperature;
  22. }BatteryMeasurementData;
  23. void mcu_i2c_handle(I2C_Regs *i2c);
  24. #endif