Esempio n. 1
0
void app_event_accel_handler(void)
{
#if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO))
    if (sleep_env.deep_sleep)
    {
        sleep_env.deep_sleep = false;
        // start 32k xtal wakeup timer
        wakeup_32k_xtal_start_timer();
    }
#endif
		
		//QPRINTF(".");
		int8_t xdat[ACCEL_FIFO_DEPTH];
		//int8_t ydat[ACCEL_FIFO_DEPTH];
		accel_get_X_samples(xdat, ACCEL_FIFO_DEPTH);

		for(uint8_t i=0;i<ACCEL_FIFO_DEPTH;i++)
		{
			//fancy_pedometer(xdat[i], ydat[i]);
			//basic_pedometer();
			better_pedometer(xdat[i]);
		}
		
		/*if(send_packet_bool)
		{
			send_packet(PROTOCOL_MODE_TX2);
			send_packet_bool = 0;
		}*/
		
		ke_evt_clear(1UL << EVENT_ACCEL_INT_ID);
		
		sleep_set_pm(PM_SLEEP);

}
Esempio n. 2
0
/**
 ****************************************************************************************
 * @brief Handles at_enable press.
 ****************************************************************************************
 */
void app_event_at_enable_press_handler(void)
{
    ke_evt_clear(1UL << EVENT_AT_ENABLE_PRESS_ID);
#if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO))
    if (sleep_env.deep_sleep)
    {
        sleep_env.deep_sleep = false;
        // start 32k xtal wakeup timer
        wakeup_32k_xtal_start_timer();
    }
#endif
    com_wakeup_handler();
}
Esempio n. 3
0
/**
 ****************************************************************************************
 * @brief Handles button press before key debounce.
 * @return If the message was consumed or not.
 ****************************************************************************************
 */
void app_event_button1_press_handler(void)
{
#if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO))
    if (sleep_env.deep_sleep)
    {
        sleep_env.deep_sleep = false;
        // start 32k xtal wakeup timer
        wakeup_32k_xtal_start_timer();
    }
#endif

    // delay 20ms to debounce
    ke_timer_set(APP_SYS_BUTTON_1_TIMER, TASK_APP, 2);
    ke_evt_clear(1UL << EVENT_BUTTON1_PRESS_ID);
}