pub struct UartManager { /* private fields */ }Expand description
UART manager for handling multiple channels
Implementations§
Source§impl UartManager
impl UartManager
pub fn new(obniz: Obniz) -> Self
Sourcepub fn channel(&self, channel: u8) -> ObnizResult<UartChannel>
pub fn channel(&self, channel: u8) -> ObnizResult<UartChannel>
Get specific UART channel (typically uart0)
Sourcepub fn uart0(&self) -> UartChannel
pub fn uart0(&self) -> UartChannel
Get primary UART channel (uart0)
Sourcepub async fn init_channel(
&self,
channel: u8,
config: UartConfig,
) -> ObnizResult<()>
pub async fn init_channel( &self, channel: u8, config: UartConfig, ) -> ObnizResult<()>
Initialize UART channel with configuration
Sourcepub async fn send_data(&self, channel: u8, data: Vec<u8>) -> ObnizResult<()>
pub async fn send_data(&self, channel: u8, data: Vec<u8>) -> ObnizResult<()>
Send data on specific channel
Sourcepub async fn send_string(&self, channel: u8, text: &str) -> ObnizResult<()>
pub async fn send_string(&self, channel: u8, text: &str) -> ObnizResult<()>
Send string on specific channel
Sourcepub async fn set_receive_callback<F>(
&self,
channel: u8,
callback: F,
) -> ObnizResult<()>
pub async fn set_receive_callback<F>( &self, channel: u8, callback: F, ) -> ObnizResult<()>
Set receive callback for specific channel
Sourcepub async fn set_string_callback<F>(
&self,
channel: u8,
callback: F,
) -> ObnizResult<()>
pub async fn set_string_callback<F>( &self, channel: u8, callback: F, ) -> ObnizResult<()>
Set string receive callback for specific channel
Sourcepub fn remove_channel_callback(&self, channel: u8) -> ObnizResult<()>
pub fn remove_channel_callback(&self, channel: u8) -> ObnizResult<()>
Remove callback for specific channel
Sourcepub async fn deinit_channel(&self, channel: u8) -> ObnizResult<()>
pub async fn deinit_channel(&self, channel: u8) -> ObnizResult<()>
Deinitialize specific channel
Sourcepub fn simple_config(rx_pin: u8, tx_pin: u8, baud_rate: u32) -> UartConfig
pub fn simple_config(rx_pin: u8, tx_pin: u8, baud_rate: u32) -> UartConfig
Create simple UART configuration for common use cases
Sourcepub fn flow_control_config(
rx_pin: u8,
tx_pin: u8,
rts_pin: u8,
cts_pin: u8,
baud_rate: u32,
) -> UartConfig
pub fn flow_control_config( rx_pin: u8, tx_pin: u8, rts_pin: u8, cts_pin: u8, baud_rate: u32, ) -> UartConfig
Create UART configuration with flow control
Trait Implementations§
Source§impl Clone for UartManager
impl Clone for UartManager
Auto Trait Implementations§
impl !RefUnwindSafe for UartManager
impl !UnwindSafe for UartManager
impl Freeze for UartManager
impl Send for UartManager
impl Sync for UartManager
impl Unpin for UartManager
impl UnsafeUnpin for UartManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more