Skip to content

Commit 51596c6

Browse files
committed
Merge pull request #2 from rust-embedded/core-internals
Core internals
2 parents 199820e + df5dae1 commit 51596c6

File tree

10 files changed

+562
-14
lines changed

10 files changed

+562
-14
lines changed

Cargo.lock

Lines changed: 68 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ version = "0.1.0"
44
authors = ["Paul Osborne <[email protected]>"]
55

66
[dependencies]
7-
sysfs_gpio = "0.4"
87
clap = "2.2"
8+
rustc-serialize = "0.3"
9+
sysfs_gpio = "0.4"
910
toml = "0.1"
11+
glob = "0.2"
12+
log = "0.3"
13+
env_logger = "0.3"
1014

1115
[[bin]]
1216
name = "gpio"

src/commands/gpio_exportall.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (C) 2016, Paul Osborne <[email protected]>
2+
3+
use options::{GpioExportAllOptions};
4+
use config::GpioConfig;
5+
use std::process::exit;
6+
7+
pub fn main(opts: &GpioExportAllOptions) {
8+
let config = match GpioConfig::load(&opts.gpio_opts.configs[..]) {
9+
Ok(config) => config,
10+
Err(e) => {
11+
println!("Error: {:?}", e);
12+
exit(1);
13+
}
14+
};
15+
16+
for pin in config.pins {
17+
println!("{:?}", pin);
18+
}
19+
}

src/commands/gpio_read.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (C) 2016, Paul Osborne <[email protected]>
2+
3+
use options::{GpioReadOptions};
4+
use config::GpioConfig;
5+
use std::process::exit;
6+
7+
pub fn main(opts: &GpioReadOptions) {
8+
let config = match GpioConfig::load(&opts.gpio_opts.configs[..]) {
9+
Ok(config) => config,
10+
Err(e) => {
11+
println!("Error: {:?}", e);
12+
exit(1);
13+
}
14+
};
15+
16+
println!("config: {:?}", config);
17+
}

src/commands/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Copyright (C) 2016, Paul Osborne <[email protected]>
2+
3+
pub mod gpio_read;
4+
pub mod gpio_exportall;

0 commit comments

Comments
 (0)