/** * \brief User Interface - LCD Initialization. */ void ui_lcd_init(void) { uint8_t const scrolling_str[] = "SAM4L-EK DEMO"; /* * LCDCA Controller Initialization and display SAM4L-EK DEMO texts on * segment LCD */ // Initialize the C42364A LCD glass component. c42364a_init(); // Start autonomous animation. c42364a_circular_animation_start(C42364A_CSR_RIGHT, 7, 0x03); // Show ARM Icon. c42364a_show_icon(C42364A_ICON_ARM); // Start scrolling text. c42364a_text_scrolling_start(scrolling_str, strlen((char const *)scrolling_str)); while(event_qtouch_sensors_idle_count<UI_IDLE_TIME){} event_qtouch_sensors_idle_count = 0; // Stop scrolling text. c42364a_text_scrolling_stop(); ui_lcd_refresh_txt(); }
/** * \brief Configure the hardware. */ static void prvSetupHardware(void) { #ifdef EXAMPLE_LCD_SIGNALLING_ENABLE status_code_t status; #endif /* ASF function to setup clocking. */ sysclk_init(); /* Ensure all priority bits are assigned as preemption priority bits. */ NVIC_SetPriorityGrouping(__NVIC_PRIO_BITS); /* Atmel library function to setup for the evaluation kit being used. */ board_init(); /* PLC HAL service initialization */ hal_init(); hal_start(); #ifdef EXAMPLE_LCD_SIGNALLING_ENABLE /* Initialize the C42364A LCD glass component. */ status = c42364a_init(); if (status != STATUS_OK) { puts("-- LCD Initialization fails! --\r\n"); while (1) { } } c42364a_set_contrast(15); c42364a_clear_all(); c42364a_show_icon(C42364A_ICON_ATMEL); c42364a_show_icon(C42364A_ICON_WLESS); c42364a_show_text((const uint8_t *)"SERV "); #endif }
/** * \brief Main code entry point. */ int main( void ) { #ifdef CONF_BOARD_LCD_EN status_code_t status; #endif /* count ms to blink led */ ul_count_ms = 500; /* Prepare the hardware */ prvSetupHardware(); /* UART debug */ configure_dbg_console(); puts(STRING_HEADER); #ifdef CONF_BOARD_LCD_EN /* Initialize the C42364A LCD glass component. */ status = c42364a_init(); if (status != STATUS_OK) { puts("-- LCD Initialization fails! --\r\n"); while (1) { } } c42364a_set_contrast(15); c42364a_clear_all(); c42364a_show_icon(C42364A_ICON_ATMEL); c42364a_show_icon(C42364A_ICON_USB); c42364a_show_text((const uint8_t *)"PHYSNF"); #endif /* Init process timers */ initTimer1ms(); /* Init Phy Layer */ phy_init(SNIFFER_IF_ENABLE); /* Init Usi Layer */ usi_init(); while (1) { /* blink led 0 */ if (b_led_swap) { b_led_swap = false; #if (BOARD == SAM4CMP_DB || BOARD == SAM4CMS_DB) LED_Toggle(LED4); #else LED_Toggle(LED0); #endif } /* updWatchDog (); */ /* sniffer serialization */ sniffer_if_process(); /* USI */ usi_process(); } }
/** * \brief main function : do init and loop */ int main(void) { uint8_t key; uint8_t const scrolling_str[] = "C42364A Example "; int32_t value = -12345; /* Initialize the SAM system */ sysclk_init(); board_init(); /* Initialize the console uart */ configure_console(); /* Output example information */ printf("-- C42364A Example --\r\n"); printf("-- %s\n\r", BOARD_NAME); printf("-- Compiled: %s %s --\n\r", __DATE__, __TIME__); /* Turn on the backlight. */ ioport_set_pin_level(LCD_BL_GPIO, LCD_BL_ACTIVE_LEVEL); /* Initialize the C42364A LCD glass component. */ c42364a_init(); printf("Show all the components on the glass.\r\n"); c42364a_show_all(); printf("Press any key to continue.\r\n"); scanf("%c", (char *)&key); c42364a_clear_all(); /* Display menu */ display_menu(); while (1) { scanf("%c", (char *)&key); switch (key) { case 'h': display_menu(); break; case 'c': printf("Clear all the screen.\r\n"); c42364a_clear_all(); break; case '1': printf("Show icons, number and string.\r\n"); c42364a_show_icon(C42364A_ICON_ARM); c42364a_show_numeric_dec(value); c42364a_show_text((const uint8_t *)"Welcome"); c42364a_show_battery(C42364A_BATTERY_TWO); break; case '2': printf("Blink colon icon, show a time.\r\n"); c42364a_clear_icon(C42364A_ICON_MINUS); c42364a_clear_icon(C42364A_ICON_MINUS_SEG1); c42364a_clear_icon(C42364A_ICON_MINUS_SEG2); c42364a_write_num_packet((const uint8_t *)"1023"); c42364a_show_icon(C42364A_ICON_AM); c42364a_blink_icon_start(C42364A_ICON_COLON); break; case '3': printf("Show the two dots circular animation.\r\n"); c42364a_circular_animation_start(C42364A_CSR_RIGHT, 7, 0x03); break; case '4': printf("Text scrolling.\r\n"); c42364a_text_scrolling_start(scrolling_str, strlen((char const *)scrolling_str)); break; default: break; } } }