Changes to Derive(PollVariants) to accept any path for the value type.
This commit is contained in:
@ -8,7 +8,7 @@ readme.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[features]
|
||||
embassy-sync = ["dep:embassy-sync", "ads1256/embassy-sync"]
|
||||
embassy-sync = ["dep:embassy-sync", "ads1256/embassy-sync", "physical-node/embassy-sync"]
|
||||
poll = ["standard-multiplexer", "embassy-sync"]
|
||||
config = ["physical-ads1256-types/config"]
|
||||
standard-input = ["physical-ads1256-types/standard-input"]
|
||||
|
@ -1,11 +1,15 @@
|
||||
use core::ops::DerefMut;
|
||||
use ads1256::{
|
||||
AdControl, Ads1256, BlockingDelay, DataRate, Multiplexer, OutputPin, SpiBus, Status, Wait,
|
||||
};
|
||||
use core::ops::DerefMut;
|
||||
use embassy_sync::blocking_mutex::raw::RawMutex;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use node_poll_variants::PollVariants;
|
||||
use physical_node::transducer::input::Poll;
|
||||
use uom::si::f32;
|
||||
|
||||
#[derive(PollVariants)]
|
||||
#[value_type = "f32::ElectricPotential"]
|
||||
pub struct AutocalPoll<'a, DeviceMutexT, ModInT, DelayerT, SST, DrdyT, SpiT>
|
||||
where
|
||||
DeviceMutexT: RawMutex,
|
||||
@ -30,10 +34,22 @@ where
|
||||
DrdyT: Wait,
|
||||
SpiT: SpiBus,
|
||||
{
|
||||
type Value = ();
|
||||
type Value = f32::ElectricPotential;
|
||||
|
||||
async fn poll(&self) -> Self::Value {
|
||||
todo!()
|
||||
self.ads1256
|
||||
.lock()
|
||||
.await
|
||||
.deref_mut()
|
||||
.autocal_convert_m(
|
||||
self.spi,
|
||||
self.input_mod.multiplexer(),
|
||||
self.input_mod.status(),
|
||||
self.input_mod.ad_control(),
|
||||
self.input_mod.data_rate(),
|
||||
true,
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user