Dual CANbus monitor and instrumentation cluster supporting ILI9341 display controller
Dependencies: SPI_TFTx2_ILI9341 TOUCH_TFTx2_ILI9341 TFT_fonts mbed
Fork of CANary by
Diff: utility.cpp
- Revision:
- 138:a2f5af85ed0d
- Parent:
- 137:70853cf5a30f
- Child:
- 140:ab3e94eb0227
--- a/utility.cpp Sun Jul 28 05:32:17 2013 +0000 +++ b/utility.cpp Fri Aug 02 05:13:26 2013 +0000 @@ -28,7 +28,7 @@ } void touch_ISR(){ - //LPC_GPIOINT->IO2IntClr = (LPC_GPIOINT->IO2IntStatR | LPC_GPIOINT->IO2IntStatF); // seems to work without so maybe not necessary (performed inInterruptIn handler?) + //LPC_GPIOINT->IO2IntClr = (LPC_GPIOINT->IO2IntStatR | LPC_GPIOINT->IO2IntStatF); // seems to work without so maybe not necessary (performed in InterruptIn handler?) touched=true; // just set flag - touch screen algorythm is long and we don't want to block other interrupts } @@ -393,8 +393,8 @@ if(reqMsgCnt<99){ switch (reqMsgCnt){ case BatDataBaseG1: - can1.monitor(false); // set to active mode - can1SleepMode = 0; // enable TX + can2.monitor(false); // set to active mode + can2SleepMode = 0; // enable TX data[0]=0x02; //change to request group 1 data[1]=0x21; data[2]=0x01; @@ -426,23 +426,30 @@ break; case BatDataBaseG7: // group 5 has 11 frames reqMsgCnt = 99; - can1SleepMode = VP230Sleep; // disable TX - can1.monitor(true); // set to snoop mode + can2SleepMode = VP230Sleep; // disable TX + can2.monitor(true); // set to snoop mode msgReq.detach(); // stop ticker default: data[0]=0x30; //change to request next line message data[1]=0x01; data[2]=0x00; } - can1.write(CANMessage(0x79b, data, 8)); + can2.write(CANMessage(0x79b, data, 8)); reqMsgCnt++; } } +void sendTempReq(){ + //Requests ambient and cabin temperature + char data[8] = {0x03, 0x22, 0x11, 0x5d, 0xff, 0xff, 0xff, 0xff}; + can2.monitor(false); // set to active mode + can2SleepMode = 0; // enable TX + can2.write(CANMessage(0x797, data, 8)); + can2SleepMode = VP230Sleep; // disable TX +} + void autoPollISR(){ - //char sTemp[40]; // just for debug - //sprintf(sTemp,"Requesting cp data\n"); // just for debug - //printMsg(sTemp); // just for debug + //sendTempReq(); reqMsgCnt = 0; //reset message counter msgReq.attach(&sendReq,0.015); }