70
Rev. 0
The following gives an overview and description of the low level communication functions available in the LTC2949
C-Code library LTC2949.cpp/.h (within Sketchbook folder: LTSketchbook\libraries\LTC2949).
1. Configure library for communication topology (top of daisy chain or parallel to daisy chain/single device).
LTC2949_init_lib(
/*byte cellMonitorCount, */LTCDEF_CELL_MONITOR_COUNT,
/*boolean ltc2949onTopOfDaisychain, */false,
/*boolean debugEnable */false
);
2. Set library to default settings of LTC2949 after power-up (library mirrors some of LTC2949’s register settings to
calculate e.g., charge/energy/time LSB sizes, SLOT LSB which can be temperature or voltage, power ADC settings
which can be power of voltage…).
LTC2949_init_device_state();
3. WRITE single byte.
LTC2949_WRITE(LTC2949_REG_WKUPACK, 0x00); // write wake up acknowledge
// is Equal to
byte data = 0;
LTC2949_WRITE(LTC2949_REG_WKUPACK, 1, &data);
4. WRITE burst of bytes.
void LTC2949_SlotsCfg(byte slot1P, byte slot1N, byte slot2P, byte slot2N)
{
byte data[4] = { slot1N, slot1P, slot2N, slot2P };
LTC2949_WRITE(LTC2949_REG_SLOT1MUXN, 4, data);
}
5. READ single byte
byte data;
byte error = LTC2949_READ(LTC2949_REG_FACTRL, 1, &data);
6. READ burst of bytes
byte LTC2949_GetSlotsCfg(byte * slot1P, byte * slot1N, byte * slot2P, byte * slot2N)
{
byte data[4];
byte error = LTC2949_READ(LTC2949_REG_SLOT1MUXN, 4, data);
*slot1N = data[0];
*slot1P = data[1];
*slot2N = data[2];
*slot2P = data[3];
return error;
}
APPENDIX H: LTC2949.CPP/.H BASIC LIBRARY FUNCTIONS