Project setup
This commit is contained in:
12
Cargo.toml
12
Cargo.toml
@ -6,6 +6,10 @@ members = [
|
|||||||
# Device types
|
# Device types
|
||||||
"node",
|
"node",
|
||||||
"commander",
|
"commander",
|
||||||
|
# Peripherals
|
||||||
|
"peripherals/standalone-ads1256/*",
|
||||||
|
# Peripheral components
|
||||||
|
"peripheral-components/ads1256/*",
|
||||||
# Examples
|
# Examples
|
||||||
"examples/playground"
|
"examples/playground"
|
||||||
]
|
]
|
||||||
@ -17,7 +21,6 @@ repository = "https://git.bfpower.io/BFPOWER/physical"
|
|||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|
||||||
[workspace.dependencies]
|
|
||||||
#----- no-std ----------------------------------
|
#----- no-std ----------------------------------
|
||||||
# Math
|
# Math
|
||||||
[workspace.dependencies.libm]
|
[workspace.dependencies.libm]
|
||||||
@ -55,6 +58,13 @@ version = "0.7.*"
|
|||||||
[workspace.dependencies.panic-probe]
|
[workspace.dependencies.panic-probe]
|
||||||
version = "0.3.*"
|
version = "0.3.*"
|
||||||
features = ["print-defmt"]
|
features = ["print-defmt"]
|
||||||
|
# BFPOWER Drivers
|
||||||
|
[workspace.dependencies.ads1256-types]
|
||||||
|
git = "https://git.bfpower.io/BFPOWER/bfpower-drivers.git"
|
||||||
|
features = ["defmt"]
|
||||||
|
[workspace.dependencies.ads1256]
|
||||||
|
git = "https://git.bfpower.io/BFPOWER/bfpower-drivers.git"
|
||||||
|
features = ["uom"]
|
||||||
# Embassy
|
# Embassy
|
||||||
[workspace.dependencies.embassy-futures]
|
[workspace.dependencies.embassy-futures]
|
||||||
version = "0.1.*"
|
version = "0.1.*"
|
||||||
|
@ -17,5 +17,3 @@ workspace = true
|
|||||||
workspace = true
|
workspace = true
|
||||||
[dependencies.uom]
|
[dependencies.uom]
|
||||||
workspace = true
|
workspace = true
|
||||||
[dependencies.embassy-sync]
|
|
||||||
workspace = true
|
|
@ -1 +1,4 @@
|
|||||||
mod cell;
|
#![feature(async_fn_in_trait)]
|
||||||
|
|
||||||
|
pub mod cell;
|
||||||
|
mod transducer;
|
2
node/src/transducer/input.rs
Normal file
2
node/src/transducer/input.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub use physical::transducer::input::*;
|
||||||
|
|
15
node/src/transducer/mod.rs
Normal file
15
node/src/transducer/mod.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
mod input;
|
||||||
|
mod output;
|
||||||
|
|
||||||
|
pub use physical::transducer::*;
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
// ----- Publisher ------------------------
|
||||||
|
// ---------------------------------------------------------------------------------------------------------------------
|
||||||
|
#[cfg(feature = "embassy-sync")]
|
||||||
|
pub trait Publisher {
|
||||||
|
type Value: Copy;
|
||||||
|
|
||||||
|
|
||||||
|
fn subscribe() -> SubT;
|
||||||
|
}
|
1
node/src/transducer/output.rs
Normal file
1
node/src/transducer/output.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
pub use physical::transducer::output::*;
|
29
peripheral-components/ads1256/node/Cargo.toml
Normal file
29
peripheral-components/ads1256/node/Cargo.toml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
[package]
|
||||||
|
name = "physical-ads1256"
|
||||||
|
description = "Shared abstractions for ADS1256 components."
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
standard-multiplexer = []
|
||||||
|
|
||||||
|
[dependencies.physical-node]
|
||||||
|
path = "../../../node"
|
||||||
|
[dependencies.physical-ads1256-types]
|
||||||
|
path = "../types"
|
||||||
|
[dependencies.ads1256]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.embedded-hal]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.embedded-hal-async]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.defmt]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.uom]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.embassy-sync]
|
||||||
|
workspace = true
|
||||||
|
optional = true
|
10
peripheral-components/ads1256/node/src/analog_input.rs
Normal file
10
peripheral-components/ads1256/node/src/analog_input.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
struct AnalogInput {}
|
||||||
|
|
||||||
|
// AnalogInputS
|
||||||
|
// AnalogInputI
|
||||||
|
// AnalogInputC
|
||||||
|
// AnalogInputSI
|
||||||
|
// AnalogInputSC
|
||||||
|
// AnalogInputIC
|
||||||
|
// AnalogInputSIC
|
4
peripheral-components/ads1256/node/src/lib.rs
Normal file
4
peripheral-components/ads1256/node/src/lib.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#![no_std]
|
||||||
|
|
||||||
|
#[cfg(feature = "standard-multiplexer")]
|
||||||
|
mod analog_input;
|
17
peripheral-components/ads1256/types/Cargo.toml
Normal file
17
peripheral-components/ads1256/types/Cargo.toml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[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]
|
||||||
|
standard-multiplexer = []
|
||||||
|
|
||||||
|
[dependencies.ads1256-types]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.defmt]
|
||||||
|
workspace = true
|
||||||
|
optional = true
|
1
peripheral-components/ads1256/types/src/lib.rs
Normal file
1
peripheral-components/ads1256/types/src/lib.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
#![no_std]
|
25
peripherals/standalone-ads1256/node/Cargo.toml
Normal file
25
peripherals/standalone-ads1256/node/Cargo.toml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
[package]
|
||||||
|
name = "physical-standalone-ads1256"
|
||||||
|
description = "Support for dedicated ADS1256 boards (i.e. boards that have no other functionality other than to expose the ADS1256)"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
|
||||||
|
[dependencies.physical-node]
|
||||||
|
path = "../../../node"
|
||||||
|
[dependencies.physical-standalone-ads1256-types]
|
||||||
|
path = "../types"
|
||||||
|
[dependencies.physical-ads1256]
|
||||||
|
path = "../../../peripheral-components/ads1256/node"
|
||||||
|
[dependencies.ads1256]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.embedded-hal]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.embedded-hal-async]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.defmt]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.uom]
|
||||||
|
workspace = true
|
1
peripherals/standalone-ads1256/node/src/lib.rs
Normal file
1
peripherals/standalone-ads1256/node/src/lib.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
#![no_std]
|
13
peripherals/standalone-ads1256/types/Cargo.toml
Normal file
13
peripherals/standalone-ads1256/types/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[package]
|
||||||
|
name = "physical-standalone-ads1256-types"
|
||||||
|
description = "Support for dedicated ADS1256 boards (i.e. boards that have no other functionality other than to expose the ADS1256)"
|
||||||
|
version.workspace = true
|
||||||
|
edition.workspace = true
|
||||||
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
license.workspace = true
|
||||||
|
|
||||||
|
[dependencies.ads1256-types]
|
||||||
|
workspace = true
|
||||||
|
[dependencies.physical-ads1256-types]
|
||||||
|
path = "../../../peripheral-components/ads1256/types"
|
1
peripherals/standalone-ads1256/types/src/lib.rs
Normal file
1
peripherals/standalone-ads1256/types/src/lib.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
#![no_std]
|
@ -1,2 +1,3 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
|
|
||||||
|
pub mod transducer;
|
0
src/transducer/input.rs
Normal file
0
src/transducer/input.rs
Normal file
10
src/transducer/mod.rs
Normal file
10
src/transducer/mod.rs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
pub mod input;
|
||||||
|
pub mod output;
|
||||||
|
|
||||||
|
// Initialisation will always be async and won't complete until a state is available for all
|
||||||
|
// stateful transducers.
|
||||||
|
pub trait Stateful {
|
||||||
|
type Value: Copy;
|
||||||
|
|
||||||
|
fn state() -> Self::Value;
|
||||||
|
}
|
7
src/transducer/output.rs
Normal file
7
src/transducer/output.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
pub trait Output {
|
||||||
|
type Value: Copy;
|
||||||
|
|
||||||
|
//TODO: return result
|
||||||
|
//TODO: Make maybe async
|
||||||
|
fn set(setting: Self::Value);
|
||||||
|
}
|
Reference in New Issue
Block a user