version with updated libs
Dependencies: F7_Ethernet mbed MbedJSONValue LCD_DISCO_F746NG mbed-rtos BSP_DISCO_F746NG CANMsg NetworkAPI SDFileSystem_Warning_Fixed GroveStreamsmodified LcdDiscoF746NgTracer JSON
Diff: touchScreenJPA.cpp
- Branch:
- jpa
- Revision:
- 10:41aff2b7acc6
- Parent:
- 5:ceefd0cfa233
- Child:
- 12:15ae35cfb03f
--- a/touchScreenJPA.cpp Tue Sep 08 15:01:08 2020 +0000 +++ b/touchScreenJPA.cpp Tue Sep 15 19:11:11 2020 +0000 @@ -22,7 +22,9 @@ extern time_t seconds; time_t seconds_touches = 0; extern time_t lastToucheTime; +// char touch1_text1; +// ----------------------------------------------------------------- int touchInitJPA1() { //touch screen init //touch screen @@ -32,31 +34,35 @@ BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER); BSP_LCD_SetFont(&Font12); status = BSP_TS_Init(BSP_LCD_GetXSize(), BSP_LCD_GetYSize()); - if (status != TS_OK) { - BSP_LCD_Clear(LCD_COLOR_RED); + if (status != TS_OK) + { BSP_LCD_Clear(LCD_COLOR_RED); BSP_LCD_SetBackColor(LCD_COLOR_RED); BSP_LCD_SetTextColor(LCD_COLOR_WHITE); BSP_LCD_DisplayStringAt(0, LINE(5), (uint8_t *)"TOUCHSCREEN INIT FAIL", CENTER_MODE); - } - else { + } + else + { BSP_LCD_Clear(LCD_COLOR_DARKBLUE); BSP_LCD_SetBackColor(LCD_COLOR_BLACK); 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();}} + { if(timer_touch[tt].read_ms() > 500) + { timer_touch[tt].stop();timer_touch[tt].reset(); + } + } return 0; } - +// ------------------------------------------------------- int xButton[5],yButton[5],dxButton[5],dyButton[5],xTxtButton[5],yTxtButton[5]; uint32_t backColorButton[5], txtColorButton[5]; -char textButton[5][30]; -char text1Button[5][30]; +extern char textButton[5][8]; +extern char text1Button[5][8]; char statusButton[5][30]; +// ----------------------------------------------------------------------------------------- int touchButtonJPA1(int numButton) { if ((numButton > 0) && (numButton < 5)) @@ -74,32 +80,33 @@ return 0; } - +// ---------------------------------------------------------------------------------- // generation de fonts : http://omz-software.com/pythonista/docs/ios/ImageFont.html int touchInitGuiJPA1() - { + { // button 1 en bas a gauche xButton[1]=10;yButton[1]=185;dxButton[1]=100;dyButton[1]=80;xTxtButton[1]=12;yTxtButton[1]=190; - backColorButton[1] = LCD_COLOR_GRAY; txtColorButton[1] = LCD_COLOR_GREEN; - sprintf(textButton[1],"Lampe "); - sprintf(text1Button[1],"Sejour"); + backColorButton[1] = LCD_COLOR_GRAY; + txtColorButton[1] = LCD_COLOR_GREEN; + //sprintf(textButton[1],"Lampe "); + //sprintf(text1Button[1],"Sejour"); sprintf(statusButton[1],"off"); - + // bouton 2 a cote bouton 1 xButton[2]=130;yButton[2]=185;dxButton[2]=100;dyButton[2]=80;xTxtButton[2]=132;yTxtButton[2]=190; backColorButton[2] = LCD_COLOR_GRAY; txtColorButton[2] = LCD_COLOR_GREEN; - sprintf(textButton[2],"Lampe "); - sprintf(text1Button[2],"Sejours"); + //sprintf(textButton[2],"Lampe "); + //sprintf(text1Button[2],"Sejours"); sprintf(statusButton[2],"off"); - + // bouton 3 xButton[3]=250;yButton[3]=185;dxButton[3]=100;dyButton[3]=80;xTxtButton[3]=252;yTxtButton[3]=190; backColorButton[3] = LCD_COLOR_GRAY; txtColorButton[3] = LCD_COLOR_GREEN; - sprintf(textButton[3],"Lampe "); - sprintf(text1Button[3],"Sejour"); + //sprintf(textButton[3],"Lampe "); + //sprintf(text1Button[3],"Sejour"); sprintf(statusButton[3],"off"); - + // bouton 4 en bas a ddroite xButton[4]=370;yButton[4]=185;dxButton[4]=100;dyButton[4]=80;xTxtButton[4]=372;yTxtButton[4]=190; backColorButton[4] = LCD_COLOR_GRAY; txtColorButton[4] = LCD_COLOR_GREEN; - sprintf(textButton[4],"Lampe "); - sprintf(text1Button[4],"Sejour"); + //sprintf(textButton[4],"Lampe "); + //sprintf(text1Button[4],"Sejour"); sprintf(statusButton[4],"off"); touchButtonJPA1(1); @@ -113,7 +120,8 @@ BSP_LCD_SetFont(&Font12); return 0; } - + +// -------------------------------------------------------------------------- int touchJPA1() { //touch screen @@ -188,7 +196,8 @@ //touch screen return status; } - + + // ----------------------------------------------------------------------- int sendTouchJPA(int xx) { uint8_t status = 0;