Skip to content

Commit

Permalink
add gpio crate
Browse files Browse the repository at this point in the history
  • Loading branch information
enkerewpo committed Aug 9, 2024
1 parent 430da46 commit deae75e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions rasynth/src/board.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::error::Error;
use std::thread;
use std::time::Duration;

use rppal::gpio::Gpio;
use rppal::system::DeviceInfo;

const GPIO_LED: u8 = 23; // PIN16

#[test]
fn test_gpio() -> Result<(), Box<dyn Error>> {
println!("Blinking an LED on a {}.", DeviceInfo::new()?.model());
let mut pin = Gpio::new()?.get(GPIO_LED)?.into_output();
pin.set_high();
thread::sleep(Duration::from_millis(500));
pin.set_low();
Ok(())
}
1 change: 1 addition & 0 deletions rasynth/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use std::fs;
pub mod ast;
pub mod graph;
pub mod symbol_table;
pub mod board;

lalrpop_mod!(pub raslisp); // synthesized by LALRPOP

Expand Down

0 comments on commit deae75e

Please sign in to comment.