Initial node implementation #4

Merged
zack merged 51 commits from develop into master 2023-07-19 18:09:13 +00:00
27 changed files with 418 additions and 44 deletions
Showing only changes of commit 19b8bc607c - Show all commits

View File

@ -16,4 +16,7 @@ workspace = true
[dependencies.defmt]
workspace = true
[dependencies.uom]
workspace = true
workspace = true
[dependencies.embassy-sync]
workspace = true
optional = true

View File

@ -3,13 +3,25 @@ mod output;
pub use physical::transducer::*;
// ---------------------------------------------------------------------------------------------------------------------
// ----- Publisher ------------------------
// ---------------------------------------------------------------------------------------------------------------------
#[cfg(feature = "embassy-sync")]
use embassy_sync::blocking_mutex::raw::RawMutex;
#[cfg(feature = "embassy-sync")]
use embassy_sync::pubsub;
#[cfg(feature = "embassy-sync")]
use embassy_sync::pubsub::Subscriber;
#[cfg(feature = "embassy-sync")]
pub trait Publisher {
type Value: Copy;
type Mutex: RawMutex;
const CAPACITY: usize;
const NUM_SUBS: usize;
const NUM_PUBS: usize;
fn subscribe() -> SubT;
}
fn subscribe(
&self,
) -> Result<
Subscriber<Self::Mutex, Self::Value, Self::CAPACITY, Self::NUM_SUBS, Self::NUM_PUBS>,
pubsub::Error,
>;
}

View File

@ -23,7 +23,4 @@ workspace = true
[dependencies.defmt]
workspace = true
[dependencies.uom]
workspace = true
[dependencies.embassy-sync]
workspace = true
optional = true
workspace = true

View File

@ -6,5 +6,5 @@ pub mod output;
pub trait Stateful {
type Value: Copy;
fn state() -> Self::Value;
fn state(&self) -> Self::Value;
}

View File

@ -3,5 +3,5 @@ pub trait Output {
//TODO: return result
//TODO: Make maybe async
fn set(setting: Self::Value);
fn set(&mut self, setting: Self::Value);
}