int main(void) { uint16_t ui1; LCD_init(); i2cInit(); Timer_Init(); KbdInit(); LCD_busy LCD_CLRSCR LCD_WR_LINE(0, 0, "Starting!!!"); for (ui1=0; ui1<0x3F; ui1++) LCD_busy; LCD_WR_LINE(0, 0, "Press any key!!!"); LCD_WR_LINE(1, 0, "Shall displayed!"); KBD_RESET_KEY; while (1) { KBD_GET_KEY; LCD_POS(1, 0); LCD_WR("Scan Code : "); LCD_PUT_UINT8X(KbdData); for (ui1=0; ui1<0xFF; ui1++) {} KBD_RESET_KEY; } return 0; }
int main(void) { uint8_t ui1; LCD_init(); KbdInit(); /* Enable Global Interrupts */ sei(); LCD_bl_on; LCD_WR_LINE_NP(0, 0, PSTR("PS2 Kbd: "), 9); LCD_refresh(); _delay_ms(1000); for (ui1=0; ; ui1++) { if (KBD_HIT) { LCD_POS(0, 9); LCD_PUTCH(KbdData); KBD_RESET_KEY; } // LCD_POS(0, 11); // LCD_PUT_UINT8X(drC); LCD_POS(0, 14); LCD_PUT_UINT8X(ui1); // LCD_POS(1, 0); // LCD_PUT_UINT8X(bitC); // LCD_PUT_UINT8X(kbdDr[0]); // LCD_PUT_UINT8X(kbdDr[1]); // LCD_PUT_UINT8X(kbdDr[2]); // LCD_PUT_UINT8X(kbdDr[3]); LCD_refresh(); _delay_ms(500); } return 0; }
static void update_lcd(void) { // Print frame number and up-time on top line uint32_t up_time = uni_vec[2]; uint32_t days = up_time / 86400; uint32_t hours = up_time / 3600; uint32_t mins = up_time / 60; io_printf(IO_LCD, "%qFrame %u%qUp", LCD_POS(0, 0), ee_data.frame_ID, LCD_POS(10, 0)); if (hours < 10) { io_printf(IO_LCD, "%2u:%02u:%02u\n", hours, mins % 60, up_time % 60); } else if (hours < 100) { io_printf(IO_LCD, "%4uh%02um\n", hours, mins % 60); } else { io_printf(IO_LCD, "%4ud%02uh\n", days, hours % 24); } // Print status on second line if (up_time < ee_data.LCD_time) { io_printf(IO_LCD, "%q%p%q%5u\n", LCD_POS(0, 1), &bmp_ip.ip_addr, LCD_POS(15, 1), board_ID); return; } while (1) { scan_next++; if (scan_next == CAN_SIZE) { uint32_t count = 0; for (uint32_t i = 0; i < CAN_SIZE; i++) { if (can_status[i]) { count++; } } uint32_t v = cortex_vec->sw_ver; if (v < 65535) { io_printf(IO_LCD, "%qBMP %d.%02d %4u slots\n", LCD_POS(0, 1), v / 100, v % 100, count); } else { io_printf(IO_LCD, "%qBMP %d.%d.%d %q%4u slots\n", LCD_POS(0, 1), (v >> 16) & 255, (v >> 8) & 255, v & 255, LCD_POS(10, 1), count); } break; } if (scan_next == CAN_SIZE + 1) { scan_next = 0; } if (can_status[scan_next]) { board_stat_t *stat = &board_stat[scan_next]; if (stat->shutdown) { set_text("Shut VIEF ", stat->shutdown); } else if (stat->warning) { set_text("Warn VIEF ", stat->warning); } else { continue; } io_printf(IO_LCD, "%qSlot %u %q%s\n", LCD_POS(0, 1), can2board[scan_next], LCD_POS(10, 1), text); break; } }