Library for 3.2'' uLcd Picaso Display4D system Picaso Serial Environment Command Set web: http://www.4dsystems.com.au/product/20/67/Processors_Graphics/PICASO/
Keyboard.cpp@1:a74e42cf52b2, 2015-04-05 (annotated)
- Committer:
- adelino
- Date:
- Sun Apr 05 13:54:48 2015 +0000
- Revision:
- 1:a74e42cf52b2
PicasoLib version 2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
adelino | 1:a74e42cf52b2 | 1 | #include "Keyboard.h" |
adelino | 1:a74e42cf52b2 | 2 | |
adelino | 1:a74e42cf52b2 | 3 | // |
adelino | 1:a74e42cf52b2 | 4 | Keyboard::Keyboard(Screen* pscreen,string titre,Nunchuk* pnunchuk,Buzzer* pbuzzer,float sampleTime):myScreen(pscreen),myTitre(titre), |
adelino | 1:a74e42cf52b2 | 5 | myBuzzer(pbuzzer),myNunchuk(pnunchuk),mySampleTime(sampleTime) |
adelino | 1:a74e42cf52b2 | 6 | { |
adelino | 1:a74e42cf52b2 | 7 | myBeep= new Note("F%4",50); |
adelino | 1:a74e42cf52b2 | 8 | myEnter=false; |
adelino | 1:a74e42cf52b2 | 9 | |
adelino | 1:a74e42cf52b2 | 10 | myIndice=0; |
adelino | 1:a74e42cf52b2 | 11 | myPointeur=0; |
adelino | 1:a74e42cf52b2 | 12 | |
adelino | 1:a74e42cf52b2 | 13 | initialisation(); |
adelino | 1:a74e42cf52b2 | 14 | |
adelino | 1:a74e42cf52b2 | 15 | createScreen(); |
adelino | 1:a74e42cf52b2 | 16 | } |
adelino | 1:a74e42cf52b2 | 17 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 18 | Keyboard::Keyboard(Screen* pscreen,string titre,Buzzer* pbuzzer):myScreen(pscreen),myTitre(titre),myBuzzer(pbuzzer) |
adelino | 1:a74e42cf52b2 | 19 | { |
adelino | 1:a74e42cf52b2 | 20 | myNunchuk=NULL; |
adelino | 1:a74e42cf52b2 | 21 | mySampleTime=0.1; |
adelino | 1:a74e42cf52b2 | 22 | |
adelino | 1:a74e42cf52b2 | 23 | myBeep= new Note("F%4",50); |
adelino | 1:a74e42cf52b2 | 24 | myEnter=false; |
adelino | 1:a74e42cf52b2 | 25 | |
adelino | 1:a74e42cf52b2 | 26 | myIndice=0; |
adelino | 1:a74e42cf52b2 | 27 | myPointeur=0; |
adelino | 1:a74e42cf52b2 | 28 | |
adelino | 1:a74e42cf52b2 | 29 | initialisation(); |
adelino | 1:a74e42cf52b2 | 30 | |
adelino | 1:a74e42cf52b2 | 31 | createScreen(); |
adelino | 1:a74e42cf52b2 | 32 | } |
adelino | 1:a74e42cf52b2 | 33 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 34 | void Keyboard::initialisation(void) |
adelino | 1:a74e42cf52b2 | 35 | { |
adelino | 1:a74e42cf52b2 | 36 | myMessage.event=EVENT_NO_ACTIVITY; |
adelino | 1:a74e42cf52b2 | 37 | myMessage.objId=0; |
adelino | 1:a74e42cf52b2 | 38 | myMessage.posiX=0; |
adelino | 1:a74e42cf52b2 | 39 | myMessage.posiY=0; |
adelino | 1:a74e42cf52b2 | 40 | |
adelino | 1:a74e42cf52b2 | 41 | for(int i=0; i<50; i++) { |
adelino | 1:a74e42cf52b2 | 42 | myBuffer[i]='\0'; |
adelino | 1:a74e42cf52b2 | 43 | } |
adelino | 1:a74e42cf52b2 | 44 | // |
adelino | 1:a74e42cf52b2 | 45 | for(int i=0; i<40; i++) { |
adelino | 1:a74e42cf52b2 | 46 | myTabBtn[i]=0; |
adelino | 1:a74e42cf52b2 | 47 | } |
adelino | 1:a74e42cf52b2 | 48 | myString=""; |
adelino | 1:a74e42cf52b2 | 49 | |
adelino | 1:a74e42cf52b2 | 50 | pLabelTitre=0; |
adelino | 1:a74e42cf52b2 | 51 | pLabel=0; |
adelino | 1:a74e42cf52b2 | 52 | |
adelino | 1:a74e42cf52b2 | 53 | pBtn_0=0; |
adelino | 1:a74e42cf52b2 | 54 | pBtn_1=0; |
adelino | 1:a74e42cf52b2 | 55 | pBtn_2=0; |
adelino | 1:a74e42cf52b2 | 56 | pBtn_3=0; |
adelino | 1:a74e42cf52b2 | 57 | pBtn_4=0; |
adelino | 1:a74e42cf52b2 | 58 | pBtn_5=0; |
adelino | 1:a74e42cf52b2 | 59 | pBtn_6=0; |
adelino | 1:a74e42cf52b2 | 60 | pBtn_7=0; |
adelino | 1:a74e42cf52b2 | 61 | pBtn_8=0; |
adelino | 1:a74e42cf52b2 | 62 | pBtn_9=0; |
adelino | 1:a74e42cf52b2 | 63 | |
adelino | 1:a74e42cf52b2 | 64 | pBtn_A=0; |
adelino | 1:a74e42cf52b2 | 65 | pBtn_B=0; |
adelino | 1:a74e42cf52b2 | 66 | pBtn_C=0; |
adelino | 1:a74e42cf52b2 | 67 | pBtn_D=0; |
adelino | 1:a74e42cf52b2 | 68 | pBtn_E=0; |
adelino | 1:a74e42cf52b2 | 69 | pBtn_F=0; |
adelino | 1:a74e42cf52b2 | 70 | pBtn_G=0; |
adelino | 1:a74e42cf52b2 | 71 | pBtn_H=0; |
adelino | 1:a74e42cf52b2 | 72 | pBtn_I=0; |
adelino | 1:a74e42cf52b2 | 73 | pBtn_J=0; |
adelino | 1:a74e42cf52b2 | 74 | |
adelino | 1:a74e42cf52b2 | 75 | pBtn_K=0; |
adelino | 1:a74e42cf52b2 | 76 | pBtn_L=0; |
adelino | 1:a74e42cf52b2 | 77 | pBtn_M=0; |
adelino | 1:a74e42cf52b2 | 78 | pBtn_N=0; |
adelino | 1:a74e42cf52b2 | 79 | pBtn_O=0; |
adelino | 1:a74e42cf52b2 | 80 | pBtn_P=0; |
adelino | 1:a74e42cf52b2 | 81 | pBtn_Q=0; |
adelino | 1:a74e42cf52b2 | 82 | pBtn_R=0; |
adelino | 1:a74e42cf52b2 | 83 | pBtn_S=0; |
adelino | 1:a74e42cf52b2 | 84 | pBtn_T=0; |
adelino | 1:a74e42cf52b2 | 85 | pBtn_U=0; |
adelino | 1:a74e42cf52b2 | 86 | |
adelino | 1:a74e42cf52b2 | 87 | pBtn_V=0; |
adelino | 1:a74e42cf52b2 | 88 | pBtn_W=0; |
adelino | 1:a74e42cf52b2 | 89 | pBtn_X=0; |
adelino | 1:a74e42cf52b2 | 90 | pBtn_Y=0; |
adelino | 1:a74e42cf52b2 | 91 | pBtn_Z=0; |
adelino | 1:a74e42cf52b2 | 92 | |
adelino | 1:a74e42cf52b2 | 93 | pBtn_Point=0; |
adelino | 1:a74e42cf52b2 | 94 | |
adelino | 1:a74e42cf52b2 | 95 | pBtn_Esp=0; |
adelino | 1:a74e42cf52b2 | 96 | pBtn_Del=0; |
adelino | 1:a74e42cf52b2 | 97 | pBtn_Ok=0; |
adelino | 1:a74e42cf52b2 | 98 | } |
adelino | 1:a74e42cf52b2 | 99 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 100 | Keyboard::~Keyboard(void) |
adelino | 1:a74e42cf52b2 | 101 | { |
adelino | 1:a74e42cf52b2 | 102 | myTicker.detach(); |
adelino | 1:a74e42cf52b2 | 103 | |
adelino | 1:a74e42cf52b2 | 104 | if(myScreen!=NULL) |
adelino | 1:a74e42cf52b2 | 105 | delete myScreen; |
adelino | 1:a74e42cf52b2 | 106 | |
adelino | 1:a74e42cf52b2 | 107 | if(myBeep!=NULL) |
adelino | 1:a74e42cf52b2 | 108 | delete myBeep; |
adelino | 1:a74e42cf52b2 | 109 | |
adelino | 1:a74e42cf52b2 | 110 | } |
adelino | 1:a74e42cf52b2 | 111 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 112 | bool Keyboard::isEnterPressed(void) |
adelino | 1:a74e42cf52b2 | 113 | { |
adelino | 1:a74e42cf52b2 | 114 | return myEnter; |
adelino | 1:a74e42cf52b2 | 115 | } |
adelino | 1:a74e42cf52b2 | 116 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 117 | void Keyboard::loop(void) |
adelino | 1:a74e42cf52b2 | 118 | { |
adelino | 1:a74e42cf52b2 | 119 | |
adelino | 1:a74e42cf52b2 | 120 | if(myNunchuk==NULL) { |
adelino | 1:a74e42cf52b2 | 121 | |
adelino | 1:a74e42cf52b2 | 122 | TouchEvent event=myScreen->getTouchEvent(&myMessage);//EVENT_NO_ACTIVITY EVENT_PRESS EVENT_RELEASE EVENT_MOVE |
adelino | 1:a74e42cf52b2 | 123 | |
adelino | 1:a74e42cf52b2 | 124 | if(event>0) { |
adelino | 1:a74e42cf52b2 | 125 | myScreen->getProcessMessage(&myMessage); |
adelino | 1:a74e42cf52b2 | 126 | affiche(); |
adelino | 1:a74e42cf52b2 | 127 | |
adelino | 1:a74e42cf52b2 | 128 | } |
adelino | 1:a74e42cf52b2 | 129 | } |
adelino | 1:a74e42cf52b2 | 130 | // |
adelino | 1:a74e42cf52b2 | 131 | else { |
adelino | 1:a74e42cf52b2 | 132 | myNunchuk->process(); |
adelino | 1:a74e42cf52b2 | 133 | actionNunchuk(); |
adelino | 1:a74e42cf52b2 | 134 | } |
adelino | 1:a74e42cf52b2 | 135 | |
adelino | 1:a74e42cf52b2 | 136 | } |
adelino | 1:a74e42cf52b2 | 137 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 138 | void Keyboard::draw(void) |
adelino | 1:a74e42cf52b2 | 139 | { |
adelino | 1:a74e42cf52b2 | 140 | myScreen->drawAllWidget(); |
adelino | 1:a74e42cf52b2 | 141 | |
adelino | 1:a74e42cf52b2 | 142 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 143 | |
adelino | 1:a74e42cf52b2 | 144 | myTicker.attach(this,&Keyboard::loop,mySampleTime); |
adelino | 1:a74e42cf52b2 | 145 | } |
adelino | 1:a74e42cf52b2 | 146 | //------------------------------------------------ |
adelino | 1:a74e42cf52b2 | 147 | //int Keyboard::getString(char* str) |
adelino | 1:a74e42cf52b2 | 148 | string Keyboard::getString(void) |
adelino | 1:a74e42cf52b2 | 149 | { |
adelino | 1:a74e42cf52b2 | 150 | myString=""; |
adelino | 1:a74e42cf52b2 | 151 | |
adelino | 1:a74e42cf52b2 | 152 | for(int i=0; i<myIndice; i++) { |
adelino | 1:a74e42cf52b2 | 153 | myString+=myBuffer[i]; |
adelino | 1:a74e42cf52b2 | 154 | } |
adelino | 1:a74e42cf52b2 | 155 | |
adelino | 1:a74e42cf52b2 | 156 | return myString; |
adelino | 1:a74e42cf52b2 | 157 | /* |
adelino | 1:a74e42cf52b2 | 158 | for(int i=0; i<myIndice; i++) { |
adelino | 1:a74e42cf52b2 | 159 | str[i]=myBuffer[i]; |
adelino | 1:a74e42cf52b2 | 160 | } |
adelino | 1:a74e42cf52b2 | 161 | |
adelino | 1:a74e42cf52b2 | 162 | return myIndice; |
adelino | 1:a74e42cf52b2 | 163 | */ |
adelino | 1:a74e42cf52b2 | 164 | } |
adelino | 1:a74e42cf52b2 | 165 | |
adelino | 1:a74e42cf52b2 | 166 | //------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 167 | void Keyboard::createScreen(void) |
adelino | 1:a74e42cf52b2 | 168 | { |
adelino | 1:a74e42cf52b2 | 169 | UINT16 w=22; |
adelino | 1:a74e42cf52b2 | 170 | UINT16 h=25; |
adelino | 1:a74e42cf52b2 | 171 | |
adelino | 1:a74e42cf52b2 | 172 | UINT16 sx=5; |
adelino | 1:a74e42cf52b2 | 173 | UINT16 sy=150; |
adelino | 1:a74e42cf52b2 | 174 | |
adelino | 1:a74e42cf52b2 | 175 | myPointeur=0; |
adelino | 1:a74e42cf52b2 | 176 | |
adelino | 1:a74e42cf52b2 | 177 | //--------------------- |
adelino | 1:a74e42cf52b2 | 178 | pLabelTitre= new Label(myScreen,5,5,myTitre,FONT_3,BLACK,YELLOW); |
adelino | 1:a74e42cf52b2 | 179 | //--------------------- |
adelino | 1:a74e42cf52b2 | 180 | pLabel= new Label(myScreen,5,40,"_",FONT_3,BLACK,YELLOW); |
adelino | 1:a74e42cf52b2 | 181 | |
adelino | 1:a74e42cf52b2 | 182 | // |
adelino | 1:a74e42cf52b2 | 183 | pBtn_0= new Button(myScreen,BTN_0_ID,sx,sy,"0",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 184 | myTabBtn[myPointeur]=pBtn_0; |
adelino | 1:a74e42cf52b2 | 185 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 186 | sx+=w; |
adelino | 1:a74e42cf52b2 | 187 | // |
adelino | 1:a74e42cf52b2 | 188 | pBtn_1= new Button(myScreen,BTN_1_ID,sx,sy,"1",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 189 | myTabBtn[myPointeur]=pBtn_1; |
adelino | 1:a74e42cf52b2 | 190 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 191 | sx+=w; |
adelino | 1:a74e42cf52b2 | 192 | |
adelino | 1:a74e42cf52b2 | 193 | pBtn_2= new Button(myScreen,BTN_2_ID,sx,sy,"2",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 194 | myTabBtn[myPointeur]=pBtn_2; |
adelino | 1:a74e42cf52b2 | 195 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 196 | sx+=w; |
adelino | 1:a74e42cf52b2 | 197 | |
adelino | 1:a74e42cf52b2 | 198 | pBtn_3= new Button(myScreen,BTN_3_ID,sx,sy,"3",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 199 | myTabBtn[myPointeur]=pBtn_3; |
adelino | 1:a74e42cf52b2 | 200 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 201 | sx+=w; |
adelino | 1:a74e42cf52b2 | 202 | |
adelino | 1:a74e42cf52b2 | 203 | pBtn_4= new Button(myScreen,BTN_4_ID,sx,sy,"4",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 204 | myTabBtn[myPointeur]=pBtn_4; |
adelino | 1:a74e42cf52b2 | 205 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 206 | sx+=w; |
adelino | 1:a74e42cf52b2 | 207 | |
adelino | 1:a74e42cf52b2 | 208 | pBtn_5= new Button(myScreen,BTN_5_ID,sx,sy,"5",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 209 | myTabBtn[myPointeur]=pBtn_5; |
adelino | 1:a74e42cf52b2 | 210 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 211 | sx+=w; |
adelino | 1:a74e42cf52b2 | 212 | |
adelino | 1:a74e42cf52b2 | 213 | pBtn_6= new Button(myScreen,BTN_6_ID,sx,sy,"6",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 214 | myTabBtn[myPointeur]=pBtn_6; |
adelino | 1:a74e42cf52b2 | 215 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 216 | sx+=w; |
adelino | 1:a74e42cf52b2 | 217 | |
adelino | 1:a74e42cf52b2 | 218 | pBtn_7= new Button(myScreen,BTN_7_ID,sx,sy,"7",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 219 | myTabBtn[myPointeur]=pBtn_7; |
adelino | 1:a74e42cf52b2 | 220 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 221 | sx+=w; |
adelino | 1:a74e42cf52b2 | 222 | |
adelino | 1:a74e42cf52b2 | 223 | pBtn_8= new Button(myScreen,BTN_8_ID,sx,sy,"8",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 224 | myTabBtn[myPointeur]=pBtn_8; |
adelino | 1:a74e42cf52b2 | 225 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 226 | sx+=w; |
adelino | 1:a74e42cf52b2 | 227 | |
adelino | 1:a74e42cf52b2 | 228 | pBtn_9= new Button(myScreen,BTN_9_ID,sx,sy,"9",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 229 | myTabBtn[myPointeur]=pBtn_9; |
adelino | 1:a74e42cf52b2 | 230 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 231 | |
adelino | 1:a74e42cf52b2 | 232 | //---- |
adelino | 1:a74e42cf52b2 | 233 | sx=5; |
adelino | 1:a74e42cf52b2 | 234 | sy+=h+5; |
adelino | 1:a74e42cf52b2 | 235 | pBtn_A= new Button(myScreen,BTN_A_ID,sx,sy,"A",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 236 | myTabBtn[myPointeur]=pBtn_A; |
adelino | 1:a74e42cf52b2 | 237 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 238 | sx+=w; |
adelino | 1:a74e42cf52b2 | 239 | |
adelino | 1:a74e42cf52b2 | 240 | pBtn_Z= new Button(myScreen,BTN_Z_ID,sx,sy,"Z",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 241 | myTabBtn[myPointeur]=pBtn_Z; |
adelino | 1:a74e42cf52b2 | 242 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 243 | sx+=w; |
adelino | 1:a74e42cf52b2 | 244 | |
adelino | 1:a74e42cf52b2 | 245 | pBtn_E= new Button(myScreen,BTN_E_ID,sx,sy,"E",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 246 | myTabBtn[myPointeur]=pBtn_E; |
adelino | 1:a74e42cf52b2 | 247 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 248 | sx+=w; |
adelino | 1:a74e42cf52b2 | 249 | |
adelino | 1:a74e42cf52b2 | 250 | pBtn_R= new Button(myScreen,BTN_R_ID,sx,sy,"R",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 251 | myTabBtn[myPointeur]=pBtn_R; |
adelino | 1:a74e42cf52b2 | 252 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 253 | sx+=w; |
adelino | 1:a74e42cf52b2 | 254 | |
adelino | 1:a74e42cf52b2 | 255 | pBtn_T= new Button(myScreen,BTN_T_ID,sx,sy,"T",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 256 | myTabBtn[myPointeur]=pBtn_T; |
adelino | 1:a74e42cf52b2 | 257 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 258 | sx+=w; |
adelino | 1:a74e42cf52b2 | 259 | |
adelino | 1:a74e42cf52b2 | 260 | pBtn_Y= new Button(myScreen,BTN_Y_ID,sx,sy,"Y",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 261 | myTabBtn[myPointeur]=pBtn_Y; |
adelino | 1:a74e42cf52b2 | 262 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 263 | sx+=w; |
adelino | 1:a74e42cf52b2 | 264 | |
adelino | 1:a74e42cf52b2 | 265 | pBtn_U= new Button(myScreen,BTN_U_ID,sx,sy,"U",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 266 | myTabBtn[myPointeur]=pBtn_U; |
adelino | 1:a74e42cf52b2 | 267 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 268 | sx+=w; |
adelino | 1:a74e42cf52b2 | 269 | |
adelino | 1:a74e42cf52b2 | 270 | pBtn_I= new Button(myScreen,BTN_I_ID,sx,sy,"I",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 271 | myTabBtn[myPointeur]=pBtn_I; |
adelino | 1:a74e42cf52b2 | 272 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 273 | sx+=w; |
adelino | 1:a74e42cf52b2 | 274 | |
adelino | 1:a74e42cf52b2 | 275 | pBtn_O= new Button(myScreen,BTN_O_ID,sx,sy,"O",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 276 | myTabBtn[myPointeur]=pBtn_O; |
adelino | 1:a74e42cf52b2 | 277 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 278 | sx+=w; |
adelino | 1:a74e42cf52b2 | 279 | |
adelino | 1:a74e42cf52b2 | 280 | pBtn_P= new Button(myScreen,BTN_P_ID,sx,sy,"P",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 281 | myTabBtn[myPointeur]=pBtn_P; |
adelino | 1:a74e42cf52b2 | 282 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 283 | //------------------------------ |
adelino | 1:a74e42cf52b2 | 284 | sx=5; |
adelino | 1:a74e42cf52b2 | 285 | sy+=h; |
adelino | 1:a74e42cf52b2 | 286 | |
adelino | 1:a74e42cf52b2 | 287 | sx+=w/2; |
adelino | 1:a74e42cf52b2 | 288 | pBtn_Q= new Button(myScreen,BTN_Q_ID,sx,sy,"Q",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 289 | myTabBtn[myPointeur]=pBtn_Q; |
adelino | 1:a74e42cf52b2 | 290 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 291 | sx+=w; |
adelino | 1:a74e42cf52b2 | 292 | |
adelino | 1:a74e42cf52b2 | 293 | pBtn_S= new Button(myScreen,BTN_S_ID,sx,sy,"S",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 294 | myTabBtn[myPointeur]=pBtn_S; |
adelino | 1:a74e42cf52b2 | 295 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 296 | sx+=w; |
adelino | 1:a74e42cf52b2 | 297 | |
adelino | 1:a74e42cf52b2 | 298 | pBtn_D= new Button(myScreen,BTN_D_ID,sx,sy,"D",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 299 | myTabBtn[myPointeur]=pBtn_D; |
adelino | 1:a74e42cf52b2 | 300 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 301 | sx+=w; |
adelino | 1:a74e42cf52b2 | 302 | |
adelino | 1:a74e42cf52b2 | 303 | pBtn_F= new Button(myScreen,BTN_F_ID,sx,sy,"F",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 304 | myTabBtn[myPointeur]=pBtn_F; |
adelino | 1:a74e42cf52b2 | 305 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 306 | sx+=w; |
adelino | 1:a74e42cf52b2 | 307 | |
adelino | 1:a74e42cf52b2 | 308 | pBtn_G= new Button(myScreen,BTN_G_ID,sx,sy,"G",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 309 | myTabBtn[myPointeur]=pBtn_G; |
adelino | 1:a74e42cf52b2 | 310 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 311 | sx+=w; |
adelino | 1:a74e42cf52b2 | 312 | |
adelino | 1:a74e42cf52b2 | 313 | pBtn_H= new Button(myScreen,BTN_H_ID,sx,sy,"H",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 314 | myTabBtn[myPointeur]=pBtn_H; |
adelino | 1:a74e42cf52b2 | 315 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 316 | sx+=w; |
adelino | 1:a74e42cf52b2 | 317 | |
adelino | 1:a74e42cf52b2 | 318 | pBtn_J= new Button(myScreen,BTN_J_ID,sx,sy,"J",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 319 | myTabBtn[myPointeur]=pBtn_J; |
adelino | 1:a74e42cf52b2 | 320 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 321 | sx+=w; |
adelino | 1:a74e42cf52b2 | 322 | |
adelino | 1:a74e42cf52b2 | 323 | pBtn_K= new Button(myScreen,BTN_K_ID,sx,sy,"K",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 324 | myTabBtn[myPointeur]=pBtn_K; |
adelino | 1:a74e42cf52b2 | 325 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 326 | sx+=w; |
adelino | 1:a74e42cf52b2 | 327 | |
adelino | 1:a74e42cf52b2 | 328 | pBtn_L= new Button(myScreen,BTN_L_ID,sx,sy,"L",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 329 | myTabBtn[myPointeur]=pBtn_L; |
adelino | 1:a74e42cf52b2 | 330 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 331 | //---------------- |
adelino | 1:a74e42cf52b2 | 332 | sx=5; |
adelino | 1:a74e42cf52b2 | 333 | sy+=h; |
adelino | 1:a74e42cf52b2 | 334 | |
adelino | 1:a74e42cf52b2 | 335 | sx+=w; |
adelino | 1:a74e42cf52b2 | 336 | |
adelino | 1:a74e42cf52b2 | 337 | pBtn_W= new Button(myScreen,BTN_W_ID,sx,sy,"W",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 338 | myTabBtn[myPointeur]=pBtn_W; |
adelino | 1:a74e42cf52b2 | 339 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 340 | sx+=w; |
adelino | 1:a74e42cf52b2 | 341 | |
adelino | 1:a74e42cf52b2 | 342 | pBtn_X= new Button(myScreen,BTN_X_ID,sx,sy,"X",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 343 | myTabBtn[myPointeur]=pBtn_X; |
adelino | 1:a74e42cf52b2 | 344 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 345 | sx+=w; |
adelino | 1:a74e42cf52b2 | 346 | |
adelino | 1:a74e42cf52b2 | 347 | pBtn_C= new Button(myScreen,BTN_C_ID,sx,sy,"C",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 348 | myTabBtn[myPointeur]=pBtn_C; |
adelino | 1:a74e42cf52b2 | 349 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 350 | sx+=w; |
adelino | 1:a74e42cf52b2 | 351 | |
adelino | 1:a74e42cf52b2 | 352 | pBtn_V= new Button(myScreen,BTN_V_ID,sx,sy,"V",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 353 | myTabBtn[myPointeur]=pBtn_V; |
adelino | 1:a74e42cf52b2 | 354 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 355 | sx+=w; |
adelino | 1:a74e42cf52b2 | 356 | |
adelino | 1:a74e42cf52b2 | 357 | pBtn_B= new Button(myScreen,BTN_B_ID,sx,sy,"B",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 358 | myTabBtn[myPointeur]=pBtn_B; |
adelino | 1:a74e42cf52b2 | 359 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 360 | sx+=w; |
adelino | 1:a74e42cf52b2 | 361 | |
adelino | 1:a74e42cf52b2 | 362 | pBtn_N= new Button(myScreen,BTN_N_ID,sx,sy,"N",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 363 | myTabBtn[myPointeur]=pBtn_N; |
adelino | 1:a74e42cf52b2 | 364 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 365 | sx+=w; |
adelino | 1:a74e42cf52b2 | 366 | |
adelino | 1:a74e42cf52b2 | 367 | pBtn_M= new Button(myScreen,BTN_M_ID,sx,sy,"M",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 368 | myTabBtn[myPointeur]=pBtn_M; |
adelino | 1:a74e42cf52b2 | 369 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 370 | sx+=w; |
adelino | 1:a74e42cf52b2 | 371 | |
adelino | 1:a74e42cf52b2 | 372 | pBtn_Point=new Button(myScreen,BTN_POINT_ID,sx,sy,".",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 373 | myTabBtn[myPointeur]=pBtn_Point; |
adelino | 1:a74e42cf52b2 | 374 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 375 | //------------------- |
adelino | 1:a74e42cf52b2 | 376 | sx=5; |
adelino | 1:a74e42cf52b2 | 377 | sy+=h+5; |
adelino | 1:a74e42cf52b2 | 378 | |
adelino | 1:a74e42cf52b2 | 379 | pBtn_Del=new Button(myScreen,BTN_DEL_ID,sx,sy,"Suppr",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 380 | myTabBtn[myPointeur]=pBtn_Del; |
adelino | 1:a74e42cf52b2 | 381 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 382 | sx+=3*w; |
adelino | 1:a74e42cf52b2 | 383 | |
adelino | 1:a74e42cf52b2 | 384 | pBtn_Esp= new Button(myScreen,BTN_ESP_ID,sx,sy," Espace ",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 385 | myTabBtn[myPointeur]=pBtn_Esp; |
adelino | 1:a74e42cf52b2 | 386 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 387 | sx+=4*w; |
adelino | 1:a74e42cf52b2 | 388 | |
adelino | 1:a74e42cf52b2 | 389 | pBtn_Ok=new Button(myScreen,BTN_OK_ID,sx,sy,"Enter",FONT_3,BLACK,GRAY,BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 390 | myTabBtn[myPointeur]=pBtn_Ok; |
adelino | 1:a74e42cf52b2 | 391 | |
adelino | 1:a74e42cf52b2 | 392 | // |
adelino | 1:a74e42cf52b2 | 393 | myPointeur=10; |
adelino | 1:a74e42cf52b2 | 394 | |
adelino | 1:a74e42cf52b2 | 395 | } |
adelino | 1:a74e42cf52b2 | 396 | //-------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 397 | void Keyboard::affiche(void) |
adelino | 1:a74e42cf52b2 | 398 | { |
adelino | 1:a74e42cf52b2 | 399 | UINT16 id=myMessage.objId; |
adelino | 1:a74e42cf52b2 | 400 | |
adelino | 1:a74e42cf52b2 | 401 | static Button* pb=NULL; |
adelino | 1:a74e42cf52b2 | 402 | |
adelino | 1:a74e42cf52b2 | 403 | if(myMessage.event==EVENT_PRESS && id>0) { |
adelino | 1:a74e42cf52b2 | 404 | if(myBuzzer!=NULL) |
adelino | 1:a74e42cf52b2 | 405 | myBuzzer->tone(myBeep); |
adelino | 1:a74e42cf52b2 | 406 | |
adelino | 1:a74e42cf52b2 | 407 | pb=(Button*)myScreen->getWidgetById(id); |
adelino | 1:a74e42cf52b2 | 408 | |
adelino | 1:a74e42cf52b2 | 409 | if(pb!=NULL) { |
adelino | 1:a74e42cf52b2 | 410 | pb->setState(BUTTON_STATE_RELEASED); |
adelino | 1:a74e42cf52b2 | 411 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 412 | pb->setState(BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 413 | } |
adelino | 1:a74e42cf52b2 | 414 | |
adelino | 1:a74e42cf52b2 | 415 | if(myIndice >50 || myIndice<0) |
adelino | 1:a74e42cf52b2 | 416 | myIndice=0; |
adelino | 1:a74e42cf52b2 | 417 | |
adelino | 1:a74e42cf52b2 | 418 | // |
adelino | 1:a74e42cf52b2 | 419 | afficheById(id); |
adelino | 1:a74e42cf52b2 | 420 | |
adelino | 1:a74e42cf52b2 | 421 | } |
adelino | 1:a74e42cf52b2 | 422 | } |
adelino | 1:a74e42cf52b2 | 423 | //-------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 424 | void Keyboard::afficheById(UINT16 id) |
adelino | 1:a74e42cf52b2 | 425 | { |
adelino | 1:a74e42cf52b2 | 426 | char str='_'; |
adelino | 1:a74e42cf52b2 | 427 | |
adelino | 1:a74e42cf52b2 | 428 | //les nombres |
adelino | 1:a74e42cf52b2 | 429 | if(id>=10 && id<20) { |
adelino | 1:a74e42cf52b2 | 430 | str='0'+(id-10); |
adelino | 1:a74e42cf52b2 | 431 | |
adelino | 1:a74e42cf52b2 | 432 | myBuffer[myIndice]=str; |
adelino | 1:a74e42cf52b2 | 433 | myIndice++; |
adelino | 1:a74e42cf52b2 | 434 | |
adelino | 1:a74e42cf52b2 | 435 | myBuffer[myIndice]='_'; |
adelino | 1:a74e42cf52b2 | 436 | //pLabel->setNewText(myBuffer,myIndice-1); |
adelino | 1:a74e42cf52b2 | 437 | pLabel->setNewText(myBuffer); |
adelino | 1:a74e42cf52b2 | 438 | return; |
adelino | 1:a74e42cf52b2 | 439 | |
adelino | 1:a74e42cf52b2 | 440 | } |
adelino | 1:a74e42cf52b2 | 441 | // |
adelino | 1:a74e42cf52b2 | 442 | //les lettres |
adelino | 1:a74e42cf52b2 | 443 | if(id>=100 && id<126) { |
adelino | 1:a74e42cf52b2 | 444 | str='A'+(id-100); |
adelino | 1:a74e42cf52b2 | 445 | |
adelino | 1:a74e42cf52b2 | 446 | myBuffer[myIndice]=str; |
adelino | 1:a74e42cf52b2 | 447 | myIndice++; |
adelino | 1:a74e42cf52b2 | 448 | |
adelino | 1:a74e42cf52b2 | 449 | myBuffer[myIndice]='_'; |
adelino | 1:a74e42cf52b2 | 450 | //pLabel->setNewText(myBuffer,myIndice-1); |
adelino | 1:a74e42cf52b2 | 451 | pLabel->setNewText(myBuffer); |
adelino | 1:a74e42cf52b2 | 452 | return; |
adelino | 1:a74e42cf52b2 | 453 | } |
adelino | 1:a74e42cf52b2 | 454 | // |
adelino | 1:a74e42cf52b2 | 455 | //le point |
adelino | 1:a74e42cf52b2 | 456 | if(id==BTN_POINT_ID) { |
adelino | 1:a74e42cf52b2 | 457 | str='.'; |
adelino | 1:a74e42cf52b2 | 458 | myBuffer[myIndice]=str; |
adelino | 1:a74e42cf52b2 | 459 | myIndice++; |
adelino | 1:a74e42cf52b2 | 460 | |
adelino | 1:a74e42cf52b2 | 461 | myBuffer[myIndice]='_'; |
adelino | 1:a74e42cf52b2 | 462 | // pLabel->setNewText(myBuffer,myIndice-1); |
adelino | 1:a74e42cf52b2 | 463 | pLabel->setNewText(myBuffer); |
adelino | 1:a74e42cf52b2 | 464 | |
adelino | 1:a74e42cf52b2 | 465 | return; |
adelino | 1:a74e42cf52b2 | 466 | } |
adelino | 1:a74e42cf52b2 | 467 | // |
adelino | 1:a74e42cf52b2 | 468 | //l'espace |
adelino | 1:a74e42cf52b2 | 469 | if(id==BTN_ESP_ID) { |
adelino | 1:a74e42cf52b2 | 470 | str=' '; |
adelino | 1:a74e42cf52b2 | 471 | |
adelino | 1:a74e42cf52b2 | 472 | myBuffer[myIndice]=str; |
adelino | 1:a74e42cf52b2 | 473 | myIndice++; |
adelino | 1:a74e42cf52b2 | 474 | |
adelino | 1:a74e42cf52b2 | 475 | myBuffer[myIndice]='_'; |
adelino | 1:a74e42cf52b2 | 476 | // pLabel->setNewText(myBuffer,myIndice-1); |
adelino | 1:a74e42cf52b2 | 477 | pLabel->setNewText(myBuffer); |
adelino | 1:a74e42cf52b2 | 478 | return; |
adelino | 1:a74e42cf52b2 | 479 | } |
adelino | 1:a74e42cf52b2 | 480 | // |
adelino | 1:a74e42cf52b2 | 481 | //enter |
adelino | 1:a74e42cf52b2 | 482 | if(id==BTN_OK_ID) { |
adelino | 1:a74e42cf52b2 | 483 | myEnter=true; |
adelino | 1:a74e42cf52b2 | 484 | return; |
adelino | 1:a74e42cf52b2 | 485 | } |
adelino | 1:a74e42cf52b2 | 486 | |
adelino | 1:a74e42cf52b2 | 487 | //Supp |
adelino | 1:a74e42cf52b2 | 488 | if(id==BTN_DEL_ID) { |
adelino | 1:a74e42cf52b2 | 489 | if(myIndice>=0) |
adelino | 1:a74e42cf52b2 | 490 | myIndice--; |
adelino | 1:a74e42cf52b2 | 491 | |
adelino | 1:a74e42cf52b2 | 492 | myBuffer[myIndice]='_'; |
adelino | 1:a74e42cf52b2 | 493 | //pLabel->setNewText(myBuffer,myIndice-1); |
adelino | 1:a74e42cf52b2 | 494 | pLabel->setNewText(myBuffer); |
adelino | 1:a74e42cf52b2 | 495 | } |
adelino | 1:a74e42cf52b2 | 496 | } |
adelino | 1:a74e42cf52b2 | 497 | |
adelino | 1:a74e42cf52b2 | 498 | //-------------------------------------------------- |
adelino | 1:a74e42cf52b2 | 499 | void Keyboard::actionNunchuk(void) |
adelino | 1:a74e42cf52b2 | 500 | { |
adelino | 1:a74e42cf52b2 | 501 | |
adelino | 1:a74e42cf52b2 | 502 | static bool isZ=false; |
adelino | 1:a74e42cf52b2 | 503 | static Button* pb=myTabBtn[10]; |
adelino | 1:a74e42cf52b2 | 504 | |
adelino | 1:a74e42cf52b2 | 505 | |
adelino | 1:a74e42cf52b2 | 506 | signed char posX=myNunchuk->getJoyX(); |
adelino | 1:a74e42cf52b2 | 507 | |
adelino | 1:a74e42cf52b2 | 508 | signed char valZ=myNunchuk->getBtnZ(); |
adelino | 1:a74e42cf52b2 | 509 | |
adelino | 1:a74e42cf52b2 | 510 | signed char valC=myNunchuk->getBtnC(); |
adelino | 1:a74e42cf52b2 | 511 | |
adelino | 1:a74e42cf52b2 | 512 | |
adelino | 1:a74e42cf52b2 | 513 | // |
adelino | 1:a74e42cf52b2 | 514 | switch(valC) { |
adelino | 1:a74e42cf52b2 | 515 | case 1: |
adelino | 1:a74e42cf52b2 | 516 | myEnter=true; |
adelino | 1:a74e42cf52b2 | 517 | return; |
adelino | 1:a74e42cf52b2 | 518 | // |
adelino | 1:a74e42cf52b2 | 519 | case 0: |
adelino | 1:a74e42cf52b2 | 520 | myEnter=false; |
adelino | 1:a74e42cf52b2 | 521 | break; |
adelino | 1:a74e42cf52b2 | 522 | } |
adelino | 1:a74e42cf52b2 | 523 | // |
adelino | 1:a74e42cf52b2 | 524 | //////////////////////// |
adelino | 1:a74e42cf52b2 | 525 | switch(valZ) { |
adelino | 1:a74e42cf52b2 | 526 | case 1: |
adelino | 1:a74e42cf52b2 | 527 | if(isZ==false) { |
adelino | 1:a74e42cf52b2 | 528 | if(myPointeur==39) { |
adelino | 1:a74e42cf52b2 | 529 | myEnter=true; |
adelino | 1:a74e42cf52b2 | 530 | return; |
adelino | 1:a74e42cf52b2 | 531 | } |
adelino | 1:a74e42cf52b2 | 532 | |
adelino | 1:a74e42cf52b2 | 533 | pb=myTabBtn[myPointeur]; |
adelino | 1:a74e42cf52b2 | 534 | |
adelino | 1:a74e42cf52b2 | 535 | UINT16 id=pb->getId(); |
adelino | 1:a74e42cf52b2 | 536 | |
adelino | 1:a74e42cf52b2 | 537 | afficheById(id); |
adelino | 1:a74e42cf52b2 | 538 | |
adelino | 1:a74e42cf52b2 | 539 | |
adelino | 1:a74e42cf52b2 | 540 | isZ=true; |
adelino | 1:a74e42cf52b2 | 541 | } |
adelino | 1:a74e42cf52b2 | 542 | break; |
adelino | 1:a74e42cf52b2 | 543 | |
adelino | 1:a74e42cf52b2 | 544 | // |
adelino | 1:a74e42cf52b2 | 545 | case 0: |
adelino | 1:a74e42cf52b2 | 546 | isZ=false; |
adelino | 1:a74e42cf52b2 | 547 | break; |
adelino | 1:a74e42cf52b2 | 548 | |
adelino | 1:a74e42cf52b2 | 549 | // |
adelino | 1:a74e42cf52b2 | 550 | default: |
adelino | 1:a74e42cf52b2 | 551 | break; |
adelino | 1:a74e42cf52b2 | 552 | } |
adelino | 1:a74e42cf52b2 | 553 | // |
adelino | 1:a74e42cf52b2 | 554 | |
adelino | 1:a74e42cf52b2 | 555 | |
adelino | 1:a74e42cf52b2 | 556 | // |
adelino | 1:a74e42cf52b2 | 557 | switch(posX) { |
adelino | 1:a74e42cf52b2 | 558 | case -1: |
adelino | 1:a74e42cf52b2 | 559 | myPointeur--; |
adelino | 1:a74e42cf52b2 | 560 | if(myPointeur<0) |
adelino | 1:a74e42cf52b2 | 561 | myPointeur=39; |
adelino | 1:a74e42cf52b2 | 562 | |
adelino | 1:a74e42cf52b2 | 563 | pb=myTabBtn[myPointeur]; |
adelino | 1:a74e42cf52b2 | 564 | |
adelino | 1:a74e42cf52b2 | 565 | if(pb!=NULL) { |
adelino | 1:a74e42cf52b2 | 566 | pb->setState(BUTTON_STATE_RELEASED); |
adelino | 1:a74e42cf52b2 | 567 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 568 | pb->setState(BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 569 | } |
adelino | 1:a74e42cf52b2 | 570 | |
adelino | 1:a74e42cf52b2 | 571 | break; |
adelino | 1:a74e42cf52b2 | 572 | |
adelino | 1:a74e42cf52b2 | 573 | // |
adelino | 1:a74e42cf52b2 | 574 | case 1: |
adelino | 1:a74e42cf52b2 | 575 | myPointeur++; |
adelino | 1:a74e42cf52b2 | 576 | |
adelino | 1:a74e42cf52b2 | 577 | if(myPointeur>39) |
adelino | 1:a74e42cf52b2 | 578 | myPointeur=0; |
adelino | 1:a74e42cf52b2 | 579 | |
adelino | 1:a74e42cf52b2 | 580 | pb=myTabBtn[myPointeur]; |
adelino | 1:a74e42cf52b2 | 581 | |
adelino | 1:a74e42cf52b2 | 582 | if(pb!=NULL) { |
adelino | 1:a74e42cf52b2 | 583 | pb->setState(BUTTON_STATE_RELEASED); |
adelino | 1:a74e42cf52b2 | 584 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 585 | pb->setState(BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 586 | } |
adelino | 1:a74e42cf52b2 | 587 | |
adelino | 1:a74e42cf52b2 | 588 | break; |
adelino | 1:a74e42cf52b2 | 589 | |
adelino | 1:a74e42cf52b2 | 590 | // |
adelino | 1:a74e42cf52b2 | 591 | case 0: |
adelino | 1:a74e42cf52b2 | 592 | |
adelino | 1:a74e42cf52b2 | 593 | if(pb!=NULL ) { |
adelino | 1:a74e42cf52b2 | 594 | pb->setState(BUTTON_STATE_RELEASED); |
adelino | 1:a74e42cf52b2 | 595 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 596 | pb->setState(BUTTON_STATE_PRESSED); |
adelino | 1:a74e42cf52b2 | 597 | wait(0.1); |
adelino | 1:a74e42cf52b2 | 598 | } |
adelino | 1:a74e42cf52b2 | 599 | break; |
adelino | 1:a74e42cf52b2 | 600 | |
adelino | 1:a74e42cf52b2 | 601 | // |
adelino | 1:a74e42cf52b2 | 602 | default: |
adelino | 1:a74e42cf52b2 | 603 | break; |
adelino | 1:a74e42cf52b2 | 604 | } |
adelino | 1:a74e42cf52b2 | 605 | |
adelino | 1:a74e42cf52b2 | 606 | // |
adelino | 1:a74e42cf52b2 | 607 | } |
adelino | 1:a74e42cf52b2 | 608 | //-------------------------------------------------- |