small naming conventions
This commit is contained in:
@@ -7,14 +7,13 @@ use embassy_executor::Spawner;
|
||||
use embassy_time::Instant;
|
||||
use embassy_stm32::dma::Request;
|
||||
use embassy_stm32::gpio::{Input, Output, Level, Pull, Speed};
|
||||
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, pipe::Pipe};
|
||||
use dma_gpio::software_uart::{
|
||||
dma_timer::{init_tim6_for_uart, init_tim7_for_uart},
|
||||
gpio_dma_uart_rx::rx_dma_task,
|
||||
debug::dump_tim6_regs,
|
||||
};
|
||||
use dma_gpio::config::{BAUD, RX_OVERSAMPLE, TX_OVERSAMPLE};
|
||||
use dma_gpio::config::{TX_RING_BYTES, RX_RING_BYTES, PIPE_RX_SIZE};
|
||||
use dma_gpio::config::{TX_RING_BYTES, RX_RING_BYTES};
|
||||
use dma_gpio::software_uart::gpio_dma_uart_tx::tx_dma_task;
|
||||
use static_cell::StaticCell;
|
||||
use embassy_futures::yield_now;
|
||||
@@ -23,6 +22,7 @@ use dma_gpio::hw_uart_pc::driver::uart_task;
|
||||
use embassy_stm32::usart::{BufferedUart, Config, BufferedInterruptHandler};
|
||||
use embassy_stm32::peripherals;
|
||||
use embassy_stm32::bind_interrupts;
|
||||
use dma_gpio::config::{PIPE_SW_TX, PIPE_SW_RX};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@@ -31,9 +31,8 @@ bind_interrupts!(struct Irqs {
|
||||
|
||||
// Software uart
|
||||
pub const TIM6_UP_REQ: Request = 4;
|
||||
static PIPE_RX: Pipe<CriticalSectionRawMutex, PIPE_RX_SIZE> = Pipe::new();
|
||||
static TX_RING: StaticCell<[u32; TX_RING_BYTES]> = StaticCell::new();
|
||||
static RX_RING: StaticCell<[u8; RX_RING_BYTES]> = StaticCell::new();
|
||||
static SW_TX_RING: StaticCell<[u32; TX_RING_BYTES]> = StaticCell::new();
|
||||
static SW_RX_RING: StaticCell<[u8; RX_RING_BYTES]> = StaticCell::new();
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(spawner: Spawner) {
|
||||
@@ -42,7 +41,6 @@ async fn main(spawner: Spawner) {
|
||||
info!("init m8");
|
||||
|
||||
// HARDWARE UART to the PC
|
||||
|
||||
let mut cfg = Config::default();
|
||||
cfg.baudrate = BAUD;
|
||||
static TX_BUF: StaticCell<[u8; 256]> = StaticCell::new();
|
||||
@@ -68,14 +66,14 @@ async fn main(spawner: Spawner) {
|
||||
dump_tim6_regs();
|
||||
|
||||
// Safe one-time init from StaticCell
|
||||
let rx_ring: &mut [u8; RX_RING_BYTES] = RX_RING.init([0; RX_RING_BYTES]);
|
||||
let tx_ring_mem: &mut [u32; TX_RING_BYTES] = TX_RING.init([0; TX_RING_BYTES]);
|
||||
spawner.spawn(rx_dma_task(p.GPDMA1_CH1, rx_ring, &PIPE_RX).unwrap());
|
||||
let sw_rx_ring: &mut [u8; RX_RING_BYTES] = SW_RING_RX.init([0; RX_RING_BYTES]);
|
||||
let sw_tx_ring: &mut [u32; TX_RING_BYTES] = SW_RING_TX.init([0; TX_RING_BYTES]);
|
||||
spawner.spawn(rx_dma_task(p.GPDMA1_CH1, rx_ring, &PIPE_SW_RX).unwrap());
|
||||
|
||||
// Create and start the TX DMA ring in main.
|
||||
// let bsrr_ptr = embassy_stm32::pac::GPIOA.bsrr().as_ptr() as *mut u32;
|
||||
let odr_ptr = embassy_stm32::pac::GPIOA.odr().as_ptr() as *mut u32;
|
||||
spawner.spawn(tx_dma_task(p.GPDMA1_CH0, odr_ptr, tx_ring_mem, &PIPE_RX).unwrap());
|
||||
spawner.spawn(tx_dma_task(p.GPDMA1_CH0, odr_ptr, sw_tx_ring, &PIPE_SW_TX).unwrap());
|
||||
// EDN OF SOFTWARE UART
|
||||
|
||||
let mut last_yield = Instant::now();
|
||||
|
||||
Reference in New Issue
Block a user