test fork
Dependencies: SPI_TFTx2 SPI_TFTx2_ILI9341 TFT_fonts TOUCH_TFTx2 mbed
Fork of CANary_9341 by
Diff: utility.cpp
- Revision:
- 34:4751a8259b18
- Parent:
- 33:a277743ebdeb
- Child:
- 35:5acbd8a64a89
diff -r a277743ebdeb -r 4751a8259b18 utility.cpp --- a/utility.cpp Tue Mar 19 04:43:43 2013 +0000 +++ b/utility.cpp Wed Mar 20 13:57:00 2013 +0000 @@ -9,6 +9,7 @@ canIdle=(++secsNoMsg>canTimeout)?true:false; userIdle=(++secsNoTouch>userTimeout)?true:false; LPC_RTC->ILR |= (1<<0); // clear interrupt to prepare for next + tick=true; } extern "C" void RTC_Init (void) { @@ -73,8 +74,8 @@ msgChanged[indexLastMsg[canRXmsg.id]]=changed; } lastMsg[indexLastMsg[canRXmsg.id]]=canRXmsg; //Store in table - if((mType==2)&&(canRXmsg.id==0x358)){ // is daylight sensor - daylight = (canRXmsg.data[1]&0x80)?false:true; + if((mType==2)&&(canRXmsg.id==0x358)){ // headlight/turn signal indicator + headlights = (canRXmsg.data[1]&0x80)?true:false; } else if((mType==1)&&(canRXmsg.id==0x7bb)){ // is battery data? Need to store all responses if(canRXmsg.data[0]<0x20){ if(canRXmsg.data[3]==2){//cellpair data @@ -89,7 +90,7 @@ lasti=0; } i=canRXmsg.data[0]&0x0f; //lower nibble of D0 is index - if(lasti>i){ //detect rolloever and offset index appropriately + if(lasti>i){ //detect rollover and offset index appropriately bdi=0x10; } lasti=i; //remember the msb to detect rollover next time around @@ -129,6 +130,7 @@ can1.monitor(false); // set to active mode can1SleepMode = 0; // enable TX can1.write(CANMessage(0x79b, data, 8)); + logCan(1,CANMessage(0x79b, data, 8)); data[0]=0x30; //change to request next line message data[1]=0x01; data[2]=0x00; @@ -146,6 +148,7 @@ can1.monitor(false); // set to active mode can1SleepMode = 0; // enable TX can1.write(CANMessage(0x79b, data, 8)); + logCan(1,CANMessage(0x79b, data, 8)); data[0]=0x30; //change to request next line message data[1]=0x01; data[2]=0x00;