From f6289331e5c72a80319882bddd5a580711d2e0dd Mon Sep 17 00:00:00 2001 From: Monideep Bora Date: Tue, 2 Jan 2024 09:18:10 +0100 Subject: [PATCH] refactored code to make compatible to all devices --- cores/Arduino.h | 3 +++ libraries/I2S/src/I2S.cpp | 6 ++++-- variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cores/Arduino.h b/cores/Arduino.h index 3fcdc415..4f17e132 100644 --- a/cores/Arduino.h +++ b/cores/Arduino.h @@ -242,6 +242,9 @@ extern "C" { XMC_GPIO_CONFIG_t wa_config; IRQn_Type protocol_irq_num; uint32_t protocol_irq_service_request; +#if (UC_SERIES == XMC14) + XMC_SCU_IRQCTRL_t protocol_irq_source; +#endif } XMC_I2S_t; //**************************************************************************** diff --git a/libraries/I2S/src/I2S.cpp b/libraries/I2S/src/I2S.cpp index 2d7524fe..1c24f34a 100644 --- a/libraries/I2S/src/I2S.cpp +++ b/libraries/I2S/src/I2S.cpp @@ -182,8 +182,10 @@ XMC_I2S_CH_STATUS_t I2SClass::_init(){ XMC_USIC_CH_RXFIFO_Configure(MASTER_CHANNEL, 0, XMC_USIC_CH_FIFO_SIZE_2WORDS, 0); } MASTER_CHANNEL->RBCTR |= USIC_CH_RBCTR_RCIM_Msk; - - XMC_SCU_SetInterruptControl(i2s_config.protocol_irq_num, XMC_SCU_IRQCTRL_USIC1_SR2_IRQ11); +#if (UC_SERIES == XMC14) + // select interrupt source (A,B,C etc) input to NVIC node (only for XMC1400 devices) + XMC_SCU_SetInterruptControl(i2s_config.protocol_irq_num, i2s_config.protocol_irq_source ); +#endif // Sets FIFO interrupt XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(MASTER_CHANNEL, XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_STANDARD, i2s_config.protocol_irq_service_request); XMC_USIC_CH_RXFIFO_SetInterruptNodePointer(MASTER_CHANNEL, XMC_USIC_CH_RXFIFO_INTERRUPT_NODE_POINTER_ALTERNATE, i2s_config.protocol_irq_service_request); diff --git a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h index be87b066..c2fe4970 100644 --- a/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h +++ b/variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h @@ -353,7 +353,8 @@ XMC_I2S_t i2s_config = .input_hysteresis = XMC_GPIO_INPUT_HYSTERESIS_STANDARD }, .protocol_irq_num = (IRQn_Type) USIC1_2_IRQn, - .protocol_irq_service_request = 2 + .protocol_irq_service_request = 2, + .protocol_irq_source = XMC_SCU_IRQCTRL_USIC1_SR2_IRQ11 }; // Serial Interrupt and event handling