Add wiring pi (for test and doc)
This commit is contained in:
parent
e157a5d02d
commit
53c6fcd917
4 changed files with 12 additions and 0 deletions
BIN
Cargo.lock
generated
BIN
Cargo.lock
generated
Binary file not shown.
|
@ -21,3 +21,4 @@ serde_json = "1.0"
|
|||
serde_derive = "1.0"
|
||||
libsqlite3-sys = { version = "*", features = ["bundled"] }
|
||||
uuid = { version = "0.8", features = ["serde", "v4"] }
|
||||
wiringpi = { git = "https://github.com/jvandervelden/rust-wiringpi.git " }
|
||||
|
|
4
build.rs
Normal file
4
build.rs
Normal file
|
@ -0,0 +1,4 @@
|
|||
fn main() {
|
||||
#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
|
||||
println!("cargo:rustc-link-lib=dylib=wiringPi");
|
||||
}
|
|
@ -8,6 +8,7 @@ extern crate core;
|
|||
use actix_web::{middleware, web, App, HttpServer};
|
||||
use actix_web::middleware::normalize::TrailingSlash;
|
||||
use env_logger::{Builder, Env};
|
||||
use wiringpi::pin::Value::High;
|
||||
|
||||
mod db;
|
||||
mod handlers;
|
||||
|
@ -20,6 +21,12 @@ async fn main() -> std::io::Result<()> {
|
|||
|
||||
Builder::from_env(Env::default().default_filter_or("info")).init();
|
||||
|
||||
let pi = wiringpi::setup();
|
||||
|
||||
//Use WiringPi pin 0 as output
|
||||
let pin = pi.output_pin(0);
|
||||
pin.digital_write(High);
|
||||
|
||||
HttpServer::new(|| {
|
||||
App::new()
|
||||
.wrap(middleware::DefaultHeaders::new()
|
||||
|
|
Loading…
Reference in a new issue