Skip to content

Instantly share code, notes, and snippets.

@justacec
Created February 2, 2021 16:28
Show Gist options
  • Save justacec/d2857f58caa1ece8098179010924c37a to your computer and use it in GitHub Desktop.
Save justacec/d2857f58caa1ece8098179010924c37a to your computer and use it in GitHub Desktop.
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