diff --git a/src/webee.rs b/src/webee.rs index 2698395..8fe68a8 100644 --- a/src/webee.rs +++ b/src/webee.rs @@ -1,9 +1,12 @@ use arduino_hal::clock::Clock; 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 avr_device::atmega2560::{USART1, USART2, USART3}; use embedded_hal::serial::{Read}; @@ -11,20 +14,28 @@ mod vector; pub use vector::Vector; -pub struct Webee, RX, TX> //where -// USART: UsartOps, port::Pin> + +pub struct Webee, RX, TX> { webee: Usart, } enum SEND_CMD {} -impl, RX, TX> Webee // where - // USART: UsartOps, port::Pin> +impl + Webee< + USART, + port::Pin, + port::Pin + > +where + USART: UsartOps, port::Pin>, + RX: port::PinOps, + TX: port::PinOps { const STOP: u8 = 0xFF; - pub fn new(device: USART, rx: RX, tx: TX) -> Self { + pub fn new(device: USART, rx: port::Pin, tx: port::Pin) -> Self { Self { webee: Usart::new(device, rx, tx, 38400.into_baudrate()) }