Created multiplexing publish / subscribe example.
This commit is contained in:
@ -8,12 +8,15 @@ readme.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[features]
|
||||
standard-multiplexer = []
|
||||
config = ["physical-ads1256-types/config"]
|
||||
standard-input = ["physical-ads1256-types/standard-input"]
|
||||
standard-multiplexer = ["standard-input"]
|
||||
|
||||
[dependencies.physical-node]
|
||||
path = "../../../node"
|
||||
[dependencies.physical-ads1256-types]
|
||||
path = "../types"
|
||||
features = ["defmt"]
|
||||
[dependencies.ads1256]
|
||||
workspace = true
|
||||
[dependencies.embedded-hal]
|
||||
|
@ -1,10 +0,0 @@
|
||||
|
||||
struct AnalogInput {}
|
||||
|
||||
// AnalogInputS
|
||||
// AnalogInputI
|
||||
// AnalogInputC
|
||||
// AnalogInputSI
|
||||
// AnalogInputSC
|
||||
// AnalogInputIC
|
||||
// AnalogInputSIC
|
@ -1,4 +1,6 @@
|
||||
#![no_std]
|
||||
|
||||
#[cfg(feature = "standard-multiplexer")]
|
||||
mod analog_input;
|
||||
mod standard_multiplexer;
|
||||
|
||||
pub use physical_ads1256_types::*;
|
@ -8,7 +8,8 @@ readme.workspace = true
|
||||
license.workspace = true
|
||||
|
||||
[features]
|
||||
standard-multiplexer = []
|
||||
config = []
|
||||
standard-input = []
|
||||
|
||||
[dependencies.ads1256-types]
|
||||
workspace = true
|
||||
|
2
peripheral-components/ads1256/types/src/config.rs
Normal file
2
peripheral-components/ads1256/types/src/config.rs
Normal file
@ -0,0 +1,2 @@
|
||||
use ads1256_types::{Buffer, Config, DataRate, Gain};
|
||||
|
@ -1 +1,11 @@
|
||||
#![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::*;
|
||||
|
39
peripheral-components/ads1256/types/src/standard_input.rs
Normal file
39
peripheral-components/ads1256/types/src/standard_input.rs
Normal file
@ -0,0 +1,39 @@
|
||||
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