void lp_ticker_init(void) { lp_ticker_disable_interrupt(); lp_ticker_clear_interrupt(); if (lpt_init_done) { return; } #ifdef TARGET_MCU_PSOC6_M0 // Allocate NVIC channel. lpt_sysint_config.intrSrc = cy_m0_nvic_allocate_channel(CY_LP_TICKER_IRQN_ID); if (lpt_sysint_config.intrSrc == (IRQn_Type)(-1)) { // No free NVIC channel. error("LP_TICKER NVIC channel allocation failed."); return; } #endif Cy_MCWDT_Init(LPT_MCWDT_UNIT, &config); Cy_SysInt_Init(&lpt_sysint_config, lp_ticker_irq_handler); NVIC_EnableIRQ(lpt_sysint_config.intrSrc); Cy_MCWDT_Enable(LPT_MCWDT_UNIT, CY_MCWDT_CTR0, LPT_MCWDT_DELAY_WAIT); lpt_init_done = true; }
static IRQn_Type i2c_irq_allocate_channel(i2c_obj_t *obj) { #if defined (TARGET_MCU_PSOC6_M0) obj->cm0p_irq_src = scb_0_interrupt_IRQn + obj->i2c_id; return cy_m0_nvic_allocate_channel(CY_SERIAL_IRQN_ID + obj->i2c_id); #else return (IRQn_Type)(scb_0_interrupt_IRQn + obj->i2c_id); #endif /* (TARGET_MCU_PSOC6_M0) */ }
static IRQn_Type spi_irq_allocate_channel(spi_obj_t *obj) { #if defined (TARGET_MCU_PSOC6_M0) obj->cm0p_irq_src = scb_0_interrupt_IRQn + obj->spi_id; return cy_m0_nvic_allocate_channel(CY_SERIAL_IRQN_ID + obj->spi_id); #else return (IRQn_Type)(ioss_interrupts_gpio_0_IRQn + obj->spi_id); #endif // M0 }