Line 28... |
Line 28... |
28 |
/*Velikost GPS bufferu*/ |
28 |
/*Velikost GPS bufferu*/ |
29 |
#define GPS_BUFFER 500 |
29 |
#define GPS_BUFFER 500 |
30 |
|
30 |
|
31 |
extern NMEA_GPGGA GPGGA_informace; |
31 |
extern NMEA_GPGGA GPGGA_informace; |
32 |
Thread *tp_odpal = NULL; |
32 |
Thread *tp_odpal = NULL; |
- |
|
33 |
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"; |
33 |
|
34 |
|
34 |
/* |
35 |
/* |
35 |
* Konfigurace USART2 |
36 |
* Konfigurace USART2 |
36 |
*/ |
37 |
*/ |
37 |
|
38 |
|
Line 103... |
Line 104... |
103 |
odpal_povolen = 1; |
104 |
odpal_povolen = 1; |
104 |
odpal_pomocna++; |
105 |
odpal_pomocna++; |
105 |
} |
106 |
} |
106 |
else if (msg == 2) //Pokud se ma odpal zrusit v prubehu |
107 |
else if (msg == 2) //Pokud se ma odpal zrusit v prubehu |
107 |
{ |
108 |
{ |
- |
|
109 |
/* |
- |
|
110 |
* Pro jistotu se vypnou vsechny vystupy pri zruseni odpalu |
- |
|
111 |
*/ |
- |
|
112 |
palClearPad(GPIOB, GPIOB_PIN10); |
- |
|
113 |
palClearPad(GPIOB, GPIOB_PIN11); |
- |
|
114 |
palClearPad(GPIOB, GPIOB_PIN12); |
- |
|
115 |
palClearPad(GPIOB, GPIOB_PIN13); |
- |
|
116 |
|
108 |
odpal_povolen = 0; |
117 |
odpal_povolen = 0; |
109 |
odpal_pomocna = 0; |
118 |
odpal_pomocna = 0; |
110 |
stav = 0; |
119 |
stav = 0; |
111 |
sdWrite(&SD1, msg_zrusen, sizeof(msg_zrusen)/sizeof(uint8_t)); |
120 |
sdWrite(&SD1, msg_zrusen, sizeof(msg_zrusen)/sizeof(uint8_t)); |
112 |
} |
121 |
} |
Line 118... |
Line 127... |
118 |
{ |
127 |
{ |
119 |
odpal_pomocna = 2; // aby nepretelkla tato promenna |
128 |
odpal_pomocna = 2; // aby nepretelkla tato promenna |
120 |
switch (stav) |
129 |
switch (stav) |
121 |
{ |
130 |
{ |
122 |
case 0: |
131 |
case 0: |
- |
|
132 |
sdWrite(&SD1,"Vypousteni zahajeno!\r\n",sizeof("Vypousteni zahajeno!\r\n")/sizeof(char)); |
- |
|
133 |
sdWrite(&SD1,"(1/4)\tVentil otevren -> nafukovani balonu\r\n",sizeof("1/4)\tVentil otevren -> nafukovani balonu\r\n")/sizeof(char)); |
123 |
sdWrite(&SD1,"0\r\n",3); |
134 |
palSetPad(GPIOB, GPIOB_PIN10); |
124 |
gptStartOneShot(&GPTD2,1000); |
135 |
gptStartOneShot(&GPTD2,10000); |
125 |
break; |
136 |
break; |
126 |
case 1: |
137 |
case 1: |
- |
|
138 |
palClearPad(GPIOB, GPIOB_PIN10); |
127 |
sdWrite(&SD1,"1\r\n",3); |
139 |
palSetPad(GPIOB, GPIOB_PIN11); |
- |
|
140 |
sdWrite(&SD1,"(2/4)\tPrepalovani lisu...\r\n",sizeof("(2/4)\tPrepalovani lisu...\r\n")/sizeof(char)); |
128 |
gptStartOneShot(&GPTD2,1500); |
141 |
gptStartOneShot(&GPTD2,5000); |
129 |
break; |
142 |
break; |
130 |
case 2: |
143 |
case 2: |
- |
|
144 |
palClearPad(GPIOB, GPIOB_PIN11); |
131 |
sdWrite(&SD1,"2\r\n",3); |
145 |
palSetPad(GPIOB, GPIOB_PIN12); |
- |
|
146 |
sdWrite(&SD1,"(3/4)\tZatavovani balonu...\r\n",sizeof("(3/4)\tZatavovani balonu...\r\n")/sizeof(char)); |
132 |
gptStartOneShot(&GPTD2,2000); |
147 |
gptStartOneShot(&GPTD2,5000); |
133 |
break; |
148 |
break; |
134 |
case 3: |
149 |
case 3: |
- |
|
150 |
palClearPad(GPIOB, GPIOB_PIN12); |
135 |
sdWrite(&SD1,"3\r\n",3); |
151 |
palSetPad(GPIOB, GPIOB_PIN13); |
- |
|
152 |
sdWrite(&SD1,"(4/4)\tOtevirani vika...\r\n",sizeof("(4/4)\tOtevirani vika...\r\n")/sizeof(char)); |
136 |
gptStartOneShot(&GPTD2,3000); |
153 |
gptStartOneShot(&GPTD2,3000); |
137 |
break; |
154 |
break; |
138 |
case 4: |
155 |
case 4: |
139 |
sdWrite(&SD1,"4\r\n",3); |
156 |
palClearPad(GPIOB, GPIOB_PIN13); |
- |
|
157 |
sdWrite(&SD1,"Vypousteni ukonceno!\r\n",sizeof("Vypousteni ukonceno!\r\n")/sizeof(char)); |
- |
|
158 |
odpal_povolen = 0; |
140 |
gptStartOneShot(&GPTD2,5000); |
159 |
odpal_pomocna = 0; |
- |
|
160 |
stav = 0; |
141 |
break; |
161 |
break; |
142 |
default: |
162 |
default: |
143 |
sdWrite(&SD1,"konec\r\n",7); //posledni krok |
- |
|
144 |
odpal_povolen = 0; |
- |
|
145 |
odpal_pomocna = 0; |
- |
|
146 |
stav = 0; |
- |
|
147 |
break; |
163 |
break; |
148 |
} |
164 |
} |
149 |
stav++; |
165 |
stav++; |
150 |
} |
166 |
} |
151 |
} |
167 |
} |
Line 241... |
Line 257... |
241 |
chSchReadyI(tp_odpal); |
257 |
chSchReadyI(tp_odpal); |
242 |
tp_odpal = NULL; |
258 |
tp_odpal = NULL; |
243 |
} |
259 |
} |
244 |
chSysUnlockFromIsr(); |
260 |
chSysUnlockFromIsr(); |
245 |
} |
261 |
} |
- |
|
262 |
else if (strcmp(prikaz,"help") == 0) |
- |
|
263 |
{ |
- |
|
264 |
sdWrite(&SD1, uvitaci_zprava, sizeof(uvitaci_zprava)/sizeof(uint8_t)); |
- |
|
265 |
} |
246 |
else |
266 |
else |
247 |
{ |
267 |
{ |
248 |
uint8_t zp_neplatny[] = "Neplatny prikaz, spravny format *<prikaz>\n\r"; |
268 |
uint8_t zp_neplatny[] = "Neplatny prikaz, napiste <odpal> pro zahajeni sekvence\n\r ci <zrus> pro zruseni vypousteni\n\r"; |
249 |
sdWrite(&SD1,zp_neplatny,sizeof(zp_neplatny)/sizeof(uint8_t)); |
269 |
sdWrite(&SD1,zp_neplatny,sizeof(zp_neplatny)/sizeof(uint8_t)); |
250 |
palTogglePad(GPIOB, GPIOB_LED3); |
270 |
palTogglePad(GPIOB, GPIOB_LED3); |
251 |
} |
271 |
} |
252 |
} |
272 |
} |
253 |
|
273 |
|
Line 315... |
Line 335... |
315 |
/* |
335 |
/* |
316 |
* Vytvori vlakno pro odpalovaci sekvenci |
336 |
* Vytvori vlakno pro odpalovaci sekvenci |
317 |
*/ |
337 |
*/ |
318 |
chThdCreateStatic (waThread_odpal, sizeof(waThread_odpal), NORMALPRIO, Thread_odpal, NULL); |
338 |
chThdCreateStatic (waThread_odpal, sizeof(waThread_odpal), NORMALPRIO, Thread_odpal, NULL); |
319 |
|
339 |
|
- |
|
340 |
sdWrite(&SD1, uvitaci_zprava, sizeof(uvitaci_zprava)/sizeof(uint8_t)); |
320 |
/* |
341 |
/* |
321 |
* Normal main() thread activity, in this demo it does nothing except |
342 |
* Normal main() thread activity, in this demo it does nothing except |
322 |
* sleeping in a loop and check the button state, when the button is |
343 |
* sleeping in a loop and check the button state, when the button is |
323 |
* pressed the test procedure is launched with output on the serial |
344 |
* pressed the test procedure is launched with output on the serial |
324 |
* driver 1. |
345 |
* driver 1. |