Skip to content

Commit

Permalink
rename stream to channel
Browse files Browse the repository at this point in the history
  • Loading branch information
ajjjjjjjj committed Dec 11, 2024
1 parent b6b24dc commit 70a24b9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
26 changes: 5 additions & 21 deletions radio/src/dmafifo.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,8 @@ template <int N>
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)
{
}
Expand All @@ -49,23 +45,15 @@ 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()
{
#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)
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions radio/src/targets/common/arm/stm32/aux_serial_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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*/);
Expand Down
2 changes: 1 addition & 1 deletion radio/src/targets/flysky/telemetry_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 70a24b9

Please sign in to comment.