Subversion Repositories Projects

Rev

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"
39
 
40
 
40
/* TODO:
41
/* TODO:
41
 * - verifiy correctness of values
42
 * - verifiy correctness of values
42
 * - clean up code :)
43
 * - clean up code :)
43
 */
44
 */
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
218
 
219
 
-
 
220
        // SPI setup
219
    DDRD |= (1 << PD2); // PD2 output (INT0)
221
    DDRD |= (1 << PD2); // PD2 output (INT0)
220
    SpiMasterInit();
222
    SpiMasterInit();
221
 
223
 
-
 
224
        // PPM detection setup
-
 
225
        ppm_init();
-
 
226
 
222
    // enable interrupts
227
    // enable interrupts
223
    sei();
-
 
224
 
228
 
-
 
229
    sei();
225
#endif
230
#endif
226
 
231
 
227
    //write_ascii_string(2,  7, "         CaScAdE          ");
232
    //write_ascii_string(2,  7, "         CaScAdE          ");
228
    //write_ascii_string(2,  8, "is TESTING his open source");
233
    //write_ascii_string(2,  8, "is TESTING his open source");
229
    //write_ascii_string(2,  9, "    EPi OSD Firmware");
234
    //write_ascii_string(2,  9, "    EPi OSD Firmware");
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();
237
#else
242
#else
-
 
243
 
238
        // clear serial screen
244
        // clear serial screen
239
        //usart1_puts("\x1B[2J\x1B[H");
245
        //usart1_puts("\x1B[2J\x1B[H");
240
        //usart1_puts("hello world!\r\n");
246
        //usart1_puts("hello world!123\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
245
        // request OSD Data from NC every 100ms
252
        // request OSD Data from NC every 100ms
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);
346
 
353
 
347
            // and disable debug...
354
            // and disable debug...
348
            usart1_request_mk_data(0, 'd', 0);
355
            usart1_request_mk_data(0, 'd', 0);
-
 
356
 
-
 
357
                        // reset last time counter
-
 
358
                        seconds_since_last_data = 0;
349
#endif
359
#endif
350
        }
360
        }
351
    }
361
    }
352
#endif
362
#endif
353
    return 0;
363
    return 0;