Compare commits

..

2 Commits

Author SHA1 Message Date
d84f4ba08f Working struct attribute type! 2023-08-27 00:44:15 +02:00
359617ad67 Working struct? 2023-08-26 04:05:55 +02:00

View File

@@ -1,24 +1,41 @@
use arduino_hal::Usart; use arduino_hal::clock::Clock;
use arduino_hal::usart::UsartOps; use arduino_hal::hal::Atmega;
use arduino_hal::port;
use arduino_hal::port::mode::{Input, Output};
// use arduino_hal::port;
// use arduino_hal::port::mode::{Input, Output};
use arduino_hal::usart::{Usart, UsartOps};
use arduino_hal::prelude::*; use arduino_hal::prelude::*;
use avr_device::atmega2560::{USART1, USART2, USART3};
use embedded_hal::serial::{Read}; use embedded_hal::serial::{Read};
mod vector; mod vector;
pub use vector::Vector; pub use vector::Vector;
pub struct Webee<USART, RX, TX> where
USART: UsartOps<H, RX, TX> pub struct Webee<USART: UsartOps<Atmega, RX, TX>, RX, TX>
{ {
webee: Usart<USART, RX, TX>, webee: Usart<USART, RX, TX>,
} }
enum SEND_CMD {} enum SEND_CMD {}
impl<USART, RX, TX> Webee<USART, RX, TX> { impl<USART, RX, TX>
Webee<
USART,
port::Pin<Input, RX>,
port::Pin<Output, TX>
>
where
USART: UsartOps<Atmega, port::Pin<Input, RX>, port::Pin<Output, TX>>,
RX: port::PinOps,
TX: port::PinOps
{
const STOP: u8 = 0xFF; const STOP: u8 = 0xFF;
pub fn new(device: USART, rx: RX, tx: TX) -> Self { pub fn new(device: USART, rx: port::Pin<Input, RX>, tx: port::Pin<Output, TX>) -> Self {
Self { Self {
webee: Usart::new(device, rx, tx, 38400.into_baudrate()) webee: Usart::new(device, rx, tx, 38400.into_baudrate())
} }