Эх сурвалжийг харах

Fix period retrival for timers

Fix `get_period` for timers
Dustin Frisch 3 жил өмнө
parent
commit
e89fcd3ace
2 өөрчлөгдсөн 5 нэмэгдсэн , 1 устгасан
  1. 4 0
      CHANGELOG.md
  2. 1 1
      src/pwm.rs

+ 4 - 0
CHANGELOG.md

@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
 
 ## [Unreleased]
 
+### Fixed
+
+- Fix period retrival for timers
+
 ## [v0.6.0] - 2020-06-06
 
 ### Breaking changes

+ 1 - 1
src/pwm.rs

@@ -371,7 +371,7 @@ macro_rules! hal {
                 fn get_period(&self) -> Self::Time {
                     let clk = self.clk;
                     let psc: u16 = unsafe{(*$TIMX::ptr()).psc.read().psc().bits()};
-                    let arr: u16 = unsafe{(*$TIMX::ptr()).psc.read().psc().bits()};
+                    let arr: u16 = unsafe{(*$TIMX::ptr()).arr.read().arr().bits()};
 
                     // Length in ms of an internal clock pulse
                     (clk.0 / u32(psc * arr)).hz()