53 lines
1.7 KiB
Rust
53 lines
1.7 KiB
Rust
#![no_std]
|
|
|
|
mod adc;
|
|
mod delay;
|
|
mod io;
|
|
#[cfg(feature = "embassy-sync")]
|
|
mod mutex;
|
|
|
|
pub use crate::adc::*;
|
|
pub use crate::delay::*;
|
|
pub use crate::io::*;
|
|
#[cfg(feature = "embassy-sync")]
|
|
pub use crate::mutex::*;
|
|
pub use ads1256_types::adcon::{ClockOut, Gain, Sdcs};
|
|
pub use ads1256_types::drate::DataRate;
|
|
pub use ads1256_types::gpio::{DState, DioDirection};
|
|
pub use ads1256_types::mux::MuxInput;
|
|
pub use ads1256_types::status::{AutoCal, BitOrder, Buffer};
|
|
pub use ads1256_types::*;
|
|
|
|
pub use embedded_hal::digital::OutputPin;
|
|
pub use embedded_hal::spi::SpiBus;
|
|
pub use embedded_hal_async::digital::Wait;
|
|
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
// ----- Ads1256 ------------------------
|
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
/// **WARNING:** All [Ads1256] methods only ever wait in the middle of a multi-command method, in
|
|
/// some cases you may need to use [BlockingDelay::t11_1_delay] or [BlockingDelay::t11_2_delay]
|
|
/// between methods that issue commands if they are done one immediately following the other.
|
|
pub struct Ads1256<DelayerT, SST, DrdyT> {
|
|
pub delayer: DelayerT,
|
|
slave_select: SST,
|
|
pub data_ready: DrdyT,
|
|
}
|
|
|
|
impl<DelayerT, SST, DrdyT> Ads1256<DelayerT, SST, DrdyT>
|
|
where
|
|
DelayerT: BlockingDelay,
|
|
SST: OutputPin,
|
|
DrdyT: Wait,
|
|
{
|
|
//----- New ----------------------------------
|
|
#[inline(always)]
|
|
pub fn new(delayer: DelayerT, slave_select: SST, data_ready: DrdyT) -> Self {
|
|
Self {
|
|
delayer,
|
|
slave_select,
|
|
data_ready,
|
|
}
|
|
}
|
|
}
|