Add build target for RPi which will access the GPIOs if build-option --fetaure "rppal" is passed.
This commit is contained in:
parent
95f2611049
commit
66d7958392
4 changed files with 61 additions and 2 deletions
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[target.armv7-unknown-linux-musleabihf]
|
||||||
|
linker = "/usr/local/Cellar/arm-linux-gnueabihf-binutils/2.36.1/bin/arm-linux-gnueabihf-ld"
|
||||||
45
Cargo.lock
generated
45
Cargo.lock
generated
|
|
@ -617,6 +617,16 @@ version = "1.0.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
|
checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "embedded-hal"
|
||||||
|
version = "0.2.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "fa998ce59ec9765d15216393af37a58961ddcefb14c753b4816ba2191d865fcb"
|
||||||
|
dependencies = [
|
||||||
|
"nb 0.1.3",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "event-listener"
|
name = "event-listener"
|
||||||
version = "2.5.1"
|
version = "2.5.1"
|
||||||
|
|
@ -999,6 +1009,21 @@ dependencies = [
|
||||||
"serde_json",
|
"serde_json",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nb"
|
||||||
|
version = "0.1.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "801d31da0513b6ec5214e9bf433a77966320625a37860f910be265be6e18d06f"
|
||||||
|
dependencies = [
|
||||||
|
"nb 1.0.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "nb"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "546c37ac5d9e56f55e73b677106873d9d9f5190605e41a856503623648488cae"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nb-connect"
|
name = "nb-connect"
|
||||||
version = "1.0.3"
|
version = "1.0.3"
|
||||||
|
|
@ -1234,6 +1259,19 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "56770675ebc04927ded3e60633437841581c285dc6236109ea25fbf3beb7b59e"
|
checksum = "56770675ebc04927ded3e60633437841581c285dc6236109ea25fbf3beb7b59e"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rppal"
|
||||||
|
version = "0.11.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "137dbba1fb867daa27cda4c3cd6a11bca5bb5a1551f034cf9319b994846ddbe1"
|
||||||
|
dependencies = [
|
||||||
|
"embedded-hal",
|
||||||
|
"lazy_static",
|
||||||
|
"libc",
|
||||||
|
"nb 0.1.3",
|
||||||
|
"void",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
|
|
@ -1264,6 +1302,7 @@ dependencies = [
|
||||||
"function_name",
|
"function_name",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"minreq",
|
"minreq",
|
||||||
|
"rppal",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"tide",
|
"tide",
|
||||||
|
|
@ -1732,6 +1771,12 @@ version = "0.9.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "void"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "waker-fn"
|
name = "waker-fn"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,7 @@ serde_derive = "1.0"
|
||||||
function_name = "0.2"
|
function_name = "0.2"
|
||||||
tide = "0.16"
|
tide = "0.16"
|
||||||
|
|
||||||
|
rppal = { version = "0.11.3", features = ["hal"], optional = true }
|
||||||
|
|
||||||
lazy_static = "1.4"
|
lazy_static = "1.4"
|
||||||
minreq = { version = "2.3", features = ["json-using-serde"] }
|
minreq = { version = "2.3", features = ["json-using-serde"] }
|
||||||
|
|
|
||||||
14
src/main.rs
14
src/main.rs
|
|
@ -1,13 +1,15 @@
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate clap;
|
extern crate clap;
|
||||||
|
|
||||||
use async_std::task;
|
|
||||||
|
|
||||||
mod cfg_reader;
|
mod cfg_reader;
|
||||||
mod pulse_counter;
|
mod pulse_counter;
|
||||||
mod rest_api;
|
mod rest_api;
|
||||||
|
|
||||||
|
use async_std;
|
||||||
|
use async_std::task;
|
||||||
|
|
||||||
const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
const APP_VERSION: &'static str = env!("CARGO_PKG_VERSION");
|
||||||
|
|
||||||
const DEFAULT_CONFIG_FILE_NAME: &str = "/etc/s0_logger.cfg";
|
const DEFAULT_CONFIG_FILE_NAME: &str = "/etc/s0_logger.cfg";
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
@ -32,6 +34,14 @@ fn main() {
|
||||||
.unwrap_or(DEFAULT_CONFIG_FILE_NAME);
|
.unwrap_or(DEFAULT_CONFIG_FILE_NAME);
|
||||||
println!("Read the config from file '{}'", config_file_name);
|
println!("Read the config from file '{}'", config_file_name);
|
||||||
|
|
||||||
|
if cfg!(feature = "rppal") {
|
||||||
|
println!("Will access GPIO pins");
|
||||||
|
} else if cfg!(feature = "hal") {
|
||||||
|
println!("Will access HAL");
|
||||||
|
} else {
|
||||||
|
println!("Will NOT access GPIO pins");
|
||||||
|
}
|
||||||
|
|
||||||
let rest_api_config = rest_api::RestApiConfig {
|
let rest_api_config = rest_api::RestApiConfig {
|
||||||
ip_and_port: String::from("127.0.0.1:8080"),
|
ip_and_port: String::from("127.0.0.1:8080"),
|
||||||
get_channels: fake_get_channels,
|
get_channels: fake_get_channels,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue