Rev 474 | Rev 489 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 474 | Rev 477 | ||
---|---|---|---|
Line 34... | Line 34... | ||
34 | #include "usart1.h" |
34 | #include "usart1.h" |
35 | #include "osd_helpers.h" |
35 | #include "osd_helpers.h" |
36 | #include "config.h" |
36 | #include "config.h" |
37 | #include "spi.h" |
37 | #include "spi.h" |
38 | #include "buttons.h" |
38 | #include "buttons.h" |
- | 39 | #include "ppm.h" |
|
Line 39... | Line 40... | ||
39 | 40 | ||
40 | /* TODO: |
41 | /* TODO: |
41 | * - verifiy correctness of values |
42 | * - verifiy correctness of values |
42 | * - clean up code :) |
43 | * - clean up code :) |
Line 214... | Line 215... | ||
214 | // set up timer |
215 | // set up timer |
215 | TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64 |
216 | TCCR0 |= (1 << CS00) | (1 << CS01); // timer0 prescaler 64 |
216 | OCR0 = 15; // preload |
217 | OCR0 = 15; // preload |
217 | TIMSK |= (1 << TOIE0); // enable overflow timer0 |
218 | TIMSK |= (1 << TOIE0); // enable overflow timer0 |
Line -... | Line 219... | ||
- | 219 | ||
218 | 220 | // SPI setup |
|
219 | DDRD |= (1 << PD2); // PD2 output (INT0) |
221 | DDRD |= (1 << PD2); // PD2 output (INT0) |
Line -... | Line 222... | ||
- | 222 | SpiMasterInit(); |
|
- | 223 | ||
- | 224 | // PPM detection setup |
|
220 | SpiMasterInit(); |
225 | ppm_init(); |
221 | - | ||
Line -... | Line 226... | ||
- | 226 | ||
222 | // enable interrupts |
227 | // enable interrupts |
Line 223... | Line 228... | ||
223 | sei(); |
228 | |
224 | 229 | sei(); |
|
225 | #endif |
230 | #endif |
Line 233... | Line 238... | ||
233 | 238 | ||
234 | #if ALLCHARSDEBUG | (WRITECHARS != -1) |
239 | #if ALLCHARSDEBUG | (WRITECHARS != -1) |
235 | clear(); |
240 | clear(); |
236 | write_all_chars(); |
241 | write_all_chars(); |
- | 242 | #else |
|
237 | #else |
243 | |
238 | // clear serial screen |
244 | // clear serial screen |
239 | //usart1_puts("\x1B[2J\x1B[H"); |
245 | //usart1_puts("\x1B[2J\x1B[H"); |
- | 246 | //usart1_puts("hello world!123\r\n"); |
|
240 | //usart1_puts("hello world!\r\n"); |
247 | |
241 | #if FCONLY |
248 | #if FCONLY |
242 | // request data ever 100ms from FC; |
249 | // request data ever 100ms from FC; |
243 | usart1_request_mk_data(0, 'd', 100); |
250 | usart1_request_mk_data(0, 'd', 100); |
244 | #else |
251 | #else |
Line 344... | Line 351... | ||
344 | // request OSD Data from NC every 100ms |
351 | // request OSD Data from NC every 100ms |
345 | usart1_request_mk_data(1, 'o', 100); |
352 | usart1_request_mk_data(1, 'o', 100); |
Line 346... | Line 353... | ||
346 | 353 | ||
347 | // and disable debug... |
354 | // and disable debug... |
- | 355 | usart1_request_mk_data(0, 'd', 0); |
|
- | 356 | ||
- | 357 | // reset last time counter |
|
348 | usart1_request_mk_data(0, 'd', 0); |
358 | seconds_since_last_data = 0; |
349 | #endif |
359 | #endif |
350 | } |
360 | } |
351 | } |
361 | } |
352 | #endif |
362 | #endif |