void pyb_cc3000_enable_irq(void) { DEBUG_printf("pyb_cc3000_enable_irq: en=%lu miss=%lu\n", exti14_enabled, exti14_missed); if (exti14_missed) { // doesn't look like this is needed DEBUG_printf("pyb_cc3000_enable_irq: handling missed IRQ\n"); /* // TODO hack if we have a pending IRQ extern void SpiIntGPIOHandler(void); */ SpiIntGPIOHandler(); exti14_missed = 0; } exti14_enabled = 1; }
STATIC mp_obj_t irq_callback(mp_obj_t line) { led_toggle(2); //extern void SpiIntGPIOHandler(void); //extern uint32_t exti14_enabled; //extern uint32_t exti14_missed; //printf("-> EXTI14 en=%lu miss=%lu\n", exti14_enabled, exti14_missed); if (exti14_enabled) { exti14_missed = 0; SpiIntGPIOHandler(); // CC3000 interrupt } else { exti14_missed = 1; } //printf("<- EXTI14 done\n"); return mp_const_none; }
// EXTI // for USRSW on A13 // for cc3000 on A14 void EXTI15_10_IRQHandler(void) { // work out if it's A13 that had the interrupt if (EXTI_GetITStatus(EXTI_Line13) != RESET) { // this is used just to wake the device EXTI_ClearITPendingBit(EXTI_Line13); } // work out if it's A14 that had the interrupt if (EXTI_GetITStatus(EXTI_Line14) != RESET) { led_toggle(PYB_LED_G2); extern void SpiIntGPIOHandler(void); extern uint32_t exti14_enabled; extern uint32_t exti14_missed; //printf("-> EXTI14 en=%lu miss=%lu\n", exti14_enabled, exti14_missed); if (exti14_enabled) { exti14_missed = 0; SpiIntGPIOHandler(); // CC3000 interrupt } else { exti14_missed = 1; } EXTI_ClearITPendingBit(EXTI_Line14); //printf("<- EXTI14 done\n"); } }