/** * \brief Application entry point for smc_lcd example. * * \return Unused (ANSI-C compatibility). */ int main(void) { uint32_t i = 0; uint8_t uc_string_display[30]; sysclk_init(); board_init(); /* LCD display initialization */ _display_init(); /* Clear LCD */ ili9325_fill(COLOR_WHITE); /* Initialize Pir sensor */ re200b_motion_detect_init(ACC_MR_SELMINUS_AD0, ACC_MR_SELPLUS_AD4); while (1) { /* Reset motion detection (enable interrupt, clear variable, * clear status register) */ re200b_motion_detect_enable(); re200b_motion_detect_reset(); acc_get_interrupt_status(ACC); /* Enter sleep mode */ pmc_enable_sleepmode(0); /* Check if a motion was detected */ if (re200b_motion_detection() != 0UL) { /* Disable motion detection */ re200b_motion_detect_disable(); /* Display information about motion detection on LCD */ if ((i*LCD_LINE_HEIGHT) >= BOARD_LCD_HEIGHT) { i = 0; ili9325_fill(COLOR_WHITE); } sprintf((char*)uc_string_display, "Motion Detected:%ul", i); ili9325_draw_string(0, i*LCD_LINE_HEIGHT, uc_string_display); i++; } } }
/** * \brief Test sleep Mode. */ static void test_sleep_mode(void) { /* Configure button for waking up sleep mode */ configure_button(); /* Select clock for sleep mode */ user_change_clock(STRING_SLEEP); /* Disable UART */ pmc_disable_periph_clk(CONSOLE_UART_ID); /* Enter into sleep Mode */ pmc_enable_sleepmode(0); /* Set default clock and re-configure UART */ set_default_working_clock(); reconfigure_console(g_ul_current_mck, CONF_UART_BAUDRATE); puts("Exit from sleep Mode.\r"); }