File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " sysfs-pwm"
3- version = " 0.1.0 "
3+ version = " 0.1.1 "
44authors = [" Paul Osborne <osbpau@gmail.com>" ]
55license = " MIT/Apache-2.0"
66homepage = " https://github.com/posborne/rust-sysfs-pwm"
Original file line number Diff line number Diff line change @@ -146,6 +146,17 @@ impl Pwm {
146146 Ok ( ( ) )
147147 }
148148
149+ /// Query the state of enable for a given PWM pin
150+ pub fn get_enabled ( & self ) -> Result < bool > {
151+ pwm_file_parse :: < u32 > ( & self . chip , self . number , "enable" ) . map ( |enable_state| {
152+ match enable_state {
153+ 1 => true ,
154+ 0 => false ,
155+ _ => panic ! ( "enable != 1|0 should be unreachable" )
156+ }
157+ } )
158+ }
159+
149160 /// Get the currently configured duty_cycle in nanoseconds
150161 pub fn get_duty_cycle_ns ( & self ) -> Result < u32 > {
151162 pwm_file_parse :: < u32 > ( & self . chip , self . number , "duty_cycle" )
You can’t perform that action at this time.
0 commit comments