explicit baud rate
This commit is contained in:
parent
0748cb2517
commit
7bacf3845e
2 changed files with 6 additions and 2 deletions
|
@ -4,6 +4,8 @@
|
||||||
use nalgebra::Vector3;
|
use nalgebra::Vector3;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
pub const BAUDRATE: u32 = 115200;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug)]
|
#[derive(Serialize, Deserialize, Debug)]
|
||||||
pub enum Command {
|
pub enum Command {
|
||||||
/// Forward, clockwise
|
/// Forward, clockwise
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use core::{panic::PanicInfo, sync::atomic::Ordering};
|
use core::{panic::PanicInfo, sync::atomic::Ordering};
|
||||||
|
|
||||||
use common::{Command, Response, SensorData};
|
use common::{Command, Response, SensorData, BAUDRATE};
|
||||||
use embassy_executor::Spawner;
|
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_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};
|
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]);
|
static RX_BUF: ConstStaticCell<[u8; 1024]> = ConstStaticCell::new([0u8;1024]);
|
||||||
let rx_buf = RX_BUF.take();
|
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();
|
let (tx,rx) = uart.split();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue