Skip to content

Commit 0b95d0a

Browse files
authored
Merge pull request #536 from Dirbaio/pwm-no-get
pwm: rename `get_max_duty_cycle` to `max_duty_cycle`.
2 parents 9e939bb + 2af28b4 commit 0b95d0a

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

embedded-hal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
- Minor document fixes.
1111
- Add #[inline] hints to most of `embedded-hal` functions.
12+
- pwm: rename `get_max_duty_cycle` to `max_duty_cycle`.
1213

1314
## [v1.0.0-rc.1] - 2023-08-15
1415

embedded-hal/src/pwm.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ pub trait SetDutyCycle: ErrorType {
6969
/// Get the maximum duty cycle value.
7070
///
7171
/// This value corresponds to a 100% duty cycle.
72-
fn get_max_duty_cycle(&self) -> u16;
72+
fn max_duty_cycle(&self) -> u16;
7373

7474
/// Set the duty cycle to `duty / max_duty`.
7575
///
@@ -86,7 +86,7 @@ pub trait SetDutyCycle: ErrorType {
8686
/// Set the duty cycle to 100%, or always active.
8787
#[inline]
8888
fn set_duty_cycle_fully_on(&mut self) -> Result<(), Self::Error> {
89-
self.set_duty_cycle(self.get_max_duty_cycle())
89+
self.set_duty_cycle(self.max_duty_cycle())
9090
}
9191

9292
/// Set the duty cycle to `num / denom`.
@@ -97,9 +97,9 @@ pub trait SetDutyCycle: ErrorType {
9797
fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) -> Result<(), Self::Error> {
9898
debug_assert!(denom != 0);
9999
debug_assert!(num <= denom);
100-
let duty = u32::from(num) * u32::from(self.get_max_duty_cycle()) / u32::from(denom);
100+
let duty = u32::from(num) * u32::from(self.max_duty_cycle()) / u32::from(denom);
101101

102-
// This is safe because we know that `num <= denom`, so `duty <= self.get_max_duty_cycle()` (u16)
102+
// This is safe because we know that `num <= denom`, so `duty <= self.max_duty_cycle()` (u16)
103103
#[allow(clippy::cast_possible_truncation)]
104104
{
105105
self.set_duty_cycle(duty as u16)
@@ -117,8 +117,8 @@ pub trait SetDutyCycle: ErrorType {
117117

118118
impl<T: SetDutyCycle + ?Sized> SetDutyCycle for &mut T {
119119
#[inline]
120-
fn get_max_duty_cycle(&self) -> u16 {
121-
T::get_max_duty_cycle(self)
120+
fn max_duty_cycle(&self) -> u16 {
121+
T::max_duty_cycle(self)
122122
}
123123

124124
#[inline]

0 commit comments

Comments
 (0)