pub struct AdChannel { /* private fields */ }Expand description
Individual AD channel controller
Implementations§
Source§impl AdChannel
impl AdChannel
pub fn new(channel: u8, obniz: Obniz) -> Self
pub fn channel_key(&self) -> String
Sourcepub async fn get(&self) -> ObnizResult<f64>
pub async fn get(&self) -> ObnizResult<f64>
Get current voltage reading
Sourcepub async fn configure(&self, config: AdConfig) -> ObnizResult<()>
pub async fn configure(&self, config: AdConfig) -> ObnizResult<()>
Configure AD channel
Sourcepub async fn enable_stream(&self) -> ObnizResult<()>
pub async fn enable_stream(&self) -> ObnizResult<()>
Enable streaming mode
Sourcepub async fn disable_stream(&self) -> ObnizResult<()>
pub async fn disable_stream(&self) -> ObnizResult<()>
Disable streaming mode
Sourcepub async fn on_change<F>(&self, callback: F) -> ObnizResult<()>
pub async fn on_change<F>(&self, callback: F) -> ObnizResult<()>
Register callback for voltage changes (stream mode)
Sourcepub fn remove_callback(&self) -> ObnizResult<()>
pub fn remove_callback(&self) -> ObnizResult<()>
Remove callback for this channel
Sourcepub async fn deinit(&self) -> ObnizResult<()>
pub async fn deinit(&self) -> ObnizResult<()>
Deinitialize AD channel
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for AdChannel
impl !UnwindSafe for AdChannel
impl Freeze for AdChannel
impl Send for AdChannel
impl Sync for AdChannel
impl Unpin for AdChannel
impl UnsafeUnpin for AdChannel
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