30,6 → 30,7 |
|
extern NMEA_GPGGA GPGGA_informace; |
Thread *tp_odpal = NULL; |
uint8_t uvitaci_zprava[] = "\r\n\r\n* * * * * * * * * * * * * * * * * * * * * * * * * *\r\nVita vas Automaticky Vypoustec Meteobalonu 1.1\r\nZapojeni vyvodu:\r\n\tGPIOB10 - ventil\r\n\tGPIOB11 - lis\r\n\tGPIOB12 - zataveni balonu\r\n\tGPIOB13 - otevreni krytu\r\nPrikazy:\r\n\t<odpal> zahajeni sekvence vypousteni\n\r\t<zrus> zruseni vypousteni\n\r\t<help> napoveda\r\n* * * * * * * * * * * * * * * * * * * * * * * * * *\r\n\r\n"; |
|
/* |
* Konfigurace USART2 |
105,6 → 106,14 |
} |
else if (msg == 2) //Pokud se ma odpal zrusit v prubehu |
{ |
/* |
* Pro jistotu se vypnou vsechny vystupy pri zruseni odpalu |
*/ |
palClearPad(GPIOB, GPIOB_PIN10); |
palClearPad(GPIOB, GPIOB_PIN11); |
palClearPad(GPIOB, GPIOB_PIN12); |
palClearPad(GPIOB, GPIOB_PIN13); |
|
odpal_povolen = 0; |
odpal_pomocna = 0; |
stav = 0; |
120,30 → 129,37 |
switch (stav) |
{ |
case 0: |
sdWrite(&SD1,"0\r\n",3); |
gptStartOneShot(&GPTD2,1000); |
sdWrite(&SD1,"Vypousteni zahajeno!\r\n",sizeof("Vypousteni zahajeno!\r\n")/sizeof(char)); |
sdWrite(&SD1,"(1/4)\tVentil otevren -> nafukovani balonu\r\n",sizeof("1/4)\tVentil otevren -> nafukovani balonu\r\n")/sizeof(char)); |
palSetPad(GPIOB, GPIOB_PIN10); |
gptStartOneShot(&GPTD2,10000); |
break; |
case 1: |
sdWrite(&SD1,"1\r\n",3); |
gptStartOneShot(&GPTD2,1500); |
palClearPad(GPIOB, GPIOB_PIN10); |
palSetPad(GPIOB, GPIOB_PIN11); |
sdWrite(&SD1,"(2/4)\tPrepalovani lisu...\r\n",sizeof("(2/4)\tPrepalovani lisu...\r\n")/sizeof(char)); |
gptStartOneShot(&GPTD2,5000); |
break; |
case 2: |
sdWrite(&SD1,"2\r\n",3); |
gptStartOneShot(&GPTD2,2000); |
palClearPad(GPIOB, GPIOB_PIN11); |
palSetPad(GPIOB, GPIOB_PIN12); |
sdWrite(&SD1,"(3/4)\tZatavovani balonu...\r\n",sizeof("(3/4)\tZatavovani balonu...\r\n")/sizeof(char)); |
gptStartOneShot(&GPTD2,5000); |
break; |
case 3: |
sdWrite(&SD1,"3\r\n",3); |
case 3: |
palClearPad(GPIOB, GPIOB_PIN12); |
palSetPad(GPIOB, GPIOB_PIN13); |
sdWrite(&SD1,"(4/4)\tOtevirani vika...\r\n",sizeof("(4/4)\tOtevirani vika...\r\n")/sizeof(char)); |
gptStartOneShot(&GPTD2,3000); |
break; |
case 4: |
sdWrite(&SD1,"4\r\n",3); |
gptStartOneShot(&GPTD2,5000); |
palClearPad(GPIOB, GPIOB_PIN13); |
sdWrite(&SD1,"Vypousteni ukonceno!\r\n",sizeof("Vypousteni ukonceno!\r\n")/sizeof(char)); |
odpal_povolen = 0; |
odpal_pomocna = 0; |
stav = 0; |
break; |
default: |
sdWrite(&SD1,"konec\r\n",7); //posledni krok |
odpal_povolen = 0; |
odpal_pomocna = 0; |
stav = 0; |
break; |
} |
stav++; |
243,9 → 259,13 |
} |
chSysUnlockFromIsr(); |
} |
else if (strcmp(prikaz,"help") == 0) |
{ |
sdWrite(&SD1, uvitaci_zprava, sizeof(uvitaci_zprava)/sizeof(uint8_t)); |
} |
else |
{ |
uint8_t zp_neplatny[] = "Neplatny prikaz, spravny format *<prikaz>\n\r"; |
uint8_t zp_neplatny[] = "Neplatny prikaz, napiste <odpal> pro zahajeni sekvence\n\r ci <zrus> pro zruseni vypousteni\n\r"; |
sdWrite(&SD1,zp_neplatny,sizeof(zp_neplatny)/sizeof(uint8_t)); |
palTogglePad(GPIOB, GPIOB_LED3); |
} |
317,6 → 337,7 |
*/ |
chThdCreateStatic (waThread_odpal, sizeof(waThread_odpal), NORMALPRIO, Thread_odpal, NULL); |
|
sdWrite(&SD1, uvitaci_zprava, sizeof(uvitaci_zprava)/sizeof(uint8_t)); |
/* |
* Normal main() thread activity, in this demo it does nothing except |
* sleeping in a loop and check the button state, when the button is |