コード例 #1
0
/**@brief   Function for receiving callbacks from the micro-esb library.
 */
static void uesb_event_handler(void)
{
    // NOTE: This will be executed at the RADIO_IRQHandler priority so execution time
    //       should be kept as short as possible.
    uint32_t rf_interrupts;

    uesb_get_clear_interrupts(&rf_interrupts);

    if(rf_interrupts & UESB_INT_TX_SUCCESS_MSK)
    {
	if (UESB_SUCCESS != uesb_disable())
	{
	    app_error_handler(PROPRIETARY_RF_DEBUG,
			      __LINE__,
			      (const uint8_t*)__FILE__);
	}
	timeslot_finished();
    }

    if(rf_interrupts & UESB_INT_TX_FAILED_MSK)
    {
        uesb_flush_tx();
    }

    if(rf_interrupts & UESB_INT_RX_DR_MSK)
    {
	// The Syma X4 does not transmit.
    }
}
コード例 #2
0
/**@brief IRQHandler used for execution context management. 
  *        Any available handler can be used as we're not using the associated hardware.
  *        This handler is used to stop and disable UESB
  */
void TIMESLOT_END_IRQHandler(void)
{
    uint32_t err_code;
    
    // Timeslot is about to end: stop UESB
    
    err_code = uesb_stop_rx();
    if (err_code != UESB_SUCCESS)
    {
        // Override
        NRF_RADIO->INTENCLR      = 0xFFFFFFFF;
        NRF_RADIO->TASKS_DISABLE = 1;
    }
    
    uesb_disable();
    
    m_total_timeslot_length = 0;
}