prog LiroyMerlin
Dependencies: TS_DISCO_F746NG mbed LCD_DISCO_F746NG BSP_DISCO_F746NG BUTTON_GROUP
Revision 6:825705c3c7ae, committed 2021-06-25
- Comitter:
- antoine_carpentier
- Date:
- Fri Jun 25 10:03:08 2021 +0000
- Parent:
- 5:b297aec21a24
- Commit message:
- LAST COMMIT
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r b297aec21a24 -r 825705c3c7ae main.cpp --- a/main.cpp Thu Jun 17 14:28:42 2021 +0000 +++ b/main.cpp Fri Jun 25 10:03:08 2021 +0000 @@ -3,13 +3,14 @@ #include "stm32746g_discovery_ts.h" #include "button_group.hpp" #include "draw.h" - +#include "string.h" //using namespace Mikami; //TS_DISCO_F746NG ts_; //LCD_DISCO_F746NG lcd_; TS_StateTypeDef TS_State; +void Rx_interrupt();// Routine d'interruption void page_commande(int *roro,int *bede,int *thethe,int *popo); void page_liste(void); void activ_bluetooth(void); @@ -22,33 +23,36 @@ uint16_t x, y; uint8_t text[30]; uint8_t n[30]; +char chaine[100]; uint8_t status; uint8_t idx; uint8_t cleared = 0; uint8_t prev_nb_touches = 0; char ch; +int flagE=0, flagDP=0; //float prix_total = 0; //char buffer [50]; Serial pc(USBTX, USBRX); // tx, rx Serial bluetooth1(D1, D0); // module HC-06 branché à D1 (TX) et D2 (RX) +Serial ESP(A4, A5); //Module ESP branché à A4 et A5 char recep[30]; // NOM DES LIVRES // 0 = Hernani; 1 = Balzac; 2 = Cyrano; 3 = Blacksad; 4 = Boule&Bill; 5 = Cahier; 6 = Cid; 7 = Domjuan; 8 = Fleurs; 9 = gazette; 10 = NULL; -int lc1[6] = {2,3,1,0,7,9}; -int lc2[6] = {5,9,2,0,10,10}; -int lc3[6] = {3,7,1,3,2,5}; -int lc4[6] = {8,7,1,8,2,5}; -int lc5[6] = {5,7,1,4,2,0}; -int lc6[6] = {4,10,10,10,10,10}; +int lc1[6] = {2,7,5,3,8,1}; +int lc2[6] = {1,2,3,10,10,10}; +int lc3[6] = {0,4,7,9,2,10}; +int lc4[6] = {8,7,6,5,4,3}; +int lc5[6] = {8,0,6,1,5,3}; +int lc6[6] = {8,7,6,5,10,10}; // Nombre de livres -int nlc1[6] = {3,7,1,1,2,5}; -int nlc2[6] = {3,7,1,1,0,0}; -int nlc3[6] = {3,5,1,8,2,0}; -int nlc4[6] = {1,4,1,8,2,0}; -int nlc5[6] = {3,2,5,8,2,0}; -int nlc6[6] = {3,0,0,0,0,0}; +int nlc1[6] = {7,8,1,2,5,4}; +int nlc2[6] = {1,2,3,0,0,0}; +int nlc3[6] = {7,8,1,2,5,0}; +int nlc4[6] = {8,12,7,7,7,7}; +int nlc5[6] = {10,10,10,10,10,10}; +int nlc6[6] = {3,10,10,10,0,0}; //ROMAN = BALZAC @@ -69,6 +73,7 @@ bool ledbt=0; pc.baud(9600); bluetooth1.baud(38400); + ESP.baud(9600); BSP_LCD_Init(); BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS); @@ -96,8 +101,9 @@ BSP_LCD_SetFont(&Font12); BSP_LCD_SetBackColor(LCD_COLOR_WHITE); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); - - + + ESP.attach(&Rx_interrupt, Serial::RxIrq); + while(1) { // DETECTION CLICS @@ -138,10 +144,11 @@ BSP_LCD_FillRect(391, 210, 24, 20); BSP_LCD_SetTextColor(LCD_COLOR_BLACK); } + //////////////////////////////////////////////////////////////////////////////// - //////////////////CLICS////////////// + ////////////////CLICS//////////////// // PAGE COMMANDE VERS PAGE D'ACCUEIL if ((page == 0) && (x>= 458 && x<= 480) && (y>= 0 && y<= 22)) @@ -1076,4 +1083,36 @@ } } } + } + + void Rx_interrupt() { + + /* char texte[]="{*2*:0,*1*:0,*2*:0"; + //int lc1[6] = {10,10,10,10,10,10}; int nlc1[6] = {0,0,0,0,0,0}; + char nombre[20]; + bool flag1 = false; + int start_index = 0, end_index = 0; + + //chaine[t]=ESP.getc(); + for (int i=0; i<sizeof(texte); i++) + { + if(texte[i] == '*'){ + flag1 = true; + start_index = i+1; + break; + } + } + + for(int i=start_index; i<sizeof(texte); i++){ + if(texte[i] == '*' && flag1 == true){ + end_index = i; + } + } + + for(int i=start_index; i<end_index; i++){ + nombre[i-start_index] = texte[i]; + } + + lc1[1]=atoi(nombre);*/ + } \ No newline at end of file