Rev 772 | Rev 800 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 772 | Rev 783 | ||
---|---|---|---|
Line 26... | Line 26... | ||
26 | 26 | ||
Line 27... | Line 27... | ||
27 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
27 | #if !(ALLCHARSDEBUG|(WRITECHARS != -1)) |
28 | 28 | ||
29 | volatile uint8_t rxd_buffer_locked = 0; |
29 | volatile uint8_t rxd_buffer_locked = 0; |
30 | volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
30 | volatile uint8_t rxd_buffer[RXD_BUFFER_LEN]; |
31 | volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
31 | //volatile uint8_t txd_buffer[TXD_BUFFER_LEN]; |
32 | volatile uint8_t ReceivedBytes = 0; |
32 | volatile uint8_t ReceivedBytes = 0; |
Line 33... | Line 33... | ||
33 | volatile uint8_t *pRxData = 0; |
33 | volatile uint8_t *pRxData = 0; |
Line 125... | Line 125... | ||
125 | if (usart_rx_ok == 0) { |
125 | if (usart_rx_ok == 0) { |
126 | // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
126 | // if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && (c == 'D' || c == 'V' || c == 'O')) { |
Line 127... | Line 127... | ||
127 | 127 | ||
128 | if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && |
128 | if ((c2 == '#') && (c1 == 'b' || c1 == 'c') && |
129 | #if FCONLY |
129 | #if FCONLY |
130 | (c == 'V' || c == 'D')) { // version and debug |
130 | (c == 'V' || c == 'D' || c == 'Q')) { // version, debug, settings |
131 | #else |
131 | #else |
132 | (c == 'V' || c == 'O')) { // version and OSD |
132 | (c == 'V' || c == 'O' || c == 'Q')) { // version, OSD, settings |
133 | #endif |
133 | #endif |
134 | usart_rx_ok = 1; |
134 | usart_rx_ok = 1; |
135 | rxd_buffer[ptr_rxd_buffer++] = c2; |
135 | rxd_buffer[ptr_rxd_buffer++] = c2; |
136 | crc = c2; |
136 | crc = c2; |
Line 209... | Line 209... | ||
209 | if (len--) rxd_buffer[ptrOut++] = z; |
209 | if (len--) rxd_buffer[ptrOut++] = z; |
210 | else break; |
210 | else break; |
211 | } |
211 | } |
212 | pRxData = &rxd_buffer[3]; |
212 | pRxData = &rxd_buffer[3]; |
213 | RxDataLen = ptrOut - 3; |
213 | RxDataLen = ptrOut - 3; |
214 | } |
214 | } |
- | 215 | ||
- | 216 | ||
- | 217 | /** |
|
- | 218 | * Request Data through usart1 until a answer is received |
|
- | 219 | */ |
|
- | 220 | void usart1_request_blocking(unsigned char answer, const char* message) { |
|
- | 221 | rxd_buffer[2] = answer + 1; |
|
- | 222 | while (rxd_buffer[2] != answer) { |
|
- | 223 | rxd_buffer_locked = 0; |
|
- | 224 | usart1_EnableTXD(); |
|
- | 225 | usart1_puts_pgm(message); |
|
- | 226 | usart1_DisableTXD(); |
|
- | 227 | static uint8_t wait = 0; |
|
- | 228 | wait = 0; |
|
- | 229 | while (rxd_buffer_locked == 0 && wait < 150) { |
|
- | 230 | wait++; |
|
- | 231 | _delay_ms(10); |
|
- | 232 | } |
|
- | 233 | } |
|
- | 234 | Decode64(); |
|
- | 235 | } |
|
- | 236 | ||
- | 237 | /** |
|
- | 238 | * Request UART Redirect from NC to itself |
|
- | 239 | */ |
|
- | 240 | void usart1_request_nc_uart(void) { |
|
- | 241 | usart1_EnableTXD(); |
|
- | 242 | usart1_putc(0x1B); |
|
- | 243 | usart1_putc(0x1B); |
|
- | 244 | usart1_putc(0x55); |
|
- | 245 | usart1_putc(0xAA); |
|
- | 246 | usart1_putc(0x00); |
|
- | 247 | usart1_DisableTXD(); |
|
- | 248 | } |
|
- | 249 | ||
Line 215... | Line 250... | ||
215 | 250 | ||
216 | /** |
251 | /** |
217 | * request Data through USART in special MK format by adding checksum and |
252 | * request Data through USART in special MK format by adding checksum and |
218 | * encode data in modified Base64 |
253 | * encode data in modified Base64 |