Skip to content

Commit

Permalink
src: lib: pwm: Optimize using a single call for both ON and OFF channels
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulTrombin authored and patrickelectric committed Feb 28, 2024
1 parent 144640c commit 27c504c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/lib.rs
Expand Up @@ -477,8 +477,9 @@ impl Navigator {
warn!("Invalid value. Value must be less than or equal {max_value}.");
value = max_value;
}
self.pwm.set_channel_on(channel.into(), 0).unwrap();
self.pwm.set_channel_off(channel.into(), value).unwrap();
self.pwm
.set_channel_on_off(channel.into(), 0, value)
.unwrap();
}

/// Calculate and set the necessary values for the desired Duty Cycle (high value time) of selected channel.
Expand Down

0 comments on commit 27c504c

Please sign in to comment.