Skip to content

Commit

Permalink
refactored code to make compatible to all devices
Browse files Browse the repository at this point in the history
  • Loading branch information
boramonideep committed Jan 2, 2024
1 parent 6dc31a5 commit f628933
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cores/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

//****************************************************************************
Expand Down
6 changes: 4 additions & 2 deletions libraries/I2S/src/I2S.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion variants/XMC1400/config/XMC1400_XMC2GO/pins_arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f628933

Please sign in to comment.