1
Fork 0

explicit baud rate

This commit is contained in:
Andy Killorin 2025-01-30 19:10:00 -05:00
parent 0748cb2517
commit 7bacf3845e
Signed by: ank
GPG key ID: 23F9463ECB67FE8C
2 changed files with 6 additions and 2 deletions

View file

@ -4,6 +4,8 @@
use nalgebra::Vector3;
use serde::{Deserialize, Serialize};
pub const BAUDRATE: u32 = 115200;
#[derive(Serialize, Deserialize, Debug)]
pub enum Command {
/// Forward, clockwise

View file

@ -3,7 +3,7 @@
use core::{panic::PanicInfo, sync::atomic::Ordering};
use common::{Command, Response, SensorData};
use common::{Command, Response, SensorData, BAUDRATE};
use embassy_executor::Spawner;
use embassy_rp::{bind_interrupts, peripherals::{UART0, UART1, USB}, pwm::{self, Pwm}, uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, BufferedUartTx, Config}, usb::Driver};
use embassy_sync::{blocking_mutex::raw::CriticalSectionRawMutex, channel::Channel};
@ -59,7 +59,9 @@ async fn main(spawner: Spawner) {
static RX_BUF: ConstStaticCell<[u8; 1024]> = ConstStaticCell::new([0u8;1024]);
let rx_buf = RX_BUF.take();
let uart = BufferedUart::new(p.UART1, Irqs, p.PIN_20, p.PIN_21, tx_buf, rx_buf, Config::default());
let mut uart_config = Config::default();
uart_config.baudrate = BAUDRATE;
let uart = BufferedUart::new(p.UART1, Irqs, p.PIN_20, p.PIN_21, tx_buf, rx_buf, uart_config);
let (tx,rx) = uart.split();