Vector type hell

This commit is contained in:
2023-09-18 09:39:01 +02:00
parent d84f4ba08f
commit 6f6ce8b314
3 changed files with 56 additions and 24 deletions

View File

@@ -5,6 +5,9 @@ mod webee;
use webee::{Webee, Vector};
use arduino_hal::Peripherals;
use arduino_hal::{port::{Pin, mode::AnyInput}};
use arduino_hal::hal::port::PD2;
use arduino_hal::port::mode::{Floating, Input};
use arduino_hal::prelude::*;
use panic_halt as _;
@@ -15,11 +18,10 @@ fn main() -> ! {
let pins = arduino_hal::pins!(dp);
let status = pins.d13.into_output();
let mut serial = arduino_hal::default_serial!(dp, pins, 57600);
let rx = pins.d2;
let mut test = Webee::new(
dp.USART1,
pins.d19,
pins.d19.forget_imode(),
pins.d18.into_output()
);
@@ -63,7 +65,8 @@ fn main() -> ! {
// }
// ufmt::uwriteln!(&mut serial, "RX ready: {}", rx.is_high()).void_unwrap();
let role : Vector<u8> = test.send(vector!([0x5a, 0xaa, 0xb1]));
let data: [u8; 3] = [0x5a, 0xaa, 0xb1];
let role : Vector<u8> = test.send(Vector::new(3, data.as_mut_slice()));
ufmt::uwriteln!(&mut serial, "Role: {}", role);
// for byte in [0x5a, 0xaa, 0xb1].iter() {