From 3489b66ed694159f4d2e00d5a0f4681457e4c96b Mon Sep 17 00:00:00 2001 From: Zack Date: Mon, 16 Jan 2023 19:04:11 -0800 Subject: [PATCH] Structure --- Cargo.toml | 4 ++++ README.md | 9 +++++++++ examples/playground/Cargo.toml | 7 +------ master/Cargo.toml | 13 +++++++++++++ master/src/lib.rs | 14 ++++++++++++++ node/Cargo.toml | 13 +++++++++++++ node/src/lib.rs | 14 ++++++++++++++ 7 files changed, 68 insertions(+), 6 deletions(-) create mode 100644 master/Cargo.toml create mode 100644 master/src/lib.rs create mode 100644 node/Cargo.toml create mode 100644 node/src/lib.rs diff --git a/Cargo.toml b/Cargo.toml index 1052d89..cd882f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,9 @@ [workspace] members = [ + # Device types + "node", + "master", + # Examples "examples/playground" ] diff --git a/README.md b/README.md index 99cf7ab..85099d5 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file diff --git a/examples/playground/Cargo.toml b/examples/playground/Cargo.toml index 8f5c298..33f173c 100644 --- a/examples/playground/Cargo.toml +++ b/examples/playground/Cargo.toml @@ -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 \ No newline at end of file +physical = { path = "../.." } \ No newline at end of file diff --git a/master/Cargo.toml b/master/Cargo.toml new file mode 100644 index 0000000..7341c5d --- /dev/null +++ b/master/Cargo.toml @@ -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 = ".." } \ No newline at end of file diff --git a/master/src/lib.rs b/master/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/master/src/lib.rs @@ -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); + } +} diff --git a/node/Cargo.toml b/node/Cargo.toml new file mode 100644 index 0000000..6bbbb9e --- /dev/null +++ b/node/Cargo.toml @@ -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 = ".." } \ No newline at end of file diff --git a/node/src/lib.rs b/node/src/lib.rs new file mode 100644 index 0000000..7d12d9a --- /dev/null +++ b/node/src/lib.rs @@ -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); + } +}