From 70a24b992d95eab412c4cbcfccaa86c5473f484c Mon Sep 17 00:00:00 2001 From: janek Date: Wed, 11 Dec 2024 12:53:14 +0100 Subject: [PATCH] rename stream to channel --- radio/src/dmafifo.h | 26 ++++--------------- .../common/arm/stm32/aux_serial_driver.cpp | 4 +-- radio/src/targets/flysky/telemetry_driver.cpp | 2 +- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/radio/src/dmafifo.h b/radio/src/dmafifo.h index 4721ccdadc7..38f0bcdb4fe 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 f54bdf7dd37..d9d178db2a4 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 cfea1904234..e7de917ac95 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);