/* **************************************************************************************** * @brief com_uart_rx * @param[in] None * @response None * @return None * @description Read data form com RX *****************************************************************************************/ void com_uart_rx(void) { //continue receive the data for RX com_env.com_rx_len++; //set pt gpio state if(com_env.com_rx_len == QPPS_VAL_CHAR_NUM_MAX*QPP_DATA_MAX_LEN) //receive data buf is full, should sent them to ble { ke_evt_set(1UL << EVENT_UART_RX_FRAME_ID); } else { uart_read(QN_COM_UART, &com_env.com_rx_buf[com_env.com_rx_len], 1, com_uart_rx); ke_evt_set(1UL << EVENT_UART_RX_TIMEOUT_ID); } }
/** **************************************************************************************** * @brief Button 1 click callback * @description * Button 1 is used to enter adv mode. **************************************************************************************** */ void usr_button1_cb(void) { // If BLE is in the sleep mode, wakeup it. if(ble_ext_wakeup_allow()) { #if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO)) if (sleep_env.deep_sleep) { wakeup_32k_xtal_switch_clk(); } #endif sw_wakeup_ble_hw(); #if (FB_JOYSTICKS) usr_button_env.button_st = button_press; #endif // #if (QN_DEEP_SLEEP_EN) // // prevent deep sleep // if(sleep_get_pm() == PM_DEEP_SLEEP) // { // sleep_set_pm(PM_SLEEP); // } // #endif } // key debounce: // We can set a soft timer to debounce. // After wakeup BLE, the timer is not calibrated immediately and it is not precise. // So We set a event, in the event handle, set the soft timer. ke_evt_set(1UL << EVENT_BUTTON1_PRESS_ID); }
void com_uart_at(void) { // command receive over,send them to ble if(com_env.com_at_buf[com_env.com_at_len] == '\n' ) { ke_evt_set(1UL << EVENT_AT_COMMAND_PROC_ID); } else { com_env.com_at_len++; //if receive data buf is not full,continue receive the command data. //while receive data buf is full, should sent them to ble if(com_env.com_at_len < AT_COMMAN_LEN_MAX) { uart_read(QN_COM_UART, &com_env.com_at_buf[com_env.com_at_len], 1, com_uart_at); } else { com_env.com_at_buf[AT_COMMAN_LEN_MAX -1] = '\0'; ke_evt_set(1UL << EVENT_AT_COMMAND_PROC_ID); } } }
void accel_int_handler(void) { // If BLE is in the sleep mode, wakeup it. if(ble_ext_wakeup_allow()) { #if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO)) if (sleep_env.deep_sleep) { wakeup_32k_xtal_switch_clk(); } #endif sw_wakeup_ble_hw(); //usr_sleep_restore(); } ke_evt_set(1UL << EVENT_ACCEL_INT_ID); }
/** **************************************************************************************** * @brief Button 1 click callback * @description * Button 1 is used to enter adv mode. **************************************************************************************** */ void usr_button1_cb(void) { // If BLE is in the sleep mode, wakeup it. if(ble_ext_wakeup_allow()) { #if ((QN_DEEP_SLEEP_EN) && (!QN_32K_RCO)) if (sleep_env.deep_sleep) { wakeup_32k_xtal_switch_clk(); } #endif sw_wakeup_ble_hw(); } // key debounce: // We can set a soft timer to debounce. // After wakeup BLE, the timer is not calibrated immediately and it is not precise. // So We set a event, in the event handle, set the soft timer. ke_evt_set(1UL << EVENT_BUTTON1_PRESS_ID); }
/** **************************************************************************************** * @brief callback of adc sample complete. **************************************************************************************** */ void adc_sample_complete_callback(void) { ke_evt_set(1UL << EVENT_ADC_SAMPLE_CMP_ID); }
void app_event_com_tx_handler(void) { ke_evt_set(1UL<<EVENT_UART_TX_ID); }