Revision 73345246

View differences:

include/P9221R/v1/alld_P9221R_v1.h
63 63
 * @brief Registers.
64 64
 */
65 65
typedef enum {
66
  P9221R_LLD_REGISTER_PARTNUMBER                = 0x00,
67
  P9221R_LLD_REGISTER_INTERRUPTENABLE           = 0x38,
66
  P9221R_LLD_REGISTER_PARTNUMBER                = 0x0000,
67
  P9221R_LLD_REGISTER_INTERRUPTENABLE           = 0x0038,
68 68
  // Writeable Registers
69
  P9221R_LLD_REGISTER_BATTERY_STATUS_SENT       = 0x3A,
70
  P9221R_LLD_REGISTER_END_POWER_TRANSFER        = 0x3B,
69
  P9221R_LLD_REGISTER_BATTERY_STATUS_SENT       = 0x003A,
70
  P9221R_LLD_REGISTER_END_POWER_TRANSFER        = 0x003B,
71 71
  // Read-Only Registers
72
  P9221R_LLD_REGISTER_OUTPUT_VOLTAGE_LSB        = 0x3C,
73
  P9221R_LLD_REGISTER_OUTPUT_VOLTAGE_MSB        = 0x3D,
74
  P9221R_LLD_REGISTER_IOUT_CURRENT_LSB          = 0x44,
75
  P9221R_LLD_REGISTER_IOUT_CURRENT_MSB          = 0x45,
76
  P9221R_LLD_REGISTER_OPERATING_FREQUENCY_MSB   = 0x48,
77
  P9221R_LLD_REGISTER_OPERATING_FREQUENCY_LSB   = 0x49,
78
  P9221R_LLD_REGISTER_ALIGNMENT_X               = 0x4B,
79
  P9221R_LLD_REGISTER_ALIGNMENT_Y               = 0x4C,
72
  P9221R_LLD_REGISTER_OUTPUT_VOLTAGE_LSB        = 0x003C,
73
  P9221R_LLD_REGISTER_OUTPUT_VOLTAGE_MSB        = 0x003D,
74
  P9221R_LLD_REGISTER_IOUT_CURRENT_LSB          = 0x0044,
75
  P9221R_LLD_REGISTER_IOUT_CURRENT_MSB          = 0x0045,
76
  P9221R_LLD_REGISTER_OPERATING_FREQUENCY_MSB   = 0x0048,
77
  P9221R_LLD_REGISTER_OPERATING_FREQUENCY_LSB   = 0x0049,
78
  P9221R_LLD_REGISTER_ALIGNMENT_X               = 0x004B,
79
  P9221R_LLD_REGISTER_ALIGNMENT_Y               = 0x004C,
80 80
} p9221r_lld_register_t;
81 81

  
82 82

  
source/P9221R/v1/alld_P9221R_v1.c
70 70
  apalDbgAssert(p9221r->i2cd != NULL);
71 71
  apalDbgAssert(data != NULL);
72 72

  
73
  uint8_t buffer[num];
73
  uint8_t tx[2] = {(addr & 0xFF00) >> 8, addr & 0x00FF};
74

  
75
  apalExitStatus_t status = apalI2CMasterTransmit(p9221r->i2cd, (P9221R_LLD_I2C_ADDR_FIXED | p9221r->addr), tx, 2, data, num, timeout);
74 76

  
75
  apalExitStatus_t status = apalI2CMasterTransmit(p9221r->i2cd, (P9221R_LLD_I2C_ADDR_FIXED | p9221r->addr), (uint8_t*)&addr, 2, buffer, num, timeout);
76
  for (uint8_t dataIdx = 0; dataIdx < num; dataIdx++) {
77
      data[dataIdx] = buffer[dataIdx];
78
  }
79 77
  return status;
80 78
}
81 79

  

Also available in: Unified diff