Working struct attribute type!
This commit is contained in:
21
src/webee.rs
21
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<USART: UsartOps<Atmega, RX, TX>, RX, TX> //where
|
||||
// USART: UsartOps<Atmega, port::Pin<Input, RX>, port::Pin<Output, TX>>
|
||||
|
||||
pub struct Webee<USART: UsartOps<Atmega, RX, TX>, RX, TX>
|
||||
{
|
||||
webee: Usart<USART, RX, TX>,
|
||||
}
|
||||
|
||||
enum SEND_CMD {}
|
||||
|
||||
impl<USART: UsartOps<Atmega, RX, TX>, RX, TX> Webee<USART, RX, TX> // where
|
||||
// USART: UsartOps<Atmega, port::Pin<Input, RX>, port::Pin<Output, 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;
|
||||
|
||||
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 {
|
||||
webee: Usart::new(device, rx, tx, 38400.into_baudrate())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user