quicksave 2

This commit is contained in:
2024-01-01 19:35:32 +01:00
parent e64eafd869
commit 897ef263ca
2 changed files with 16 additions and 7 deletions

View File

@@ -1,24 +1,30 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use arduino_hal::Peripherals;
use arduino_hal::prelude::*;
use panic_halt as _;
use embedded_hal::serial::Read;
mod webee; mod webee;
use webee::Webee; use webee::Webee;
use crate::webee::SendCmd::{Baudrate, Channel, MAC, PanId, Role, TransmitPower, ZigbeeNetworkKey}; use crate::webee::SendCmd::{Baudrate, Channel, MAC, PanId, Role, TransmitPower, ZigbeeNetworkKey};
use arduino_hal::Peripherals;
use arduino_hal::prelude::*;
use panic_halt as _;
#[arduino_hal::entry] #[arduino_hal::entry]
fn main() -> ! { fn main() -> ! {
let dp = Peripherals::take().unwrap(); let dp = Peripherals::take().unwrap();
let pins = arduino_hal::pins!(dp); let pins = arduino_hal::pins!(dp);
let _status = pins.d13.into_output(); let mut status = pins.d13.into_output();
let mut serial = arduino_hal::default_serial!(dp, pins, 57600); let mut serial = arduino_hal::default_serial!(dp, pins, 57600);
unsafe {
avr_device::interrupt::enable();
}
let mut webee = Webee::new( let mut webee = Webee::new(
dp.USART1, dp.USART1,
pins.d19.forget_imode(), pins.d19.forget_imode(),

View File

@@ -56,8 +56,11 @@ Webee<
TX: PinOps TX: PinOps
{ {
pub fn new(device: USART, rx: Pin<Input, RX>, tx: Pin<Output, TX>) -> Self { pub fn new(device: USART, rx: Pin<Input, RX>, tx: Pin<Output, TX>) -> Self {
let mut interface = Usart::new(device, rx, tx, 38400.into_baudrate());
// interface.listen(arduino_hal::hal::usart::Event::RxComplete);
let instance = Self { let instance = Self {
webee: Usart::new(device, rx, tx, 38400.into_baudrate()) webee: interface
}; };
delay_ms(1000); delay_ms(1000);