/** * @brief * Gpio interrupt func for DR PIN ( PA 1 if Pin set high = transmision complited) * @{ */ void EXTI9_5_IRQHandler(void){ if(__HAL_GPIO_EXTI_GET_FLAG(GPIO_PIN_6)){ __HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_6); RESET_TX_CE_nRF_RX; //RESET PINU TX_CE data_ready_flag = 1; } }
// Interrupt handler void Handle_EXTI_Irq(uint32_t line) { if (__HAL_GPIO_EXTI_GET_FLAG(1 << line)) { __HAL_GPIO_EXTI_CLEAR_FLAG(1 << line); if (line < EXTI_NUM_VECTORS) { mp_obj_t *cb = &MP_STATE_PORT(pyb_extint_callback)[line]; if (*cb != mp_const_none) { // When executing code within a handler we must lock the GC to prevent // any memory allocations. We must also catch any exceptions. gc_lock(); nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { mp_call_function_1(*cb, MP_OBJ_NEW_SMALL_INT(line)); nlr_pop(); } else { // Uncaught exception; disable the callback so it doesn't run again. *cb = mp_const_none; extint_disable(line); printf("Uncaught exception in ExtInt interrupt handler line %lu\n", line); mp_obj_print_exception(&mp_plat_print, (mp_obj_t)nlr.ret_val); } gc_unlock(); } } } }
/** * @brief * Gpio interrupt func for DR PIN ( PA 1 if Pin set high = transmision complited) * @{ */ void EXTI1_IRQHandler(void){ //HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1); if(__HAL_GPIO_EXTI_GET_FLAG(GPIO_PIN_1)){ __HAL_GPIO_EXTI_CLEAR_FLAG(GPIO_PIN_1); RESET_TX_EN; //Reset Pinu TX_EN nRF RESET_TX_CE; //Reset Pinu TX_CE nRF } }
static void handle_interrupt_in(uint32_t irq_index) { // Retrieve the gpio and pin that generate the irq GPIO_TypeDef *gpio = (GPIO_TypeDef *)(channel_gpio[irq_index]); uint32_t pin = (uint32_t)(1 << channel_pin[irq_index]); // Clear interrupt flag if (__HAL_GPIO_EXTI_GET_FLAG(pin) != RESET) { __HAL_GPIO_EXTI_CLEAR_FLAG(pin); } if (channel_ids[irq_index] == 0) return; // Check which edge has generated the irq if ((gpio->IDR & pin) == 0) { irq_handler(channel_ids[irq_index], IRQ_FALL); } else { irq_handler(channel_ids[irq_index], IRQ_RISE); } }