Adds Balancing function (on the top of SPI_I2C_Parser.cpp) and changes main function adding a test case for balancing to show that it is working as intended.
Fork of BMS_BMUCore_cellvoltage_Mrinank by
Diff: main.cpp
- Revision:
- 9:3292aeced59b
- Parent:
- 8:2506aef0c8db
- Child:
- 10:c8fccc083e1d
--- a/main.cpp Tue Nov 08 17:02:55 2016 +0000 +++ b/main.cpp Thu Nov 10 17:12:41 2016 +0000 @@ -130,24 +130,19 @@ //spi.format(8,3); //All data transfer on LTC6804 occur in byte groups. LTC6820 set up such that POL=1 and PHA=3, this corresponds to mode 3 in mbed library. spi.frequency(spiBitrate); //spi.frequency(spiBitrate); uint8_t rx_config [1][8]; - uint8_t tx_config [1][6]; - - tx_config[0][0]=0x04; - for (int i=0; i<5; i++) { - tx_config[0][i+1]=0x00; - } //LTC6804_init(MD_FAST, DCP_DISABLED, CELL_CH_ALL, AUX_CH_VREF2); while(-1) { wake_LTC6804();//ensures CMU's are in ready state and wakes it up from low power mode + wait_us(330); //LTC6804_setConfigReg(1, tx_config); - LTC6804_wrcfg(1,tx_config); + //LTC6804_wrcfg(1,tx_config); //t.start(); LTC6804_rdcfg(1,rx_config); //t.stop(); //cout << t.read() << endl; - //wait(3); + wait(3); for (int i=0; i<8; i++) { cout << (uint16_t)rx_config[0][i] << endl; }