Add wiring pi (for test and doc)
This commit is contained in:
		
							parent
							
								
									e157a5d02d
								
							
						
					
					
						commit
						53c6fcd917
					
				
					 4 changed files with 29 additions and 0 deletions
				
			
		
							
								
								
									
										17
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										17
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							| 
						 | 
				
			
			@ -577,6 +577,7 @@ dependencies = [
 | 
			
		|||
 "serde_derive",
 | 
			
		||||
 "serde_json",
 | 
			
		||||
 "uuid 0.8.2",
 | 
			
		||||
 "wiringpi",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
| 
						 | 
				
			
			@ -780,6 +781,12 @@ dependencies = [
 | 
			
		|||
 "wasi 0.10.2+wasi-snapshot-preview1",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "glob"
 | 
			
		||||
version = "0.2.11"
 | 
			
		||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
			
		||||
checksum = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "h2"
 | 
			
		||||
version = "0.2.7"
 | 
			
		||||
| 
						 | 
				
			
			@ -1990,6 +1997,16 @@ dependencies = [
 | 
			
		|||
 "winapi 0.3.9",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "wiringpi"
 | 
			
		||||
version = "0.2.4"
 | 
			
		||||
source = "git+https://github.com/jvandervelden/rust-wiringpi.git#76aa122c2743c96b1bb2db05873000db0bb19544"
 | 
			
		||||
dependencies = [
 | 
			
		||||
 "cc",
 | 
			
		||||
 "glob",
 | 
			
		||||
 "libc",
 | 
			
		||||
]
 | 
			
		||||
 | 
			
		||||
[[package]]
 | 
			
		||||
name = "ws2_32-sys"
 | 
			
		||||
version = "0.2.1"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue