Rev 902 | Rev 1437 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 902 | Rev 954 | ||
---|---|---|---|
Line 21... | Line 21... | ||
21 | #include "main.h" |
21 | #include "main.h" |
22 | #include <avr/io.h> |
22 | #include <avr/io.h> |
23 | #include <avr/interrupt.h> |
23 | #include <avr/interrupt.h> |
24 | #include <util/delay.h> |
24 | #include <util/delay.h> |
25 | #include "usart1.h" |
25 | #include "usart1.h" |
- | 26 | #include "max7456_software_spi.h" |
|
Line 26... | Line 27... | ||
26 | 27 | ||
Line 27... | Line 28... | ||
27 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
28 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
28 | 29 | ||
Line 125... | Line 126... | ||
125 | if (usart_rx_ok == 0) { |
126 | if (usart_rx_ok == 0) { |
126 | // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
127 | // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
Line 127... | Line 128... | ||
127 | 128 | ||
128 | if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && |
129 | if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && |
129 | #if FCONLY |
130 | #if FCONLY |
130 | (c == 'V' || c == 'D' || c == 'Q')) { // version, debug, settings |
131 | (c == 'V' || c == 'D' || c == 'Q' || c == 'L')) { // version, debug, settings, LCD |
131 | #else |
132 | #else |
132 | (c == 'V' || c == 'O' || c == 'Q')) { // version, OSD, settings |
133 | (c == 'V' || c == 'O' || c == 'Q')) { // version, OSD, settings |
133 | #endif |
134 | #endif |
134 | usart_rx_ok = 1; |
135 | usart_rx_ok = 1; |
Line 215... | Line 216... | ||
215 | 216 | ||
216 | /** |
217 | /** |
217 | * Request Data through usart1 until a answer is received |
218 | * Request Data through usart1 until a answer is received |
218 | */ |
219 | */ |
219 | void usart1_request_blocking(unsigned char answer, const char* message) { |
220 | void usart1_request_blocking(unsigned char answer, const char* message) { |
220 | rxd_buffer[2] = answer + 1; |
221 | rxd_buffer[2] = answer + 1; // unvalidate answer |
221 | while (rxd_buffer[2] != answer) { |
222 | while (rxd_buffer[2] != answer || (rxd_buffer_locked != 1)) { |
222 | rxd_buffer_locked = 0; |
223 | rxd_buffer_locked = 0; |
223 | usart1_EnableTXD(); |
224 | usart1_EnableTXD(); |
224 | usart1_puts_pgm(message); |
225 | usart1_puts_pgm(message); |
225 | usart1_DisableTXD(); |
226 | usart1_DisableTXD(); |
226 | static uint8_t wait = 0; |
227 | static uint8_t wait = 0; |
227 | wait = 0; |
228 | wait = 0; |
228 | while (rxd_buffer_locked == 0 && wait < 150) { |
229 | while (rxd_buffer_locked == 0 && wait < 150) { |
229 | wait++; |
230 | wait++; |
230 | _delay_ms(50); |
231 | _delay_ms(50); |
- | 232 | } |
|
231 | } |
233 | _delay_ms(100); |
232 | } |
234 | } |
233 | Decode64(); |
235 | Decode64(); |
Line 234... | Line 236... | ||
234 | } |
236 | } |