We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c3c0d3e commit 5ddc317Copy full SHA for 5ddc317
src/lib.rs
@@ -158,6 +158,17 @@ impl Pwm {
158
Ok(())
159
}
160
161
+ /// Query the state of enable for a given PWM pin
162
+ pub fn get_enabled(&self) -> Result<bool> {
163
+ pwm_file_parse::<u32>(&self.chip, self.number, "enable").map(|enable_state| {
164
+ match enable_state {
165
+ 1 => true,
166
+ 0 => false,
167
+ _ => panic!("enable != 1|0 should be unreachable")
168
+ }
169
+ })
170
171
+
172
/// Get the currently configured duty_cycle in nanoseconds
173
pub fn get_duty_cycle_ns(&self) -> Result<u32> {
174
pwm_file_parse::<u32>(&self.chip, self.number, "duty_cycle")
0 commit comments