software uart lib errors fixed

This commit is contained in:
Priec
2025-11-23 15:54:20 +01:00
parent 4097ce1c7a
commit 3218714d8c
2 changed files with 8 additions and 5 deletions

View File

@@ -5,15 +5,14 @@ use embassy_stm32::{
peripherals::GPDMA1_CH1,
Peri,
};
use crate::config::RX_PIN_BIT;
use embassy_stm32::dma::{
ReadableRingBuffer,
TransferOptions,
};
use crate::config::{RX_OVERSAMPLE, UART_CFG};
use crate::decode_uart_samples;
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, pipe::Pipe};
use embassy_futures::yield_now;
use crate::UartConfig;
use defmt::info;
// datasheet tabulka 137
@@ -26,6 +25,9 @@ pub async fn rx_dma_task(
register: *mut u8,
ring: &'static mut [u8],
pipe_rx: &'static Pipe<CriticalSectionRawMutex, 4096>,
rx_pin_bit: u8,
rx_oversample: u16,
uart_cfg: &'static UartConfig,
) {
let mut opts = TransferOptions::default();
opts.half_transfer_ir = true;
@@ -50,14 +52,14 @@ pub async fn rx_dma_task(
let _ = rx.read_exact(&mut raw_chunk).await;
for (i, b) in raw_chunk.iter().enumerate() {
level_buf[valid_len + i] = ((*b >> RX_PIN_BIT) & 1) as u8;
level_buf[valid_len + i] = ((*b >> rx_pin_bit) & 1) as u8;
}
let current_end = valid_len + CHUNK_SIZE;
let (decoded, consumed) = decode_uart_samples(
&level_buf[..current_end],
RX_OVERSAMPLE,
&UART_CFG
rx_oversample,
uart_cfg
);
if !decoded.is_empty() {