Fabien MOULINNEUF
/
Projet
fini
main.cpp@26:31abf8bdcddb, 2021-06-23 (annotated)
- Committer:
- Pmpolo
- Date:
- Wed Jun 23 11:51:05 2021 +0000
- Revision:
- 26:31abf8bdcddb
- Parent:
- 25:586781d009dd
- Child:
- 27:1478931d1205
fini
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pmpolo | 26:31abf8bdcddb | 1 | |
Pmpolo | 26:31abf8bdcddb | 2 | #include "mbed.h" |
Pmpolo | 26:31abf8bdcddb | 3 | #include "F746_GUI.hpp" |
Pmpolo | 26:31abf8bdcddb | 4 | #include "CCLogo.h" |
Pmpolo | 26:31abf8bdcddb | 5 | |
Pmpolo | 26:31abf8bdcddb | 6 | Serial Communication(PC_6, PC_7,115200); //Declaration serial |
Pmpolo | 26:31abf8bdcddb | 7 | Timer timerEnvoieTrame; // Timer pour l'envoie de trame |
Pmpolo | 26:31abf8bdcddb | 8 | |
Pmpolo | 26:31abf8bdcddb | 9 | int tailleBuffer=100; |
Pmpolo | 26:31abf8bdcddb | 10 | |
Pmpolo | 26:31abf8bdcddb | 11 | void drawImage_CCLogo(int offsetX, int offsetY) |
Pmpolo | 26:31abf8bdcddb | 12 | { |
Pmpolo | 26:31abf8bdcddb | 13 | int x = 0; |
Pmpolo | 26:31abf8bdcddb | 14 | int y = 0; |
Pmpolo | 26:31abf8bdcddb | 15 | uint32_t* dataPtr = (uint32_t*)CCLogo.data; |
Pmpolo | 26:31abf8bdcddb | 16 | while(y < CCLogo.height) { |
Pmpolo | 26:31abf8bdcddb | 17 | while(x < CCLogo.width) { |
Pmpolo | 26:31abf8bdcddb | 18 | BSP_LCD_DrawPixel(x + offsetX, y + offsetY, *dataPtr); |
Pmpolo | 26:31abf8bdcddb | 19 | dataPtr++; |
Pmpolo | 26:31abf8bdcddb | 20 | x++; |
Pmpolo | 26:31abf8bdcddb | 21 | } |
Pmpolo | 26:31abf8bdcddb | 22 | x = 0; |
Pmpolo | 26:31abf8bdcddb | 23 | y++; |
Pmpolo | 26:31abf8bdcddb | 24 | } |
Pmpolo | 26:31abf8bdcddb | 25 | } |
Pmpolo | 26:31abf8bdcddb | 26 | |
Pmpolo | 26:31abf8bdcddb | 27 | |
Pmpolo | 26:31abf8bdcddb | 28 | int EmpDerVal(int *ptab){ //Recupere a quel emplacmeent il y a une valeur |
Pmpolo | 26:31abf8bdcddb | 29 | int Emplacement=-1; |
Pmpolo | 26:31abf8bdcddb | 30 | |
MikamiUitOpen | 0:629ff18592b9 | 31 | |
Pmpolo | 26:31abf8bdcddb | 32 | if(*ptab==-1) Emplacement=0; |
Pmpolo | 26:31abf8bdcddb | 33 | else{ |
Pmpolo | 26:31abf8bdcddb | 34 | for(int i=2;i<=tailleBuffer*2;i=i+2){ |
Pmpolo | 26:31abf8bdcddb | 35 | if(*(ptab+i)==-1){ |
Pmpolo | 26:31abf8bdcddb | 36 | Emplacement=i/2; |
Pmpolo | 26:31abf8bdcddb | 37 | i=tailleBuffer*2+1; |
Pmpolo | 26:31abf8bdcddb | 38 | } |
Pmpolo | 26:31abf8bdcddb | 39 | } |
Pmpolo | 26:31abf8bdcddb | 40 | } |
Pmpolo | 26:31abf8bdcddb | 41 | |
Pmpolo | 26:31abf8bdcddb | 42 | return Emplacement*2; // revoie l'emplacement *2 car tab 2 dimension |
Pmpolo | 26:31abf8bdcddb | 43 | } |
Pmpolo | 26:31abf8bdcddb | 44 | |
Pmpolo | 26:31abf8bdcddb | 45 | void AppendTableau(int *ptab, int index, int data){ //Ajouter valeur dans le buffer |
Pmpolo | 26:31abf8bdcddb | 46 | int LastEmplacment=EmpDerVal((int*) ptab); |
Pmpolo | 26:31abf8bdcddb | 47 | |
Pmpolo | 26:31abf8bdcddb | 48 | *(ptab+LastEmplacment)=index; |
Pmpolo | 26:31abf8bdcddb | 49 | *(ptab+LastEmplacment+1)=data; |
Pmpolo | 26:31abf8bdcddb | 50 | } |
Pmpolo | 26:31abf8bdcddb | 51 | |
Pmpolo | 26:31abf8bdcddb | 52 | void SendVal(int *ptab){ // Envoie une valeur |
Pmpolo | 26:31abf8bdcddb | 53 | int LastEmplacment=EmpDerVal((int*) ptab), index=-1, data=-1; |
Pmpolo | 26:31abf8bdcddb | 54 | if(LastEmplacment==0 || LastEmplacment==-1){ |
Pmpolo | 26:31abf8bdcddb | 55 | //Buffer vide |
Pmpolo | 26:31abf8bdcddb | 56 | } |
Pmpolo | 26:31abf8bdcddb | 57 | else{ // buffer non vide |
Pmpolo | 26:31abf8bdcddb | 58 | index=*ptab; // l'ecture de l'index |
Pmpolo | 26:31abf8bdcddb | 59 | data=*(ptab+1); // l'ecture de la data |
Pmpolo | 26:31abf8bdcddb | 60 | Communication.putc(0xfb); //debut de la trame |
Pmpolo | 26:31abf8bdcddb | 61 | Communication.putc(index); // index |
Pmpolo | 26:31abf8bdcddb | 62 | Communication.putc(data); // data |
Pmpolo | 26:31abf8bdcddb | 63 | Communication.putc(0xfe); // fin de trame |
Pmpolo | 26:31abf8bdcddb | 64 | for(int i=0;i<LastEmplacment;i=i+2){ //actualisation du buffer |
Pmpolo | 26:31abf8bdcddb | 65 | *(ptab+i)=*(ptab+i+2); |
Pmpolo | 26:31abf8bdcddb | 66 | *(ptab+i+1)=*(ptab+i+3); |
Pmpolo | 26:31abf8bdcddb | 67 | } |
Pmpolo | 26:31abf8bdcddb | 68 | } |
Pmpolo | 26:31abf8bdcddb | 69 | } |
MikamiUitOpen | 0:629ff18592b9 | 70 | |
MikamiUitOpen | 0:629ff18592b9 | 71 | int main() |
MikamiUitOpen | 0:629ff18592b9 | 72 | { |
Pmpolo | 26:31abf8bdcddb | 73 | int NumBoutonGroupMode=0, NumBoutonGroupeLeds=0; |
Pmpolo | 26:31abf8bdcddb | 74 | int TabBuffer[tailleBuffer][2]; |
Pmpolo | 26:31abf8bdcddb | 75 | int NivoBatt = 75,Vitesse=0, VitesseMax=25; |
Pmpolo | 26:31abf8bdcddb | 76 | |
Pmpolo | 26:31abf8bdcddb | 77 | |
Pmpolo | 26:31abf8bdcddb | 78 | |
Pmpolo | 26:31abf8bdcddb | 79 | for(int i=0; i<tailleBuffer-1; i++) { //initialisation du buffer |
Pmpolo | 26:31abf8bdcddb | 80 | TabBuffer[i][0]=-1; |
Pmpolo | 26:31abf8bdcddb | 81 | TabBuffer[i][1]=-1; |
Pmpolo | 26:31abf8bdcddb | 82 | } |
Pmpolo | 26:31abf8bdcddb | 83 | |
Pmpolo | 26:31abf8bdcddb | 84 | |
Pmpolo | 26:31abf8bdcddb | 85 | Label Titre(240, 2, "Interface Trottinette", Label::CENTER, Font20); // titre |
MikamiUitOpen | 0:629ff18592b9 | 86 | |
Pmpolo | 26:31abf8bdcddb | 87 | SeekBar barVitesse(20, 230, 200, 0, 100, 0, "0", "Vitesse km/h",""); |
Pmpolo | 26:31abf8bdcddb | 88 | NumericLabel<float> numLabeVitesse(90, 250, "%5.1f", barVitesse.GetValue(),Label::CENTER,Font12,0xFFFFFFFF, 0xFF000000); |
Pmpolo | 26:31abf8bdcddb | 89 | NumericLabel<int> ValMaxVitesse(220, 200, "%d", VitesseMax,Label::CENTER,Font12,0xFFFFFFFF, 0xFF000000); |
Pmpolo | 26:31abf8bdcddb | 90 | |
Pmpolo | 26:31abf8bdcddb | 91 | SeekBar barBatterie(260, 230, 200, 0, 100, 75, "0", "Niveau Batterie %", "100"); |
Pmpolo | 26:31abf8bdcddb | 92 | NumericLabel<float> numLabelBatterie(340, 250, "%5.1f", barBatterie.GetValue(),Label::CENTER,Font12,0xFFFFFFFF, 0xFF000000); |
MikamiUitOpen | 0:629ff18592b9 | 93 | |
Pmpolo | 26:31abf8bdcddb | 94 | ButtonGroup boutonGroupeMode(300, 80, 66, 35, 4,(string[]) { |
Pmpolo | 26:31abf8bdcddb | 95 | "Sport", "Normal", "ECO", "Pieton" |
Pmpolo | 26:31abf8bdcddb | 96 | }, 2, 2, 2, 1, |
Pmpolo | 26:31abf8bdcddb | 97 | Font12, LCD_COLOR_WHITE, 0xFFFEAAAA, 0xFFFF0000, 0xFFFF0000); |
Pmpolo | 26:31abf8bdcddb | 98 | boutonGroupeMode.Inactivate(0); |
Pmpolo | 26:31abf8bdcddb | 99 | Label TitreMode(370, 60, "Mode", Label::CENTER, Font16); |
MikamiUitOpen | 0:629ff18592b9 | 100 | |
Pmpolo | 26:31abf8bdcddb | 101 | ButtonGroup boutonsGroupeLed(80, 80, 66, 35, 2,(string[]) { |
Pmpolo | 26:31abf8bdcddb | 102 | "ON", "OFF" |
Pmpolo | 26:31abf8bdcddb | 103 | }, 2, 2, 1, 1, |
Pmpolo | 26:31abf8bdcddb | 104 | Font12, LCD_COLOR_BLACK, 0xFFFE0000, 0xFFFFFF00, 0xFFFFFF00); |
Pmpolo | 26:31abf8bdcddb | 105 | boutonsGroupeLed.Inactivate(0); |
Pmpolo | 26:31abf8bdcddb | 106 | Label TitreLeds(120, 60, "Lumiere", Label::CENTER, Font16); |
MikamiUitOpen | 1:b4bcb6fa2a1d | 107 | |
Pmpolo | 26:31abf8bdcddb | 108 | ButtonGroup boutonGroupeBatt(415, 5, 10, 5, 4,(string[]) { |
Pmpolo | 26:31abf8bdcddb | 109 | "", "", "", "" |
Pmpolo | 26:31abf8bdcddb | 110 | }, 2, 2, 4, 1, |
Pmpolo | 26:31abf8bdcddb | 111 | Font12); |
Pmpolo | 26:31abf8bdcddb | 112 | boutonGroupeBatt.InactivateAll(); |
Pmpolo | 26:31abf8bdcddb | 113 | |
Pmpolo | 26:31abf8bdcddb | 114 | drawImage_CCLogo(0,0); |
Pmpolo | 26:31abf8bdcddb | 115 | |
Pmpolo | 26:31abf8bdcddb | 116 | timerEnvoieTrame.start(); |
Pmpolo | 26:31abf8bdcddb | 117 | |
Pmpolo | 26:31abf8bdcddb | 118 | while(1) { |
Pmpolo | 26:31abf8bdcddb | 119 | |
Pmpolo | 26:31abf8bdcddb | 120 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); // change le parametre de couleur du fond pour label |
MikamiUitOpen | 3:e92615be71c7 | 121 | |
Pmpolo | 26:31abf8bdcddb | 122 | if (barVitesse.Slide()) { |
Pmpolo | 26:31abf8bdcddb | 123 | numLabeVitesse.Draw("%5.1f", (barVitesse.GetValue()*VitesseMax)/100); //calcul val barslide a partir d'une bar sur 100 |
Pmpolo | 26:31abf8bdcddb | 124 | Vitesse = (int) (barVitesse.GetValue()*VitesseMax)/100; |
Pmpolo | 26:31abf8bdcddb | 125 | AppendTableau(*TabBuffer,0x01,Vitesse); |
Pmpolo | 26:31abf8bdcddb | 126 | } |
Pmpolo | 26:31abf8bdcddb | 127 | |
Pmpolo | 26:31abf8bdcddb | 128 | if (barBatterie.Slide()) { |
Pmpolo | 26:31abf8bdcddb | 129 | numLabelBatterie.Draw("%5.1f", barBatterie.GetValue()); |
Pmpolo | 26:31abf8bdcddb | 130 | NivoBatt = (int) barBatterie.GetValue(); |
Pmpolo | 26:31abf8bdcddb | 131 | AppendTableau(*TabBuffer,0x02,NivoBatt); |
Pmpolo | 26:31abf8bdcddb | 132 | |
Pmpolo | 26:31abf8bdcddb | 133 | //Manipulation de la valeur du niveau de batterie |
Pmpolo | 26:31abf8bdcddb | 134 | if (NivoBatt < 25 && NivoBatt > 0){ |
Pmpolo | 26:31abf8bdcddb | 135 | boutonGroupeBatt.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 136 | boutonGroupeBatt.Inactivate(1); |
Pmpolo | 26:31abf8bdcddb | 137 | boutonGroupeBatt.Inactivate(2); |
Pmpolo | 26:31abf8bdcddb | 138 | boutonGroupeBatt.Inactivate(3); |
Pmpolo | 26:31abf8bdcddb | 139 | boutonGroupeBatt.Draw(0, 0xFFFF0000, 0xFFFF0000); |
MikamiUitOpen | 0:629ff18592b9 | 140 | |
Pmpolo | 26:31abf8bdcddb | 141 | |
Pmpolo | 26:31abf8bdcddb | 142 | } |
Pmpolo | 26:31abf8bdcddb | 143 | else if (NivoBatt < 50 && NivoBatt > 26){ |
Pmpolo | 26:31abf8bdcddb | 144 | boutonGroupeBatt.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 145 | boutonGroupeBatt.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 146 | boutonGroupeBatt.Inactivate(2); |
Pmpolo | 26:31abf8bdcddb | 147 | boutonGroupeBatt.Inactivate(3); |
Pmpolo | 26:31abf8bdcddb | 148 | boutonGroupeBatt.Draw(0, 0xFFFFAA00, 0xFFFFAA00); |
Pmpolo | 26:31abf8bdcddb | 149 | boutonGroupeBatt.Draw(1, 0xFFFFAA00, 0xFFFFAA00); |
Pmpolo | 26:31abf8bdcddb | 150 | } |
Pmpolo | 26:31abf8bdcddb | 151 | |
Pmpolo | 26:31abf8bdcddb | 152 | else if (NivoBatt < 75 && NivoBatt > 51){ |
Pmpolo | 26:31abf8bdcddb | 153 | boutonGroupeBatt.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 154 | boutonGroupeBatt.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 155 | boutonGroupeBatt.Activate(2); |
Pmpolo | 26:31abf8bdcddb | 156 | boutonGroupeBatt.Inactivate(3); |
Pmpolo | 26:31abf8bdcddb | 157 | boutonGroupeBatt.Draw(0, 0xFFFCFF00, 0xFFFCFF00); |
Pmpolo | 26:31abf8bdcddb | 158 | boutonGroupeBatt.Draw(1, 0xFFFCFF00, 0xFFFCFF00); |
Pmpolo | 26:31abf8bdcddb | 159 | boutonGroupeBatt.Draw(2, 0xFFFCFF00, 0xFFFCFF00); |
MikamiUitOpen | 21:61059fe1ec47 | 160 | |
Pmpolo | 26:31abf8bdcddb | 161 | } |
Pmpolo | 26:31abf8bdcddb | 162 | else if (NivoBatt > 76){ |
Pmpolo | 26:31abf8bdcddb | 163 | boutonGroupeBatt.ActivateAll(); |
Pmpolo | 26:31abf8bdcddb | 164 | boutonGroupeBatt.Draw(0, 0xFF47FF00, 0xFF47FF00); |
Pmpolo | 26:31abf8bdcddb | 165 | boutonGroupeBatt.Draw(1, 0xFF47FF00, 0xFF47FF00); |
Pmpolo | 26:31abf8bdcddb | 166 | boutonGroupeBatt.Draw(2, 0xFF47FF00, 0xFF47FF00); |
Pmpolo | 26:31abf8bdcddb | 167 | boutonGroupeBatt.Draw(3, 0xFF47FF00, 0xFF47FF00); |
MikamiUitOpen | 21:61059fe1ec47 | 168 | |
Pmpolo | 26:31abf8bdcddb | 169 | } |
Pmpolo | 26:31abf8bdcddb | 170 | else if (NivoBatt < 0){ |
Pmpolo | 26:31abf8bdcddb | 171 | boutonGroupeBatt.InactivateAll(); |
Pmpolo | 26:31abf8bdcddb | 172 | } |
Pmpolo | 26:31abf8bdcddb | 173 | } |
Pmpolo | 26:31abf8bdcddb | 174 | |
MikamiUitOpen | 8:8a55f2e374da | 175 | |
Pmpolo | 26:31abf8bdcddb | 176 | NumBoutonGroupMode=boutonGroupeMode.GetTouchedNumber(); //actualisation groupe bouton mode |
Pmpolo | 26:31abf8bdcddb | 177 | if (boutonGroupeMode.GetTouchedNumber(NumBoutonGroupMode)) |
Pmpolo | 26:31abf8bdcddb | 178 | switch (NumBoutonGroupMode) { |
Pmpolo | 26:31abf8bdcddb | 179 | case 0: //mode Sport 25km/h Max |
Pmpolo | 26:31abf8bdcddb | 180 | VitesseMax=25; |
Pmpolo | 26:31abf8bdcddb | 181 | boutonGroupeMode.Inactivate(0); // activer et desactive les boutons |
Pmpolo | 26:31abf8bdcddb | 182 | boutonGroupeMode.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 183 | boutonGroupeMode.Activate(2); |
Pmpolo | 26:31abf8bdcddb | 184 | boutonGroupeMode.Activate(3); |
Pmpolo | 26:31abf8bdcddb | 185 | AppendTableau(*TabBuffer,0x03,0x01); // envoie l'info du bouton |
Pmpolo | 26:31abf8bdcddb | 186 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); |
Pmpolo | 26:31abf8bdcddb | 187 | |
Pmpolo | 26:31abf8bdcddb | 188 | ValMaxVitesse.Draw("%d",VitesseMax); //recalcul de la vitesse a partir de l'emplacement curseur du slide |
Pmpolo | 26:31abf8bdcddb | 189 | numLabeVitesse.Draw("%5.1f", (barVitesse.GetValue()*VitesseMax)/100); |
Pmpolo | 26:31abf8bdcddb | 190 | Vitesse = (int) (barVitesse.GetValue()*VitesseMax)/100; |
Pmpolo | 26:31abf8bdcddb | 191 | //AppendTableau(*TabBuffer,0x01,Vitesse); |
Pmpolo | 26:31abf8bdcddb | 192 | break; |
Pmpolo | 26:31abf8bdcddb | 193 | case 1: //mode Normal 20km/h Max |
Pmpolo | 26:31abf8bdcddb | 194 | VitesseMax=20; |
Pmpolo | 26:31abf8bdcddb | 195 | boutonGroupeMode.Inactivate(1); |
Pmpolo | 26:31abf8bdcddb | 196 | boutonGroupeMode.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 197 | boutonGroupeMode.Activate(2); |
Pmpolo | 26:31abf8bdcddb | 198 | boutonGroupeMode.Activate(3); |
Pmpolo | 26:31abf8bdcddb | 199 | AppendTableau(*TabBuffer,0x03,0x02); |
Pmpolo | 26:31abf8bdcddb | 200 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); |
Pmpolo | 26:31abf8bdcddb | 201 | |
Pmpolo | 26:31abf8bdcddb | 202 | ValMaxVitesse.Draw("%d",VitesseMax); |
Pmpolo | 26:31abf8bdcddb | 203 | numLabeVitesse.Draw("%5.1f", (barVitesse.GetValue()*VitesseMax)/100); |
Pmpolo | 26:31abf8bdcddb | 204 | Vitesse = (int) (barVitesse.GetValue()*VitesseMax)/100; |
Pmpolo | 26:31abf8bdcddb | 205 | //AppendTableau(*TabBuffer,0x01,Vitesse); |
MikamiUitOpen | 0:629ff18592b9 | 206 | |
Pmpolo | 26:31abf8bdcddb | 207 | break; |
MikamiUitOpen | 0:629ff18592b9 | 208 | |
Pmpolo | 26:31abf8bdcddb | 209 | case 2: //mode Eco 15km/h Max |
Pmpolo | 26:31abf8bdcddb | 210 | VitesseMax=15; |
Pmpolo | 26:31abf8bdcddb | 211 | boutonGroupeMode.Inactivate(2); |
Pmpolo | 26:31abf8bdcddb | 212 | boutonGroupeMode.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 213 | boutonGroupeMode.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 214 | boutonGroupeMode.Activate(3); |
Pmpolo | 26:31abf8bdcddb | 215 | AppendTableau(*TabBuffer,0x03,0x03); |
Pmpolo | 26:31abf8bdcddb | 216 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); |
Pmpolo | 26:31abf8bdcddb | 217 | |
Pmpolo | 26:31abf8bdcddb | 218 | ValMaxVitesse.Draw("%d",VitesseMax); |
Pmpolo | 26:31abf8bdcddb | 219 | numLabeVitesse.Draw("%5.1f", (barVitesse.GetValue()*VitesseMax)/100); |
Pmpolo | 26:31abf8bdcddb | 220 | Vitesse = (int) (barVitesse.GetValue()*VitesseMax)/100; |
Pmpolo | 26:31abf8bdcddb | 221 | //AppendTableau(*TabBuffer,0x01,Vitesse); |
Pmpolo | 26:31abf8bdcddb | 222 | break; |
MikamiUitOpen | 0:629ff18592b9 | 223 | |
Pmpolo | 26:31abf8bdcddb | 224 | case 3: //mode Pieton 6km/h Max |
Pmpolo | 26:31abf8bdcddb | 225 | VitesseMax=6; |
Pmpolo | 26:31abf8bdcddb | 226 | boutonGroupeMode.Inactivate(3); |
Pmpolo | 26:31abf8bdcddb | 227 | boutonGroupeMode.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 228 | boutonGroupeMode.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 229 | boutonGroupeMode.Activate(2); |
Pmpolo | 26:31abf8bdcddb | 230 | AppendTableau(*TabBuffer,0x03,0x04); |
Pmpolo | 26:31abf8bdcddb | 231 | BSP_LCD_SetBackColor(LCD_COLOR_BLACK); |
Pmpolo | 26:31abf8bdcddb | 232 | |
Pmpolo | 26:31abf8bdcddb | 233 | ValMaxVitesse.Draw("%d",VitesseMax); |
Pmpolo | 26:31abf8bdcddb | 234 | numLabeVitesse.Draw("%5.1f", (barVitesse.GetValue()*VitesseMax)/100); |
Pmpolo | 26:31abf8bdcddb | 235 | Vitesse = (int) (barVitesse.GetValue()*VitesseMax)/100; |
Pmpolo | 26:31abf8bdcddb | 236 | //AppendTableau(*TabBuffer,0x01,Vitesse); |
MikamiUitOpen | 1:b4bcb6fa2a1d | 237 | break; |
Pmpolo | 26:31abf8bdcddb | 238 | |
Pmpolo | 26:31abf8bdcddb | 239 | } |
Pmpolo | 26:31abf8bdcddb | 240 | |
Pmpolo | 26:31abf8bdcddb | 241 | NumBoutonGroupeLeds=boutonsGroupeLed.GetTouchedNumber(); |
Pmpolo | 26:31abf8bdcddb | 242 | if (boutonsGroupeLed.GetTouchedNumber(NumBoutonGroupeLeds)) |
Pmpolo | 26:31abf8bdcddb | 243 | switch (NumBoutonGroupeLeds) { |
Pmpolo | 26:31abf8bdcddb | 244 | case 0: //Led ON |
Pmpolo | 26:31abf8bdcddb | 245 | boutonsGroupeLed.Inactivate(0); |
Pmpolo | 26:31abf8bdcddb | 246 | boutonsGroupeLed.Activate(1); |
Pmpolo | 26:31abf8bdcddb | 247 | AppendTableau(*TabBuffer,0x04,0x01); |
MikamiUitOpen | 1:b4bcb6fa2a1d | 248 | break; |
Pmpolo | 26:31abf8bdcddb | 249 | |
Pmpolo | 26:31abf8bdcddb | 250 | case 1: //Led OFF |
Pmpolo | 26:31abf8bdcddb | 251 | boutonsGroupeLed.Inactivate(1); |
Pmpolo | 26:31abf8bdcddb | 252 | boutonsGroupeLed.Activate(0); |
Pmpolo | 26:31abf8bdcddb | 253 | AppendTableau(*TabBuffer,0x04,0x0F); |
MikamiUitOpen | 1:b4bcb6fa2a1d | 254 | break; |
Pmpolo | 26:31abf8bdcddb | 255 | } |
Pmpolo | 26:31abf8bdcddb | 256 | |
Pmpolo | 26:31abf8bdcddb | 257 | |
Pmpolo | 26:31abf8bdcddb | 258 | if(timerEnvoieTrame.read()>0.01){ //Si timer envoie trame |
Pmpolo | 26:31abf8bdcddb | 259 | SendVal(*TabBuffer); //envoie du buffer pour check si il y a valeur a envoier |
Pmpolo | 26:31abf8bdcddb | 260 | timerEnvoieTrame.reset(); // reset du timer |
MikamiUitOpen | 0:629ff18592b9 | 261 | } |
MikamiUitOpen | 0:629ff18592b9 | 262 | |
MikamiUitOpen | 0:629ff18592b9 | 263 | } |
MikamiUitOpen | 0:629ff18592b9 | 264 | } |
MikamiUitOpen | 21:61059fe1ec47 | 265 |