コード例 #1
0
ファイル: task.c プロジェクト: eruanno123/smart-pht
static void enter_sleep_mode(void)
{
    bool_t wakeUp = bFalse;
    uint16_t i = 4;

    // Turn off GFX and backlight
    set_brightness(0);

    // Disable touch notification
    touch_set_event_handler(NULL);

    do
    {
        // Enable watchdog
        _SWDTEN = 1;

        // Enter idle
        Sleep();

        // Watchdog should wakeup MCU after one second
        // See hal/mcu/mcu_config.c

         // Disable WDT
        _SWDTEN = 0;

        // AFTER ANY INTERRUPT REQUEST:
        // Wait
        delay_ms(100);

        // Touch panel pressed over 2 seconds?
        if(RV_OK == touch_process())
        {
            wakeUp = bTrue;
            while(i--)
            {
                delay_ms(500);
                if(RV_OK != touch_process())
                {
                    wakeUp = bFalse;
                }
            }
        }

        // Clean up message queue
        knl_mailbox_init(&taskMailbox);
    } while(!wakeUp);

    //
    // Wake up
    //

    // Restore kernel handlers
    install_event_handlers();

    // Re-enable GFX and backlight
    set_brightness(lightenBrightness);

    gui_invalidate_all();
    // DONE!
}
コード例 #2
0
ファイル: touch_test.c プロジェクト: eruanno123/smart-pht
void run_touch_test( void )
{
    uint16_t ret = 0;

    hal_initialize();

    gfx_init();
    backlight_init();
    backlight_set_brightness(90);
    tty_enable_view(bTrue);

    tty_output_delayed("TOUCH test! Initialization... \n", 1000);

    ret = touch_initialize();
    guard(ret);

    touch_set_event_handler(touchEventFunc);

#ifdef TEST_FOREVER
    for(;;)
#endif
    {
        //tty_enable_view(False);
        //tty_reset();

        ret = touch_process();
        guard(ret);

        //tty_enable_view(True);
        delay_ms(100);
    }
}
コード例 #3
0
ファイル: stm32f10x_it.c プロジェクト: luoxufeiyan/STM32
// EXTI Line --> PF9
void EXTI9_5_IRQHandler(void)
{ 
  if(EXTI_GetITStatus(EXTI_Line9) != RESET)
  {	
    touch_flag=1;
		touch_process();
    EXTI_ClearITPendingBit(EXTI_Line9);
  }
}