use hcl::platform::usart; use hcl::platform::dma; use hcl::platform::PeripheralRef; use hcl::platform::Location; use hcl::dma::*; use alloc::vec::Vec; pub struct UsartPrinter where Addr : hcl::platform::Location, { usart: PeripheralRef } impl UsartPrinter where Addr : hcl::platform::Location { pub fn init(usart: PeripheralRef) -> UsartPrinter { UsartPrinter { usart: usart, } } pub fn print(&mut self, data: Vec) -> () { for byte in data { self.usart.clear_tx_complete(); self.usart.set_data(byte.into()); while !self.usart.tx_complete() { }; } } }