Cleanup
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "physical-ads1256"
|
||||
description = "Shared abstractions for ADS1256 components."
|
||||
description = "Shared node abstractions for ADS1256 components."
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
@ -10,17 +10,12 @@ license.workspace = true
|
||||
[features]
|
||||
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"]
|
||||
standard-multiplexer = ["standard-input"]
|
||||
standard-multiplexer = []
|
||||
|
||||
[dependencies.physical-node]
|
||||
path = "../../../node"
|
||||
[dependencies.node-poll-variants]
|
||||
path = "../../../macros/node-poll-variants"
|
||||
[dependencies.physical-ads1256-types]
|
||||
path = "../types"
|
||||
features = ["defmt"]
|
||||
[dependencies.ads1256]
|
||||
workspace = true
|
||||
[dependencies.embedded-hal]
|
||||
|
@ -1,9 +1,4 @@
|
||||
#![no_std]
|
||||
#![feature(async_fn_in_trait, impl_trait_projections)]
|
||||
|
||||
#[cfg(feature = "standard-multiplexer")]
|
||||
mod standard_multiplexer;
|
||||
#[cfg(feature = "poll")]
|
||||
mod poll;
|
||||
|
||||
pub use physical_ads1256_types::*;
|
||||
pub mod standard;
|
2
peripheral-components/ads1256/node/src/standard/mod.rs
Normal file
2
peripheral-components/ads1256/node/src/standard/mod.rs
Normal file
@ -0,0 +1,2 @@
|
||||
#[cfg(feature = "standard-input")]
|
||||
pub mod multiplexer;
|
@ -38,11 +38,10 @@ where
|
||||
type Value = f32::ElectricPotential;
|
||||
|
||||
async fn poll(&self) -> Result<Self::Value, CriticalError> {
|
||||
let result = self
|
||||
.ads1256
|
||||
.lock()
|
||||
.await
|
||||
.deref_mut()
|
||||
let mut ads1256_guard = self.ads1256.lock().await;
|
||||
let ads1256 = ads1256_guard.deref_mut();
|
||||
|
||||
let result = ads1256
|
||||
.autocal_convert_m(
|
||||
self.spi,
|
||||
self.input_mod.multiplexer(),
|
@ -1,18 +0,0 @@
|
||||
[package]
|
||||
name = "physical-ads1256-types"
|
||||
description = "ADS1256 Physical types."
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
repository.workspace = true
|
||||
readme.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[features]
|
||||
config = []
|
||||
standard-input = []
|
||||
|
||||
[dependencies.ads1256-types]
|
||||
workspace = true
|
||||
[dependencies.defmt]
|
||||
workspace = true
|
||||
optional = true
|
@ -1,2 +0,0 @@
|
||||
use ads1256_types::{Buffer, Config, DataRate, Gain};
|
||||
|
@ -1,11 +0,0 @@
|
||||
#![no_std]
|
||||
|
||||
#[cfg(feature = "standard-input")]
|
||||
pub mod standard_input;
|
||||
#[cfg(feature = "config")]
|
||||
mod config;
|
||||
|
||||
#[cfg(feature = "config")]
|
||||
pub use config::*;
|
||||
#[cfg(feature = "standard-input")]
|
||||
pub use standard_input::*;
|
@ -1,39 +0,0 @@
|
||||
use ads1256_types::{Buffer, Config, DataRate, Gain, Multiplexer, MuxInput};
|
||||
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum Differential {
|
||||
AIn0 = Multiplexer::setting(MuxInput::AIn0, MuxInput::AIn1).0,
|
||||
AIn1 = Multiplexer::setting(MuxInput::AIn2, MuxInput::AIn3).0,
|
||||
AIn2 = Multiplexer::setting(MuxInput::AIn4, MuxInput::AIn5).0,
|
||||
AIn3 = Multiplexer::setting(MuxInput::AIn6, MuxInput::AIn7).0,
|
||||
}
|
||||
|
||||
impl Into<Multiplexer> for Differential {
|
||||
#[inline(always)]
|
||||
fn into(self) -> Multiplexer {
|
||||
Multiplexer(self as u8)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||
#[repr(u8)]
|
||||
pub enum SingleEnded {
|
||||
AIn0 = Multiplexer::setting(MuxInput::AIn0, MuxInput::Common).0,
|
||||
AIn1 = Multiplexer::setting(MuxInput::AIn1, MuxInput::Common).0,
|
||||
AIn2 = Multiplexer::setting(MuxInput::AIn2, MuxInput::Common).0,
|
||||
AIn3 = Multiplexer::setting(MuxInput::AIn3, MuxInput::Common).0,
|
||||
AIn4 = Multiplexer::setting(MuxInput::AIn4, MuxInput::Common).0,
|
||||
AIn5 = Multiplexer::setting(MuxInput::AIn5, MuxInput::Common).0,
|
||||
AIn6 = Multiplexer::setting(MuxInput::AIn6, MuxInput::Common).0,
|
||||
AIn7 = Multiplexer::setting(MuxInput::AIn7, MuxInput::Common).0,
|
||||
}
|
||||
|
||||
impl Into<Multiplexer> for SingleEnded {
|
||||
#[inline(always)]
|
||||
fn into(self) -> Multiplexer {
|
||||
Multiplexer(self as u8)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user