diff --git a/radio/src/dmafifo.h b/radio/src/dmafifo.h index 4721ccdadc..38f0bcdb4f 100644 --- a/radio/src/dmafifo.h +++ b/radio/src/dmafifo.h @@ -27,12 +27,8 @@ template class DMAFifo { public: -#if defined(STM32F0) - explicit DMAFifo(DMA_Channel_TypeDef * stream): -#else - explicit DMAFifo(DMA_Stream_TypeDef * stream): -#endif - stream(stream), + explicit DMAFifo(DMA_Channel_TypeDef * channel): + channel(channel), ridx(0) { } @@ -49,11 +45,7 @@ class DMAFifo uint8_t last(int index) { -#if defined(STM32F0) - return fifo[(2*N - stream->CNDTR - index) & (N-1)]; -#else - return fifo[(2*N - stream->NDTR - index) & (N-1)]; -#endif + return fifo[(2*N - channel->CNDTR - index) & (N-1)]; } bool isEmpty() @@ -61,11 +53,7 @@ class DMAFifo #if defined(SIMU) return true; #endif -#if defined(STM32F0) - return (ridx == N - stream->CNDTR); -#else - return (ridx == N - stream->NDTR); -#endif + return (ridx == N - channel->CNDTR); } bool pop(uint8_t & element) @@ -85,11 +73,7 @@ class DMAFifo return fifo; } -#if defined(STM32F0) - DMA_Channel_TypeDef * stream; -#else - DMA_Stream_TypeDef * stream; -#endif + DMA_Channel_TypeDef * channel; protected: uint8_t fifo[N]; volatile uint32_t ridx; diff --git a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp index f54bdf7dd3..d9d178db2a 100644 --- a/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp +++ b/radio/src/targets/common/arm/stm32/aux_serial_driver.cpp @@ -56,7 +56,7 @@ void auxSerialSetup(unsigned int baudrate, bool dma, uint16_t lenght = USART_Wor if (dma) { #if defined(SBUS_TRAINER) - auxSerialRxFifo.stream = AUX_SERIAL_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise + auxSerialRxFifo.channel = AUX_SERIAL_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise auxSerialRxFifo.clear(); USART_ITConfig(AUX_SERIAL_USART, USART_IT_RXNE, DISABLE); USART_ITConfig(AUX_SERIAL_USART, USART_IT_TXE, DISABLE); @@ -300,7 +300,7 @@ void aux4SerialSetup(unsigned int baudrate, bool dma, uint16_t lenght = USART_Wo USART_InitStructure.USART_Mode = USART_Mode_Rx; USART_Init(AUX4_SERIAL_USART, &USART_InitStructure); - aux4SerialRxFifo.stream = AUX4_SERIAL_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise + aux4SerialRxFifo.channel = AUX4_SERIAL_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise aux4SerialRxFifo.clear(); // USART_ITConfig(AUX4_SERIAL_USART, USART_IT_RXNE, DISABLE); AUX4_SERIAL_USART->CR1 &= ~(USART_CR1_RXNEIE /*| USART_CR1_TXEIE*/); diff --git a/radio/src/targets/flysky/telemetry_driver.cpp b/radio/src/targets/flysky/telemetry_driver.cpp index cfea190423..e7de917ac9 100644 --- a/radio/src/targets/flysky/telemetry_driver.cpp +++ b/radio/src/targets/flysky/telemetry_driver.cpp @@ -87,7 +87,7 @@ void telemetryPortInit(uint32_t baudrate, uint8_t mode) { USART_DMACmd(TELEMETRY_USART, USART_DMAReq_Rx, DISABLE); DMA_DeInit(TELEMETRY_DMA_Channel_RX); - telemetryDMAFifo.stream = TELEMETRY_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise + telemetryDMAFifo.channel = TELEMETRY_DMA_Channel_RX; // workaround, CNDTR reading do not work otherwise telemetryDMAFifo.clear(); USART_ITConfig(TELEMETRY_USART, USART_IT_RXNE, DISABLE);