Created
February 2, 2021 16:28
-
-
Save justacec/d2857f58caa1ece8098179010924c37a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod tmc2209_uart { | |
use core::marker::PhantomData; | |
use stm32f4xx_hal::{ | |
serial, | |
serial::{Tx, Rx} | |
}; | |
pub struct TMC2209<UART, PINS> | |
{ | |
tx: Tx<UART>, | |
rx: Rx<UART>, | |
phantom: PhantomData<PINS> | |
} | |
impl<UART, PINS> TMC2209<UART, PINS> { | |
pub fn new(uart: serial::Serial<UART, PINS>) -> Self { | |
let (tx, rx) = uart.split(); | |
let ret = TMC2209 { | |
tx: tx, | |
rx: rx, | |
phantom: PhantomData | |
}; | |
ret | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment