@@ -70,7 +70,7 @@ impl Rtc {
70
70
} )
71
71
}
72
72
73
- /// Selects the frequency of the counter
73
+ /// Selects the frequency of the RTC Timer
74
74
/// NOTE: Maximum frequency of 16384 Hz using the internal LSE
75
75
pub fn select_frequency ( & mut self , timeout : impl Into < Hertz > ) {
76
76
let frequency = timeout. into ( ) . 0 ;
@@ -86,11 +86,11 @@ impl Rtc {
86
86
} ) ;
87
87
}
88
88
89
- /// Set the current rtc counter value to the specified amount
90
- pub fn set_time ( & mut self , seconds : u32 ) {
89
+ /// Set the current RTC counter value to the specified amount
90
+ pub fn set_time ( & mut self , counter_value : u32 ) {
91
91
self . perform_write ( |s| {
92
- s. regs . cnth . write ( |w| unsafe { w. bits ( seconds >> 16 ) } ) ;
93
- s. regs . cntl . write ( |w| unsafe { w. bits ( seconds as u16 as u32 ) } ) ;
92
+ s. regs . cnth . write ( |w| unsafe { w. bits ( counter_value >> 16 ) } ) ;
93
+ s. regs . cntl . write ( |w| unsafe { w. bits ( counter_value as u16 as u32 ) } ) ;
94
94
} ) ;
95
95
}
96
96
@@ -99,10 +99,10 @@ impl Rtc {
99
99
100
100
This also clears the alarm flag if it is set
101
101
*/
102
- pub fn set_alarm ( & mut self , seconds : u32 ) {
102
+ pub fn set_alarm ( & mut self , counter_value : u32 ) {
103
103
// Set alarm time
104
104
// See section 18.3.5 for explanation
105
- let alarm_value = seconds - 1 ;
105
+ let alarm_value = counter_value - 1 ;
106
106
self . perform_write ( |s| {
107
107
s. regs . alrh . write ( |w| unsafe { w. alrh ( ) . bits ( ( alarm_value >> 16 ) as u16 ) } ) ;
108
108
s. regs . alrl . write ( |w| unsafe { w. alrl ( ) . bits ( alarm_value as u16 ) } ) ;
0 commit comments