This commit is contained in:
Jörn-Michael Miehe 2024-03-23 14:54:36 +00:00
parent decf910b55
commit 2553740729

View file

@ -6,7 +6,7 @@ type TxDma = dma::TxDma<serial::Tx<pac::USART1>, dma::dma1::C4>;
type DMXUniverse<const DMX_LEN: usize> = &'static mut [u8; DMX_LEN];
type DMXTransfer<const DMX_LEN: usize> = dma::Transfer<dma::R, DMXUniverse<DMX_LEN>, TxDma>;
pub enum DMX<const DMX_LEN: usize = 512> {
pub enum DMX<const DMX_LEN: usize = DMX_LEN_MAX> {
Idle(Option<TxDma>, Option<DMXUniverse<DMX_LEN>>),
Busy(Option<DMXTransfer<DMX_LEN>>),
}
@ -20,6 +20,8 @@ impl<const DMX_LEN: usize> DMX<DMX_LEN> {
where
PINS: serial::Pins<pac::USART1>,
{
assert!(DMX_LEN <= DMX_LEN_MAX);
serial.reconfigure(250_000.bps(), &clocks).unwrap();
Self::Idle(Some(serial.tx.with_dma(channel)), None)