Skip to content

Commit 1a7dec0

Browse files
committed
tms: Print sunflower GPIOs
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 38958ad commit 1a7dec0

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

tms/src/main.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,34 @@ use windows_sys::Win32::{
5656
};
5757

5858
use framework_lib::windows::*;
59+
use framework_lib::smbios::{self, Platform};
60+
use framework_lib::chromium_ec::{CrosEc, EcResult};
61+
62+
fn print_framework12_gpios() -> EcResult<()> {
63+
if let Some(Platform::Framework12) = smbios::get_platform() {
64+
let gpios = [
65+
"chassis_open_l",
66+
"lid_sw_l",
67+
"tablet_mode_l",
68+
];
69+
70+
let ec = CrosEc::new();
71+
println!("GPIO State");
72+
for gpio in gpios {
73+
println!(" {:<25} {}", gpio, ec.get_gpio(gpio)?);
74+
}
75+
}
76+
Ok(())
77+
}
5978

6079
fn main() -> Result<(), Box<dyn Error>> {
6180
let tablet_mode = check_tablet_mode();
6281
println!("Currently in tablet mode: {:?}", tablet_mode);
6382
let touchpad_enable = check_touchpad_enable()?;
6483
println!("Touchpad currently enabled: {:?}", touchpad_enable);
6584

85+
print_framework12_gpios().unwrap();
86+
6687
let args: Vec<_> = env::args().collect();
6788
if args.len() > 1 {
6889
match args[1].as_str() {

0 commit comments

Comments
 (0)