Initial node implementation #4

Merged
zack merged 51 commits from develop into master 2023-07-19 18:09:13 +00:00
9 changed files with 124 additions and 45 deletions
Showing only changes of commit 3489b66ed6 - Show all commits

View File

@ -1,5 +1,9 @@
[workspace]
members = [
# Device types
"node",
"master",
# Examples
"examples/playground"
]

View File

@ -4,3 +4,12 @@ Physical is a library for interacting with the physical world from a computer. T
* Collecting and digitizing data from the physical world.
* Controlling devices that take physical action.
## Concepts
The main concepts of Physical are:
* Peripheral: A peripheral is a board that hosts physical I/O and usually does analog to digital conversion or
digital to analog conversion. A peripheral cannot function on its own, it must be connected to a node. This is more
narrow than the
definition of a peripheral in embedded systems generally.
* Node: A node hosts peripherals. A node can have a master but does not need one.
* Master: A master hosts nodes. It is possible for a device to be both a node and a master at the same time.

View File

@ -10,9 +10,4 @@ readme.workspace = true
license.workspace = true
[dependencies]
thiserror.workspace = true
uom.workspace = true
log.workspace = true
env_logger.workspace = true
futures-lite.workspace = true
async-io.workspace = true
physical = { path = "../.." }

13
master/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "physical-master"
description = "A master hosts nodes."
version.workspace = true
edition.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
physical = { path = ".." }

14
master/src/lib.rs Normal file
View File

@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}

13
node/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "physical-node"
description = "A node hosts peripherals."
version.workspace = true
edition.workspace = true
repository.workspace = true
readme.workspace = true
license.workspace = true
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
physical = { path = ".." }

14
node/src/lib.rs Normal file
View File

@ -0,0 +1,14 @@
pub fn add(left: usize, right: usize) -> usize {
left + right
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}