Revision 067c98f7

View differences:

include/P9221R/v1/alld_P9221R_v1.h
35 35
/* CONSTANTS                                                                  */
36 36
/******************************************************************************/
37 37

  
38
/**
39
 * @brief Maximum I2C frequency.
40
 */
41
#define P9221R_LLD_I2C_MAXFREQUENCY   400000
42

  
38 43
/******************************************************************************/
39 44
/* SETTINGS                                                                   */
40 45
/******************************************************************************/
......
58 63
 * @brief Registers.
59 64
 */
60 65
typedef enum {
66
  P9221R_LLD_REGISTER_PARTNUMBER                = 0x00,
67
  P9221R_LLD_REGISTER_INTERRUPTENABLE           = 0x38,
61 68
  // Writeable Registers
62 69
  P9221R_LLD_REGISTER_BATTERY_STATUS_SENT       = 0x3A,
63 70
  P9221R_LLD_REGISTER_END_POWER_TRANSFER        = 0x3B,
source/P9221R/v1/alld_P9221R_v1.c
70 70
  apalDbgAssert(p9221r->i2cd != NULL);
71 71
  apalDbgAssert(data != NULL);
72 72

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

Also available in: Unified diff