void comm_init(void) { ir_uart_init(); }
int main (void) { int count; uint8_t data = 'M'; system_init (); tinygl_init (LOOP_RATE); tinygl_font_set (&font3x5_1); tinygl_text_speed_set (MESSAGE_RATE); tinygl_text_mode_set (TINYGL_TEXT_MODE_STEP); tinygl_text_dir_set (TINYGL_TEXT_DIR_ROTATE); navswitch_init (); ir_uart_init (); pacer_init (LOOP_RATE); show_byte ('M'); count = 0; /* Paced loop. */ while (1) { /* Wait for next tick. */ pacer_wait (); tinygl_update (); if (ir_uart_read_ready_p ()) { uint8_t data; data = ir_uart_getc (); /* Note, if messages come in too fast, say due to IR inteference from fluorescent lights, then the display will not keep up and will appear to freeze. */ show_byte (data); } count++; if (count > LOOP_RATE / SWITCH_POLL_RATE) { count = 0; navswitch_update (); if (navswitch_push_event_p (NAVSWITCH_WEST)) { ir_uart_putc (--data); /* Gobble echoed character. */ ir_uart_getc (); } if (navswitch_push_event_p (NAVSWITCH_EAST)) { ir_uart_putc (++data); /* Gobble echoed character. */ ir_uart_getc (); } } } return 0; }