![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
updated version with parameters loaded from sdcard
Dependencies: F7_Ethernet mbed MbedJSONValue LCD_DISCO_F746NG mbed-rtos BSP_DISCO_F746NG CANMsg NetworkAPI SDFileSystem_Warning_Fixed GroveStreamsmodified LcdDiscoF746NgTracer JSON
Diff: main.cpp
- Branch:
- jpa
- Revision:
- 7:6ec7a4b94d0b
- Parent:
- 5:ceefd0cfa233
- Child:
- 8:275ae4382788
--- a/main.cpp Wed Sep 02 17:17:59 2020 +0000 +++ b/main.cpp Fri Sep 04 09:48:07 2020 +0000 @@ -133,26 +133,24 @@ void printMsg(CANMessage& msg, int dir) { if (dir ==0) { //BSP_LCD_DisplayStringAt(0, LINE(6), (uint8_t *)"Message sent ", LEFT_MODE); - printf(" Can message sent ok\n"); + printf(" Can message sent : "); printf("ID = 0x%.3X Data=", msg.id); for(int i = 0; i < msg.len; i++) printf(" 0x%.2X", msg.data[i]); - printf("\r\n"); + printf("\n"); } else { + printf(" Can message receive : "); /* - printf(" Can message receive ok\n"); printf(" ID = 0x%.3X\r\n", msg.id); printf(" Type = %d\r\n", msg.type); printf(" Format = %d\r\n", msg.format); printf(" Length = %d\r\n", msg.len); + */ printf("ID = 0x%.3X Data=", msg.id); - */ - printf(" Data ="); for(int i = 0; i < msg.len; i++) printf(" 0x%.2X", msg.data[i]); - printf("\r\n"); + printf("\n"); } - } /** ----------------------------------------------------------------------------------------- @@ -248,18 +246,8 @@ counter = (counter+1) & 1; // increment the counter voltage = 0;////(analogIn * 3.3f)/4096.0f;// read the small drifting voltage from analog input txMsg.clear(); // clear the Tx message storage - //txMsg.id = TX_ID; // set ID - //txMsg.type=0; - //txMsg.format=4; txMsg.id = 0x100130CA;//TX_ID; // set the message ID txMsg.format = CANExtended ; //extended - // We are about to transmit two data items to the CAN bus. - // counter: uint_8 (unsigned eight bits int) value (one byte). - // voltage: floating point value (four bytes). - // So the total length of payload data is five bytes. - // We'll use the "<<" (append) operator to add data to the CAN message. - // The usage is same as of the similar C++ io-stream operators. - // NOTE: The data length of CAN message is automatically updated when using "<<" operators. txMsg.len=2; txMsg.data[0]=8;txMsg.data[1]=counter; // append data (total data length must be <= 8 bytes!)