pub mod adc;
pub mod arm;
pub mod battery;
pub mod ble;
pub mod blufi;
pub mod dac;
pub mod debug;
pub mod eload;
pub mod energy;
pub mod gpio;
pub mod i2c;
pub mod router;
pub mod scope;
pub mod solar;
pub mod spi;
pub mod supply;
pub mod thermocouple;
#[cfg(feature = "uart")]
pub mod uart;
pub mod usb;
pub mod watt;
pub mod webcam;
pub mod wifi;
macro_rules! net_handle {
(
$(#[$doc:meta])*
sync: $Sync:ident,
async: $Async:ident,
methods: {
$(
$(#[$mdoc:meta])*
fn $method:ident ( $( $arg:ident : $ty:ty ),* $(,)? ) -> $ret:ty = $op:path;
)*
}
) => {
$(#[$doc])*
#[cfg(feature = "blocking")]
#[derive(Clone)]
pub struct $Sync<'a> {
pub(crate) client: &'a $crate::client::LagerBox,
pub(crate) name: String,
}
#[cfg(feature = "blocking")]
impl<'a> $Sync<'a> {
pub fn name(&self) -> &str {
&self.name
}
$(
$(#[$mdoc])*
pub fn $method(&self, $($arg: $ty),*) -> $crate::error::Result<$ret> {
self.client.run($op(&self.name, $($arg),*))
}
)*
}
$(#[$doc])*
#[cfg(feature = "async")]
#[derive(Clone)]
pub struct $Async<'a> {
pub(crate) client: &'a $crate::async_client::AsyncLagerBox,
pub(crate) name: String,
}
#[cfg(feature = "async")]
impl<'a> $Async<'a> {
pub fn name(&self) -> &str {
&self.name
}
$(
$(#[$mdoc])*
pub async fn $method(&self, $($arg: $ty),*) -> $crate::error::Result<$ret> {
self.client.run($op(&self.name, $($arg),*)).await
}
)*
}
};
}
pub(crate) use net_handle;
macro_rules! box_handle {
(
$(#[$doc:meta])*
sync: $Sync:ident,
async: $Async:ident,
methods: {
$(
$(#[$mdoc:meta])*
fn $method:ident ( $( $arg:ident : $ty:ty ),* $(,)? ) -> $ret:ty = $op:path;
)*
}
) => {
$(#[$doc])*
#[cfg(feature = "blocking")]
#[derive(Clone)]
pub struct $Sync<'a> {
pub(crate) client: &'a $crate::client::LagerBox,
}
#[cfg(feature = "blocking")]
impl<'a> $Sync<'a> {
$(
$(#[$mdoc])*
pub fn $method(&self, $($arg: $ty),*) -> $crate::error::Result<$ret> {
self.client.run($op($($arg),*))
}
)*
}
$(#[$doc])*
#[cfg(feature = "async")]
#[derive(Clone)]
pub struct $Async<'a> {
pub(crate) client: &'a $crate::async_client::AsyncLagerBox,
}
#[cfg(feature = "async")]
impl<'a> $Async<'a> {
$(
$(#[$mdoc])*
pub async fn $method(&self, $($arg: $ty),*) -> $crate::error::Result<$ret> {
self.client.run($op($($arg),*)).await
}
)*
}
};
}
pub(crate) use box_handle;