Structure

This commit is contained in:
2023-01-16 19:04:11 -08:00
parent d968b34702
commit 3489b66ed6
7 changed files with 68 additions and 6 deletions

View File

@ -1,5 +1,9 @@
[workspace] [workspace]
members = [ members = [
# Device types
"node",
"master",
# Examples
"examples/playground" "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. * Collecting and digitizing data from the physical world.
* Controlling devices that take physical action. * 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 license.workspace = true
[dependencies] [dependencies]
thiserror.workspace = true physical = { path = "../.." }
uom.workspace = true
log.workspace = true
env_logger.workspace = true
futures-lite.workspace = true
async-io.workspace = true

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);
}
}