aboutsummaryrefslogtreecommitdiff
path: root/embassy-rp/src/rtc/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'embassy-rp/src/rtc/mod.rs')
-rw-r--r--embassy-rp/src/rtc/mod.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/embassy-rp/src/rtc/mod.rs b/embassy-rp/src/rtc/mod.rs
index 2ce7ac645..63cf91d28 100644
--- a/embassy-rp/src/rtc/mod.rs
+++ b/embassy-rp/src/rtc/mod.rs
@@ -1,7 +1,7 @@
1//! RTC driver. 1//! RTC driver.
2mod filter; 2mod filter;
3 3
4use embassy_hal_internal::{into_ref, Peripheral, PeripheralRef}; 4use embassy_hal_internal::{Peri, PeripheralType};
5 5
6pub use self::filter::DateTimeFilter; 6pub use self::filter::DateTimeFilter;
7 7
@@ -14,7 +14,7 @@ use crate::clocks::clk_rtc_freq;
14 14
15/// A reference to the real time clock of the system 15/// A reference to the real time clock of the system
16pub struct Rtc<'d, T: Instance> { 16pub struct Rtc<'d, T: Instance> {
17 inner: PeripheralRef<'d, T>, 17 inner: Peri<'d, T>,
18} 18}
19 19
20impl<'d, T: Instance> Rtc<'d, T> { 20impl<'d, T: Instance> Rtc<'d, T> {
@@ -23,9 +23,7 @@ impl<'d, T: Instance> Rtc<'d, T> {
23 /// # Errors 23 /// # Errors
24 /// 24 ///
25 /// Will return `RtcError::InvalidDateTime` if the datetime is not a valid range. 25 /// Will return `RtcError::InvalidDateTime` if the datetime is not a valid range.
26 pub fn new(inner: impl Peripheral<P = T> + 'd) -> Self { 26 pub fn new(inner: Peri<'d, T>) -> Self {
27 into_ref!(inner);
28
29 // Set the RTC divider 27 // Set the RTC divider
30 inner.regs().clkdiv_m1().write(|w| w.set_clkdiv_m1(clk_rtc_freq() - 1)); 28 inner.regs().clkdiv_m1().write(|w| w.set_clkdiv_m1(clk_rtc_freq() - 1));
31 29
@@ -194,7 +192,7 @@ trait SealedInstance {
194 192
195/// RTC peripheral instance. 193/// RTC peripheral instance.
196#[allow(private_bounds)] 194#[allow(private_bounds)]
197pub trait Instance: SealedInstance {} 195pub trait Instance: SealedInstance + PeripheralType {}
198 196
199impl SealedInstance for crate::peripherals::RTC { 197impl SealedInstance for crate::peripherals::RTC {
200 fn regs(&self) -> crate::pac::rtc::Rtc { 198 fn regs(&self) -> crate::pac::rtc::Rtc {