
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
Revision 5:ceefd0cfa233, committed 2020-09-02
- Comitter:
- jeanpierreaulas
- Date:
- Wed Sep 02 17:07:55 2020 +0000
- Branch:
- jpa
- Parent:
- 4:fbbf5d1785e7
- Child:
- 6:55fdfef6dfa9
- Commit message:
- for test serial send
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
touchScreenJPA.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Wed Sep 02 14:43:31 2020 +0000 +++ b/main.cpp Wed Sep 02 17:07:55 2020 +0000 @@ -176,7 +176,8 @@ // attach ISR to handle received messages timer.start(); // start timer sendSerialUSB("CAN_Hello board serialUSB #1\r\n"); - + sendSerial2("CAN_Hello board serial2 #1\r\n"); + sendSerial7("CAN_Hello board serial7 #1\r\n"); printf("\nInit SDCard ...\n"); mainSDCardJPA() ; // init SD - read prog parameters from SD (from sdcardjpa.cpp in sdfilesystem_warning_fixed lib @@ -216,6 +217,8 @@ //can.filter(RX_ID, 0xFFF, CANStandard, 0); // set filter #0 to accept only standard messages with ID == RX_ID can.attach(onCanReceived, CAN::RxIrq); + BSP_LCD_DisplayOff(); + BSP_LCD_DisplayOn(); // main loop --------------------------------------------------- while (true) { @@ -238,7 +241,9 @@ // timer send can if(timer.read_ms() >= 10000) // check for timeout - { timer.stop(); // stop the timer + { + + timer.stop(); // stop the timer timer.reset(); // reset the timer counter = (counter+1) & 1; // increment the counter voltage = 0;////(analogIn * 3.3f)/4096.0f;// read the small drifting voltage from analog input
--- a/touchScreenJPA.cpp Wed Sep 02 14:43:31 2020 +0000 +++ b/touchScreenJPA.cpp Wed Sep 02 17:07:55 2020 +0000 @@ -4,6 +4,7 @@ #include "mbed.h" #include "GroveStreams.h" #include "MbedJSONValue.h" +Timer timer_touch[16]; int initDisplayTemp(); @@ -43,7 +44,10 @@ BSP_LCD_SetTextColor(LCD_COLOR_GREEN); //BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT OK", CENTER_MODE); } - + int tt = 0; + for (tt=0;tt<16;tt++) + {if(timer_touch[tt].read_ms() > 500) + {timer_touch[tt].stop();timer_touch[tt].reset();}} return 0; } @@ -121,7 +125,10 @@ static uint8_t cleared = 0; uint8_t prev_nb_touches = 0; - + int tt = 0; + for (tt=0;tt<16;tt++) + {if(timer_touch[tt].read_ms() > 200) + {timer_touch[tt].stop();timer_touch[tt].reset();}} //touch screen BSP_TS_GetState(&TS_State); if (TS_State.touchDetected) { @@ -150,10 +157,14 @@ if ((TS_State.touchY[0] > 160) && (TS_State.touchY[0] < (160+80))) { int numTouche = 0; - if ((TS_State.touchX[0] > 10) && (TS_State.touchX[0] < (10+100))) {numTouche = 1;} - if ((TS_State.touchX[0] > 130) && (TS_State.touchX[0] < (130+100))) {numTouche = 2;} - if ((TS_State.touchX[0] > 250) && (TS_State.touchX[0] < (250+100))) {numTouche = 3;} - if ((TS_State.touchX[0] > 370) && (TS_State.touchX[0] < (370+100))) {numTouche = 4;} + if ((TS_State.touchX[0] > 10) && (TS_State.touchX[0] < (10+100))) + {if(timer_touch[0].read_ms() == 0) {numTouche = 1;timer_touch[0].start();}} + if ((TS_State.touchX[0] > 130) && (TS_State.touchX[0] < (130+100))) + {if(timer_touch[1].read_ms() == 0) {numTouche = 2;timer_touch[1].start();}} + if ((TS_State.touchX[0] > 250) && (TS_State.touchX[0] < (250+100))) + {if(timer_touch[2].read_ms() == 0) {numTouche = 3;timer_touch[2].start();}} + if ((TS_State.touchX[0] > 370) && (TS_State.touchX[0] < (370+100))) + {if(timer_touch[3].read_ms() == 0) {numTouche = 4;timer_touch[3].start();}} if (numTouche >0) { printf("Touche : %d", numTouche);