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.

Dependencies:   CUER_CAN mbed

Fork of BMS_BMUCore_cellvoltage_Mrinank by Mrinank Sharma

Revision:
12:f6ff8ddea5ab
Parent:
11:72202d50f6b6
Child:
13:499c1e2da85b
--- a/main.cpp	Sat Nov 26 14:26:42 2016 +0000
+++ b/main.cpp	Sun Nov 27 11:51:16 2016 +0000
@@ -133,30 +133,32 @@
     uint8_t read [1][8];
     uint16_t cellcodes [1][12];
     
-    write[0][0]=0x02;
+    write[0][0]=0x00;
     write[0][1]=0x00;
     write[0][2]=0x00;
     write[0][3]=0x00;
     write[0][4]=0x00;
     write[0][5]=0x00;
 
-    //LTC6804_init(MD_FAST, DCP_DISABLED, CELL_CH_ALL, AUX_CH_VREF2);
+    LTC6804_init(MD_FAST, DCP_DISABLED, CELL_CH_ALL, AUX_CH_VREF2);
+    //LTC6804_init(MD_NORMAL,DCP_DISABLED,CELL_CH_ALL,AUX_CH_ALL);
 
     while(1) {
         wake_LTC6804();//ensures CMU's are in ready state and wakes it up from low power mode
-        LTC6804_setConfigReg(1,write);
-        wait(2);
-        wake_LTC6804();
+        LTC6804_wrcfg(1,write);
         wait_us(330);
         LTC6804_rdcfg(1,read);
-        LTC6804_init(MD_NORMAL,DCP_DISABLED,CELL_CH_ALL,AUX_CH_ALL);
+         wait_us(330);
+       wake_LTC6804();
         LTC6804_acquireVoltageTx();
-        wait_us(3000);
-        //t.start();
+         wait_us(930);
         LTC6804_acquireAllVoltageRegRx(0, 1, cellcodes);
         //t.stop();
         //cout << t.read() << endl;
         wait(3);
+        for (int i=0; i<8; i++) {
+            printf("Reading %d config \r\n", (uint8_t)read[0][i]); 
+        }
         for (int i=0; i<12; i++) {
             printf("Reading %d mV \r\n", (uint16_t)cellcodes[0][i]); 
         }