Skip to content

Commit

Permalink
Merge branch 'master' into gh-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
twitchyliquid64 authored Oct 2, 2021
2 parents 74feeaa + e50ee49 commit d76bacb
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 18 deletions.
9 changes: 9 additions & 0 deletions boards/feather_m0/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# 10.0.1

* Bump dependencies `rtic-monotonic` to `0.1.0-rc.1` and `cortex-m-rtic` to `0.6.0-rc.2`.

* Change Cargo feature resolver to `resolver = "2"`

---

Changelog tracking started at v0.10.0
14 changes: 8 additions & 6 deletions boards/feather_m0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
[package]
name = "feather_m0"
version = "0.10.0"
version = "0.10.1"
authors = ["Ben Bergman <[email protected]>"]
description = "Board Support crate for the Adafruit Feather M0"
keywords = ["no-std", "arm", "cortex-m", "embedded-hal"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/atsamd-rs/atsamd"
readme = "README.md"
edition = "2018"
resolver = "2"

[dependencies]
cortex-m = "0.6"
Expand Down Expand Up @@ -40,7 +41,11 @@ version = "0.3"
optional = true

[dependencies.rtic-monotonic]
version = "=0.1.0-alpha.2"
version = "=0.1.0-rc.1"
optional = true

[dependencies.cortex-m-rtic]
version = "=0.6.0-rc.2"
optional = true

[dev-dependencies]
Expand All @@ -54,9 +59,6 @@ heapless = "0.5"
panic-halt = "0.2"
panic-semihosting = "0.5"

[dev-dependencies.cortex-m-rtic]
version = "0.6.0-alpha.5"

[features]
# ask the HAL to enable atsamd21g support
default = ["rt", "atsamd-hal/samd21g"]
Expand All @@ -73,7 +75,7 @@ max-channels = ["dma", "atsamd-hal/max-channels"]
# Enable pins for the adalogger SD card reader
adalogger = []
sdmmc = ["embedded-sdmmc", "atsamd-hal/sdmmc"]
rtic = ["atsamd-hal/rtic", "rtic-monotonic"]
rtic = ["atsamd-hal/rtic", "rtic-monotonic", "cortex-m-rtic"]
use_semihosting = []

[profile.dev]
Expand Down
7 changes: 7 additions & 0 deletions boards/metro_m0/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# 10.0.1

* Bump dependencies `rtic-monotonic` to `0.1.0-rc.1` and `cortex-m-rtic` to `0.6.0-rc.2`.

---

Changelog tracking started at v0.10.0
6 changes: 3 additions & 3 deletions boards/metro_m0/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "metro_m0"
version = "0.10.0"
version = "0.10.1"
authors = ["Wez Furlong <[email protected]>"]
description = "Board Support crate for the Adafruit Metro M0"
keywords = ["no-std", "arm", "cortex-m", "embedded-hal"]
Expand All @@ -24,7 +24,7 @@ version = "0.13"
default-features = false

[dependencies.rtic-monotonic]
version = "=0.1.0-alpha.2"
version = "=0.1.0-rc.1"
optional = true

[dependencies.usb-device]
Expand All @@ -40,7 +40,7 @@ panic-halt = "0.2"
panic_rtt = "0.2"
panic-semihosting = "0.5"
cortex-m-semihosting = "0.3"
cortex-m-rtic = "=0.6.0-alpha.5"
cortex-m-rtic = "=0.6.0-rc.2"
sx1509 = "0.2"

[features]
Expand Down
4 changes: 2 additions & 2 deletions crates.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"feather_m0": {
"tier": 1,
"build": "cargo build --examples --features=unproven,usb,dma,rtic"
"build": "cargo build --examples --features=unproven,dma,usb,rtic,sdmmc,adalogger"
},
"feather_m4": {
"tier": 2,
Expand Down Expand Up @@ -78,7 +78,7 @@
},
"samd11_bare": {
"tier": 1,
"build": "cargo build --release --examples --features=unproven,rt,use-semihosting"
"build": "cargo build --release --examples --features=unproven,rt,use_semihosting"
},
"samd21_mini": {
"tier": 2,
Expand Down
29 changes: 22 additions & 7 deletions hal/src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ impl RtcMode for ClockMode {}
impl Sealed for ClockMode {}

/// Count32Mode represents the 32-bit counter mode. This is a free running
/// count-up timer, the counter value is preserved when using the CountDown /
/// Periodic traits (which are using the compare register only).
/// count-up timer. When used in Periodic/CountDown mode with the embedded-hal
/// trait(s), it resets to zero on compare and starts counting up again.
pub enum Count32Mode {}

impl RtcMode for Count32Mode {}
Expand Down Expand Up @@ -339,13 +339,28 @@ impl CountDown for Rtc<Count32Mode> {
where
T: Into<Self::Time>,
{
let ticks: u32 =
(timeout.into().0 as u64 * self.rtc_clock_freq.0 as u64 / 1_000_000_000) as u32;
let comp = self.count32().wrapping_add(ticks);
let params = TimerParams::new_us(timeout, self.rtc_clock_freq.0);
let divider = params.divider;
let cycles = params.cycles;

// Disable the timer while we reconfigure it
self.enable(false);

// Now that we have a clock routed to the peripheral, we
// can ask it to perform a reset.
self.reset();
while self.mode0_ctrla().read().swrst().bit_is_set() {}

// set cycles to compare to...
self.sync();
self.mode0().comp[0].write(|w| unsafe { w.comp().bits(comp) });
self.mode0().comp[0].write(|w| unsafe { w.comp().bits(cycles) });
self.mode0_ctrla().modify(|_, w| {
// set clock divider...
w.prescaler().variant(divider);
// clear timer on match for periodicity...
w.matchclr().set_bit();
// and enable RTC.
w.enable().set_bit()
});
}

fn wait(&mut self) -> nb::Result<(), Void> {
Expand Down

0 comments on commit d76bacb

Please sign in to comment.