Skip to content

Commit 52a84d6

Browse files
committed
small changes
1 parent 91847a3 commit 52a84d6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/rtc.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ impl Rtc {
7070
})
7171
}
7272

73-
/// Selects the frequency of the counter
73+
/// Selects the frequency of the RTC Timer
7474
/// NOTE: Maximum frequency of 16384 Hz using the internal LSE
7575
pub fn select_frequency(&mut self, timeout: impl Into<Hertz>) {
7676
let frequency = timeout.into().0;
@@ -86,11 +86,11 @@ impl Rtc {
8686
});
8787
}
8888

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) {
9191
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)});
9494
});
9595
}
9696

@@ -99,10 +99,10 @@ impl Rtc {
9999
100100
This also clears the alarm flag if it is set
101101
*/
102-
pub fn set_alarm(&mut self, seconds: u32) {
102+
pub fn set_alarm(&mut self, counter_value: u32) {
103103
// Set alarm time
104104
// See section 18.3.5 for explanation
105-
let alarm_value = seconds - 1;
105+
let alarm_value = counter_value - 1;
106106
self.perform_write(|s| {
107107
s.regs.alrh.write(|w| unsafe{w.alrh().bits((alarm_value >> 16) as u16)});
108108
s.regs.alrl.write(|w| unsafe{w.alrl().bits(alarm_value as u16)});

src/timer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl CountDownTimer<SYST> {
6464
}
6565
}
6666

67-
/// Resets the timer
67+
/// Resets the counter
6868
pub fn reset(&mut self) {
6969
// According to the Cortex-M3 Generic User Guide, the interrupt request is only generated
7070
// when the counter goes from 1 to 0, so writing zero should not trigger an interrupt
@@ -215,7 +215,7 @@ macro_rules! hal {
215215
u32(1_000_000 * cnt / freq_divider).unwrap()
216216
}
217217

218-
/// Resets the counter and generates an update event
218+
/// Resets the counter
219219
pub fn reset(&mut self) {
220220
// Sets the URS bit to prevent an interrupt from being triggered by
221221
// the UG bit

0 commit comments

Comments
 (0)