Código para o menu no LCD

Dependencies:   mbed SDFileSystemSD TextLCD

Fork of TextLCD_HelloWorld2 by Wim Huiskamp

Committer:
claraluques
Date:
Fri May 11 14:23:06 2018 +0000
Revision:
12:64ed645e79ad
Parent:
11:6b7accf18fe2
Child:
13:1670c34440a5
Ao entrar no Jog as vezes clica duas vezes: fisico ou codigo?

Who changed what in which revision?

UserRevisionLine numberNew contents of line
claraluques 11:6b7accf18fe2 1 /*CÓDIGO PARA LCD MENU HELLEN - GRUPO T*/
claraluques 11:6b7accf18fe2 2
wim 0:a75049de1a82 3 #include "mbed.h"
wim 0:a75049de1a82 4 #include "TextLCD.h"
claraluques 11:6b7accf18fe2 5
claraluques 5:30f5ffe0ea0b 6 // Host PC Communication channels
claraluques 11:6b7accf18fe2 7 Serial pc(USBTX, USBRX); // tx, rx //não apagar
wim 4:a3e4bb2053cb 8
claraluques 5:30f5ffe0ea0b 9 //I2C Communication
claraluques 11:6b7accf18fe2 10 I2C i2c_lcd(D14,D15); // SDA, SCL //não apagar
claraluques 5:30f5ffe0ea0b 11
claraluques 5:30f5ffe0ea0b 12 //Botão push
claraluques 5:30f5ffe0ea0b 13 InterruptIn botao_enter(D13);
claraluques 5:30f5ffe0ea0b 14 InterruptIn botao_cima(D10);
claraluques 5:30f5ffe0ea0b 15 InterruptIn botao_baixo(D9);
claraluques 5:30f5ffe0ea0b 16
claraluques 5:30f5ffe0ea0b 17 //LCD instantiation
claraluques 11:6b7accf18fe2 18 TextLCD_I2C lcd(&i2c_lcd, 0x7E, TextLCD::LCD20x4); //não apagar
claraluques 5:30f5ffe0ea0b 19
claraluques 5:30f5ffe0ea0b 20 //variáveis int
claraluques 5:30f5ffe0ea0b 21 int bot_enter;
claraluques 5:30f5ffe0ea0b 22 int bot_cima;
claraluques 5:30f5ffe0ea0b 23 int bot_baixo;
claraluques 6:24cbbdf2dac2 24 int penter = 0;
claraluques 6:24cbbdf2dac2 25 int pcima = 0;
claraluques 6:24cbbdf2dac2 26 int pbaixo = 0;
claraluques 9:86b5a317fcd4 27 int cola;
claraluques 9:86b5a317fcd4 28 int exec;
claraluques 12:64ed645e79ad 29 int select = 0;
wim 0:a75049de1a82 30
claraluques 5:30f5ffe0ea0b 31 //variáveis float
claraluques 7:e2c1b0338286 32 float cx = 120.458;
claraluques 7:e2c1b0338286 33 float cy = 457.854;
claraluques 7:e2c1b0338286 34 float cz = 782.659;
claraluques 8:b80f50544ddd 35 float cx_salva;
claraluques 8:b80f50544ddd 36 float cy_salva;
claraluques 8:b80f50544ddd 37 float cz_salva;
claraluques 5:30f5ffe0ea0b 38
claraluques 5:30f5ffe0ea0b 39 //funções interrupt
claraluques 5:30f5ffe0ea0b 40 void botenter_press(void);
claraluques 5:30f5ffe0ea0b 41 void botenter_solto(void);
wim 0:a75049de1a82 42
claraluques 5:30f5ffe0ea0b 43 void botcima_press(void);
claraluques 5:30f5ffe0ea0b 44 void botcima_solto(void);
claraluques 5:30f5ffe0ea0b 45
claraluques 5:30f5ffe0ea0b 46 void botbaixo_press(void);
claraluques 5:30f5ffe0ea0b 47 void botbaixo_solto(void);
claraluques 5:30f5ffe0ea0b 48
claraluques 11:6b7accf18fe2 49 //criar classe "menu" (funções para as telas)
claraluques 5:30f5ffe0ea0b 50 class Menu{
claraluques 5:30f5ffe0ea0b 51 public:
claraluques 5:30f5ffe0ea0b 52 int linha;
claraluques 5:30f5ffe0ea0b 53 int func;
wim 4:a3e4bb2053cb 54
claraluques 6:24cbbdf2dac2 55 void movercursor(int min, int max, int col){ //função para mover cursor de seleção
claraluques 5:30f5ffe0ea0b 56 linha = min;
claraluques 7:e2c1b0338286 57 lcd.locate(col,min);
claraluques 7:e2c1b0338286 58 lcd.printf("%c", 0x3E);
claraluques 6:24cbbdf2dac2 59 while (bot_enter==penter){
claraluques 5:30f5ffe0ea0b 60 if (bot_cima==1){
claraluques 5:30f5ffe0ea0b 61 if (linha==min){
claraluques 6:24cbbdf2dac2 62 lcd.locate(col,min);
claraluques 6:24cbbdf2dac2 63 lcd.printf(" ");
claraluques 5:30f5ffe0ea0b 64 linha=max;
claraluques 6:24cbbdf2dac2 65 lcd.locate(col, linha);
claraluques 6:24cbbdf2dac2 66 lcd.printf("%c", 0x3E);
claraluques 5:30f5ffe0ea0b 67 }
claraluques 5:30f5ffe0ea0b 68 else {
claraluques 6:24cbbdf2dac2 69 lcd.locate(col,linha);
claraluques 6:24cbbdf2dac2 70 lcd.printf(" ");
claraluques 5:30f5ffe0ea0b 71 linha--;
claraluques 6:24cbbdf2dac2 72 lcd.locate(col, linha);
claraluques 6:24cbbdf2dac2 73 lcd.printf("%c", 0x3E);
claraluques 5:30f5ffe0ea0b 74 }
claraluques 6:24cbbdf2dac2 75 bot_cima = 0;
claraluques 5:30f5ffe0ea0b 76 }
claraluques 5:30f5ffe0ea0b 77 if (bot_baixo==1){
claraluques 5:30f5ffe0ea0b 78 if (linha==max){
claraluques 6:24cbbdf2dac2 79 lcd.locate(col,max);
claraluques 6:24cbbdf2dac2 80 lcd.printf(" ");
claraluques 5:30f5ffe0ea0b 81 linha=min;
claraluques 6:24cbbdf2dac2 82 lcd.locate(col, linha);
claraluques 6:24cbbdf2dac2 83 lcd.printf("%c", 0x3E);
claraluques 5:30f5ffe0ea0b 84 }
claraluques 5:30f5ffe0ea0b 85 else {
claraluques 6:24cbbdf2dac2 86 lcd.locate(col,linha);
claraluques 6:24cbbdf2dac2 87 lcd.printf(" ");
claraluques 5:30f5ffe0ea0b 88 linha++;
claraluques 6:24cbbdf2dac2 89 lcd.locate(col, linha);
claraluques 6:24cbbdf2dac2 90 lcd.printf("%c", 0x3E);
claraluques 5:30f5ffe0ea0b 91 }
claraluques 6:24cbbdf2dac2 92 bot_baixo = 0;
claraluques 5:30f5ffe0ea0b 93 }
claraluques 11:6b7accf18fe2 94 }
claraluques 5:30f5ffe0ea0b 95 }
claraluques 5:30f5ffe0ea0b 96
claraluques 5:30f5ffe0ea0b 97 //func 0
claraluques 5:30f5ffe0ea0b 98 void inicializar(){ //função tela incial de boas-vindas
claraluques 5:30f5ffe0ea0b 99 lcd.cls();
claraluques 8:b80f50544ddd 100 lcd.locate(4,0);
claraluques 8:b80f50544ddd 101 lcd.printf("Bem-vindo(a)");
claraluques 5:30f5ffe0ea0b 102 lcd.locate(0,1);
claraluques 8:b80f50544ddd 103 lcd.printf("Utilize seu EPI para operar a maquina.");
claraluques 9:86b5a317fcd4 104 wait(1);
claraluques 5:30f5ffe0ea0b 105 func = 1;
claraluques 5:30f5ffe0ea0b 106 }
claraluques 5:30f5ffe0ea0b 107
claraluques 5:30f5ffe0ea0b 108 //func 1
claraluques 5:30f5ffe0ea0b 109 void menuprincipal(){ //função menu principal
claraluques 9:86b5a317fcd4 110 bot_enter = 0;
claraluques 5:30f5ffe0ea0b 111 lcd.cls();
claraluques 5:30f5ffe0ea0b 112 lcd.locate(1,0);
claraluques 5:30f5ffe0ea0b 113 lcd.printf("Modo JOG");
claraluques 5:30f5ffe0ea0b 114 lcd.locate(1,1);
claraluques 5:30f5ffe0ea0b 115 lcd.printf("Modo Automatico");
claraluques 5:30f5ffe0ea0b 116 lcd.locate(1,2);
claraluques 5:30f5ffe0ea0b 117 lcd.printf("Config");
claraluques 9:86b5a317fcd4 118 lcd.locate(1,3);
claraluques 9:86b5a317fcd4 119 lcd.printf("Zerar");
claraluques 9:86b5a317fcd4 120 movercursor(0,3,0);
claraluques 6:24cbbdf2dac2 121 if (bot_enter!=penter){
claraluques 5:30f5ffe0ea0b 122 if (linha==0){
claraluques 5:30f5ffe0ea0b 123 func = 2;
claraluques 5:30f5ffe0ea0b 124 }
claraluques 5:30f5ffe0ea0b 125 else if (linha==1) {
claraluques 5:30f5ffe0ea0b 126 func = 3;
claraluques 5:30f5ffe0ea0b 127 }
claraluques 5:30f5ffe0ea0b 128 else if (linha==2) {
claraluques 5:30f5ffe0ea0b 129 func = 4;
claraluques 5:30f5ffe0ea0b 130 }
claraluques 9:86b5a317fcd4 131 else if (linha==3) {
claraluques 9:86b5a317fcd4 132 func = 8;
claraluques 9:86b5a317fcd4 133 }
claraluques 5:30f5ffe0ea0b 134 }
claraluques 5:30f5ffe0ea0b 135 }
claraluques 6:24cbbdf2dac2 136
claraluques 6:24cbbdf2dac2 137 //func 2
claraluques 6:24cbbdf2dac2 138 void jog(){ //função tela jog
claraluques 9:86b5a317fcd4 139 bot_enter = 0;
claraluques 6:24cbbdf2dac2 140 lcd.cls();
claraluques 7:e2c1b0338286 141 lcd.locate(4,0);
claraluques 7:e2c1b0338286 142 lcd.printf("Coordenadas:");
claraluques 7:e2c1b0338286 143 lcd.locate(0,1);
claraluques 12:64ed645e79ad 144 lcd.printf("X: ");
claraluques 7:e2c1b0338286 145 lcd.locate(0,2);
claraluques 12:64ed645e79ad 146 lcd.printf("Y: ");
claraluques 7:e2c1b0338286 147 lcd.locate(0,3);
claraluques 12:64ed645e79ad 148 lcd.printf("Z: ");
claraluques 6:24cbbdf2dac2 149 lcd.locate(11,1);
claraluques 6:24cbbdf2dac2 150 lcd.printf("Salvar");
claraluques 6:24cbbdf2dac2 151 lcd.locate(11,2);
claraluques 6:24cbbdf2dac2 152 lcd.printf("Concluir");
claraluques 6:24cbbdf2dac2 153 lcd.locate(11,3);
claraluques 6:24cbbdf2dac2 154 lcd.printf("Cancelar");
claraluques 7:e2c1b0338286 155 movercursor(1,3,10);
claraluques 6:24cbbdf2dac2 156 if (bot_enter!=penter){
claraluques 6:24cbbdf2dac2 157 if (linha==1){
claraluques 6:24cbbdf2dac2 158 func = 5;
claraluques 8:b80f50544ddd 159 cx_salva = cx;
claraluques 8:b80f50544ddd 160 cy_salva = cy;
claraluques 8:b80f50544ddd 161 cz_salva = cz;
claraluques 6:24cbbdf2dac2 162 }
claraluques 6:24cbbdf2dac2 163 else if (linha==2) {
claraluques 8:b80f50544ddd 164 func = 7;
claraluques 6:24cbbdf2dac2 165 }
claraluques 6:24cbbdf2dac2 166 else if (linha==3) {
claraluques 8:b80f50544ddd 167 func = 1;
claraluques 6:24cbbdf2dac2 168 }
claraluques 6:24cbbdf2dac2 169 }
claraluques 6:24cbbdf2dac2 170 }
claraluques 6:24cbbdf2dac2 171
claraluques 9:86b5a317fcd4 172 //func 3
claraluques 12:64ed645e79ad 173 void automatico(){ //tela modo automatico
claraluques 12:64ed645e79ad 174 lcd.cls();
claraluques 12:64ed645e79ad 175 bot_enter = 0;
claraluques 12:64ed645e79ad 176 lcd.printf("Modo automatico");
claraluques 12:64ed645e79ad 177 lcd.locate(7,2);
claraluques 12:64ed645e79ad 178 lcd.printf("OK");
claraluques 12:64ed645e79ad 179 lcd.locate(7,3);
claraluques 12:64ed645e79ad 180 lcd.printf("Voltar");
claraluques 12:64ed645e79ad 181 movercursor(2,3,6);
claraluques 12:64ed645e79ad 182 if (bot_enter!=penter) {
claraluques 12:64ed645e79ad 183 if (linha==2){
claraluques 12:64ed645e79ad 184 func = 12;
claraluques 12:64ed645e79ad 185 }
claraluques 12:64ed645e79ad 186 else if (linha==3){
claraluques 12:64ed645e79ad 187 func = 1;
claraluques 12:64ed645e79ad 188 }
claraluques 12:64ed645e79ad 189 }
claraluques 12:64ed645e79ad 190 }
claraluques 9:86b5a317fcd4 191
claraluques 9:86b5a317fcd4 192 //func 4
claraluques 9:86b5a317fcd4 193
claraluques 8:b80f50544ddd 194 //func 5
claraluques 9:86b5a317fcd4 195 void telasalvamento(){ //função para quando salvar um ponto
claraluques 8:b80f50544ddd 196 lcd.cls();
claraluques 8:b80f50544ddd 197 lcd.locate(0,0);
claraluques 8:b80f50544ddd 198 lcd.printf("Voce salvou o ponto:");
claraluques 9:86b5a317fcd4 199 lcd.locate(5,1);
claraluques 9:86b5a317fcd4 200 lcd.printf("X: %.3f", cx_salva);
claraluques 9:86b5a317fcd4 201 lcd.locate(5,2);
claraluques 9:86b5a317fcd4 202 lcd.printf("Y: %.3f", cy_salva);
claraluques 9:86b5a317fcd4 203 lcd.locate(5,3);
claraluques 9:86b5a317fcd4 204 lcd.printf("Z: %.3f", cz_salva);
claraluques 9:86b5a317fcd4 205 wait(1);
claraluques 8:b80f50544ddd 206 func = 6;
claraluques 8:b80f50544ddd 207 }
claraluques 8:b80f50544ddd 208
claraluques 9:86b5a317fcd4 209 //func 6
claraluques 9:86b5a317fcd4 210 void telacola(){ //tela para escolher o tipo de sequencia da cola
claraluques 9:86b5a317fcd4 211 lcd.cls();
claraluques 9:86b5a317fcd4 212 bot_enter = 0;
claraluques 9:86b5a317fcd4 213 lcd.printf("P/ o proximo ponto:");
claraluques 9:86b5a317fcd4 214 lcd.locate(3,1);
claraluques 9:86b5a317fcd4 215 lcd.printf("Sem cola");
claraluques 9:86b5a317fcd4 216 lcd.locate(3,2);
claraluques 9:86b5a317fcd4 217 lcd.printf("Cola no ponto");
claraluques 9:86b5a317fcd4 218 lcd.locate(3,3);
claraluques 9:86b5a317fcd4 219 lcd.printf("Cola continua");
claraluques 9:86b5a317fcd4 220 movercursor(1,3,2);
claraluques 9:86b5a317fcd4 221 if (bot_enter!=penter){
claraluques 9:86b5a317fcd4 222 if (linha==1){
claraluques 9:86b5a317fcd4 223 cola = 0;
claraluques 9:86b5a317fcd4 224 func = 2;
claraluques 9:86b5a317fcd4 225 }
claraluques 9:86b5a317fcd4 226 else if (linha==2) {
claraluques 9:86b5a317fcd4 227 cola = 1;
claraluques 9:86b5a317fcd4 228 func = 2;
claraluques 9:86b5a317fcd4 229 }
claraluques 9:86b5a317fcd4 230 else if (linha==3) {
claraluques 9:86b5a317fcd4 231 cola = 2;
claraluques 9:86b5a317fcd4 232 func = 2;
claraluques 9:86b5a317fcd4 233 }
claraluques 9:86b5a317fcd4 234 }
claraluques 9:86b5a317fcd4 235 }
claraluques 9:86b5a317fcd4 236
claraluques 9:86b5a317fcd4 237 //func 7
claraluques 9:86b5a317fcd4 238 void executarprograma() { //tela para selecionar se deseja executar o programa
claraluques 9:86b5a317fcd4 239 lcd.cls();
claraluques 9:86b5a317fcd4 240 bot_enter = 0;
claraluques 9:86b5a317fcd4 241 lcd.locate(2,0);
claraluques 9:86b5a317fcd4 242 lcd.printf("VOCE CONCLUIU SEU");
claraluques 9:86b5a317fcd4 243 lcd.locate(5,1);
claraluques 9:86b5a317fcd4 244 lcd.printf("PROGRAMA.");
claraluques 9:86b5a317fcd4 245 lcd.locate(0,2);
claraluques 9:86b5a317fcd4 246 lcd.printf("Deseja");
claraluques 9:86b5a317fcd4 247 lcd.locate(0,3);
claraluques 9:86b5a317fcd4 248 lcd.printf("executa-lo?");
claraluques 9:86b5a317fcd4 249 lcd.locate(14,2);
claraluques 9:86b5a317fcd4 250 lcd.printf("Sim");
claraluques 9:86b5a317fcd4 251 lcd.locate(14,3);
claraluques 9:86b5a317fcd4 252 lcd.printf("Voltar");
claraluques 9:86b5a317fcd4 253 movercursor(2,3,13);
claraluques 9:86b5a317fcd4 254 if (bot_enter!=penter) {
claraluques 9:86b5a317fcd4 255 if (linha==2){
claraluques 9:86b5a317fcd4 256 exec = 1;
claraluques 9:86b5a317fcd4 257 func = 9;
claraluques 9:86b5a317fcd4 258 }
claraluques 9:86b5a317fcd4 259 else if (linha==3){
claraluques 9:86b5a317fcd4 260 exec = 0;
claraluques 9:86b5a317fcd4 261 func = 2;
claraluques 9:86b5a317fcd4 262 }
claraluques 9:86b5a317fcd4 263 }
claraluques 9:86b5a317fcd4 264 }
claraluques 9:86b5a317fcd4 265
claraluques 9:86b5a317fcd4 266 //func 8
claraluques 9:86b5a317fcd4 267 void telazerar(){ //tela para zerar a máquina
claraluques 9:86b5a317fcd4 268 lcd.cls();
claraluques 9:86b5a317fcd4 269 bot_enter = 0;
claraluques 9:86b5a317fcd4 270 lcd.locate(2,0);
claraluques 9:86b5a317fcd4 271 lcd.printf("Pressione OK para zerar as coordenadas");
claraluques 9:86b5a317fcd4 272 lcd.locate(7,2);
claraluques 9:86b5a317fcd4 273 lcd.printf("OK");
claraluques 9:86b5a317fcd4 274 lcd.locate(7,3);
claraluques 9:86b5a317fcd4 275 lcd.printf("Voltar");
claraluques 9:86b5a317fcd4 276 movercursor(2,3,6);
claraluques 9:86b5a317fcd4 277 if (bot_enter!=penter) {
claraluques 9:86b5a317fcd4 278 if (linha==2){
claraluques 9:86b5a317fcd4 279 cx = 0;
claraluques 9:86b5a317fcd4 280 cy = 0;
claraluques 9:86b5a317fcd4 281 cz = 0;
claraluques 9:86b5a317fcd4 282 func = 10;
claraluques 9:86b5a317fcd4 283 }
claraluques 9:86b5a317fcd4 284 else if (linha==3){
claraluques 9:86b5a317fcd4 285 func = 1;
claraluques 9:86b5a317fcd4 286 }
claraluques 9:86b5a317fcd4 287 }
claraluques 9:86b5a317fcd4 288 }
claraluques 9:86b5a317fcd4 289
claraluques 9:86b5a317fcd4 290 //func 9
claraluques 9:86b5a317fcd4 291 void executando(){ //tela de executando
claraluques 9:86b5a317fcd4 292 lcd.cls();
claraluques 9:86b5a317fcd4 293 lcd.locate(4,1);
claraluques 9:86b5a317fcd4 294 lcd.printf("Executando");
claraluques 9:86b5a317fcd4 295 int contador = 0;
claraluques 9:86b5a317fcd4 296 while (exec==1){
claraluques 9:86b5a317fcd4 297 lcd.locate(14,1);
claraluques 9:86b5a317fcd4 298 lcd.printf(". ");
claraluques 9:86b5a317fcd4 299 wait(0.5);
claraluques 9:86b5a317fcd4 300 lcd.locate(14,1);
claraluques 9:86b5a317fcd4 301 lcd.printf(".. ");
claraluques 9:86b5a317fcd4 302 wait(0.5);
claraluques 9:86b5a317fcd4 303 lcd.locate(14,1);
claraluques 9:86b5a317fcd4 304 lcd.printf("...");
claraluques 9:86b5a317fcd4 305 wait(0.5);
claraluques 9:86b5a317fcd4 306 lcd.locate(14,1);
claraluques 9:86b5a317fcd4 307 lcd.printf(" ");
claraluques 9:86b5a317fcd4 308 wait(0.5);
claraluques 9:86b5a317fcd4 309 contador++;
claraluques 9:86b5a317fcd4 310 if (contador>=2){
claraluques 9:86b5a317fcd4 311 exec = 0;
claraluques 9:86b5a317fcd4 312 func = 11;
claraluques 9:86b5a317fcd4 313 }
claraluques 9:86b5a317fcd4 314 }
claraluques 9:86b5a317fcd4 315 }
claraluques 9:86b5a317fcd4 316
claraluques 9:86b5a317fcd4 317 //func 10
claraluques 9:86b5a317fcd4 318 void zerado() { //tela avisando que a máquina foi zerada
claraluques 9:86b5a317fcd4 319 lcd.cls();
claraluques 9:86b5a317fcd4 320 lcd.locate(5,1);
claraluques 9:86b5a317fcd4 321 lcd.printf("Voce zerou");
claraluques 9:86b5a317fcd4 322 lcd.locate(5,2);
claraluques 9:86b5a317fcd4 323 lcd.printf("a maquina!");
claraluques 9:86b5a317fcd4 324 wait(1);
claraluques 9:86b5a317fcd4 325 func = 8;
claraluques 9:86b5a317fcd4 326 }
claraluques 9:86b5a317fcd4 327
claraluques 9:86b5a317fcd4 328 //func 11
claraluques 9:86b5a317fcd4 329 void finalizado() {
claraluques 9:86b5a317fcd4 330 lcd.cls();
claraluques 9:86b5a317fcd4 331 lcd.locate(6,1);
claraluques 9:86b5a317fcd4 332 lcd.printf("PROGRAMA");
claraluques 9:86b5a317fcd4 333 lcd.locate(5,2);
claraluques 9:86b5a317fcd4 334 lcd.printf("FINALIZADO");
claraluques 9:86b5a317fcd4 335 wait(1);
claraluques 9:86b5a317fcd4 336 func = 1;
claraluques 9:86b5a317fcd4 337 }
claraluques 9:86b5a317fcd4 338
claraluques 9:86b5a317fcd4 339 Menu(); //não apagar
claraluques 5:30f5ffe0ea0b 340 };
wim 1:ef419b21167d 341
claraluques 9:86b5a317fcd4 342 Menu::Menu(){ //não apagar
claraluques 12:64ed645e79ad 343 func = 0;
claraluques 9:86b5a317fcd4 344 }
wim 3:f238b4f7874f 345
claraluques 5:30f5ffe0ea0b 346 Menu menu;
wim 3:f238b4f7874f 347
claraluques 5:30f5ffe0ea0b 348 int main () {
claraluques 5:30f5ffe0ea0b 349 lcd.setBacklight(TextLCD::LightOn); //liga backlight
claraluques 9:86b5a317fcd4 350 lcd.setCursor(TextLCD::CurOff_BlkOff); //define tipo de cursor
claraluques 5:30f5ffe0ea0b 351
claraluques 9:86b5a317fcd4 352 botao_enter.rise(&botenter_press); //chama função botao enter
claraluques 9:86b5a317fcd4 353 botao_cima.rise(&botcima_press); //chama função botao para cima
claraluques 9:86b5a317fcd4 354 botao_baixo.rise(&botbaixo_press); //chama função bota para baixo
claraluques 6:24cbbdf2dac2 355
claraluques 5:30f5ffe0ea0b 356 while(1){
claraluques 9:86b5a317fcd4 357 switch(menu.func){ //faz com que as telas sejam iniciadas
claraluques 5:30f5ffe0ea0b 358 case 0: menu.inicializar(); break;
claraluques 5:30f5ffe0ea0b 359 case 1: menu.menuprincipal(); break;
claraluques 6:24cbbdf2dac2 360 case 2: menu.jog(); break;
claraluques 12:64ed645e79ad 361 case 3: menu.automatico(); break;
claraluques 9:86b5a317fcd4 362 //case 4: menu.config(); break;
claraluques 9:86b5a317fcd4 363 case 5: menu.telasalvamento(); break;
claraluques 9:86b5a317fcd4 364 case 6: menu.telacola(); break;
claraluques 9:86b5a317fcd4 365 case 7: menu.executarprograma(); break;
claraluques 9:86b5a317fcd4 366 case 8: menu.telazerar(); break;
claraluques 9:86b5a317fcd4 367 case 9: menu.executando(); break;
claraluques 9:86b5a317fcd4 368 case 10: menu.zerado(); break;
claraluques 9:86b5a317fcd4 369 case 11: menu.finalizado(); break;
claraluques 9:86b5a317fcd4 370
claraluques 5:30f5ffe0ea0b 371 }
claraluques 5:30f5ffe0ea0b 372 }
claraluques 11:6b7accf18fe2 373 }
claraluques 5:30f5ffe0ea0b 374
claraluques 11:6b7accf18fe2 375 //função interrupt botão enter
claraluques 11:6b7accf18fe2 376 void botenter_press(void){
claraluques 11:6b7accf18fe2 377 penter = bot_enter;
claraluques 11:6b7accf18fe2 378 bot_enter = !bot_enter;
claraluques 11:6b7accf18fe2 379 printf("enter high");
claraluques 11:6b7accf18fe2 380 }
claraluques 9:86b5a317fcd4 381
claraluques 11:6b7accf18fe2 382 //função interrupt botão cima
claraluques 11:6b7accf18fe2 383 void botcima_press(void){
claraluques 11:6b7accf18fe2 384 pcima = bot_cima;
claraluques 11:6b7accf18fe2 385 bot_cima = !bot_cima;
claraluques 11:6b7accf18fe2 386 printf("cima high");
claraluques 11:6b7accf18fe2 387 }
wim 0:a75049de1a82 388
claraluques 5:30f5ffe0ea0b 389 //função interrupt botão baixo
claraluques 11:6b7accf18fe2 390 void botbaixo_press(void){
claraluques 11:6b7accf18fe2 391 pbaixo = bot_baixo;
claraluques 11:6b7accf18fe2 392 bot_baixo = !bot_baixo;
claraluques 11:6b7accf18fe2 393 printf("baixo high");
claraluques 11:6b7accf18fe2 394 }