diff options
| author | Bruno Bousquet <[email protected]> | 2024-05-29 09:58:46 -0400 |
|---|---|---|
| committer | Bruno Bousquet <[email protected]> | 2024-05-29 09:59:00 -0400 |
| commit | 292c1dd0b858fe8dde74edd2f60a96f4c9e588da (patch) | |
| tree | 734d657ac01dcf470be8ca00fcdd7f5be2b4d08b /embassy-stm32/src/timer/pwm_input.rs | |
| parent | a23fa8dcb2e22ed2d8bac15fd875dfe53af43eda (diff) | |
rename get_width_ticks and add info!() in examples
Diffstat (limited to 'embassy-stm32/src/timer/pwm_input.rs')
| -rw-r--r-- | embassy-stm32/src/timer/pwm_input.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/embassy-stm32/src/timer/pwm_input.rs b/embassy-stm32/src/timer/pwm_input.rs index d3fe7632a..7bcb7802a 100644 --- a/embassy-stm32/src/timer/pwm_input.rs +++ b/embassy-stm32/src/timer/pwm_input.rs | |||
| @@ -114,8 +114,8 @@ impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> { | |||
| 114 | self.inner.get_capture_value(self.channel) | 114 | self.inner.get_capture_value(self.channel) |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | /// Get the duty tick count | 117 | /// Get the pulse width tick count |
| 118 | pub fn get_duty_ticks(&self) -> u32 { | 118 | pub fn get_width_ticks(&self) -> u32 { |
| 119 | self.inner.get_capture_value(match self.channel { | 119 | self.inner.get_capture_value(match self.channel { |
| 120 | Channel::Ch1 => Channel::Ch2, | 120 | Channel::Ch1 => Channel::Ch2, |
| 121 | Channel::Ch2 => Channel::Ch1, | 121 | Channel::Ch2 => Channel::Ch1, |
| @@ -129,6 +129,6 @@ impl<'d, T: GeneralInstance4Channel> PwmInput<'d, T> { | |||
| 129 | if period == 0 { | 129 | if period == 0 { |
| 130 | return 0.; | 130 | return 0.; |
| 131 | } | 131 | } |
| 132 | 100. * (self.get_duty_ticks() as f32) / (period as f32) | 132 | 100. * (self.get_width_ticks() as f32) / (period as f32) |
| 133 | } | 133 | } |
| 134 | } | 134 | } |
