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 1
1
[package ]
2
2
name = " sysfs-pwm"
3
- version = " 0.1.0 "
3
+ version = " 0.1.1 "
4
4
authors = [" Paul Osborne <osbpau@gmail.com>" ]
5
5
license = " MIT/Apache-2.0"
6
6
homepage = " https://github.com/posborne/rust-sysfs-pwm"
Original file line number Diff line number Diff line change @@ -146,6 +146,17 @@ impl Pwm {
146
146
Ok ( ( ) )
147
147
}
148
148
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
+
149
160
/// Get the currently configured duty_cycle in nanoseconds
150
161
pub fn get_duty_cycle_ns ( & self ) -> Result < u32 > {
151
162
pwm_file_parse :: < u32 > ( & self . chip , self . number , "duty_cycle" )
You can’t perform that action at this time.
0 commit comments