Skip to content
This repository was archived by the owner on Aug 9, 2022. It is now read-only.

Commit 57184d6

Browse files
committed
Added documentation to timer
1 parent f261216 commit 57184d6

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/timer/mod.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ pub struct Timer1 {}
5757
impl TimerInst for Timer1 {}
5858

5959
impl<TIMG: TimerGroup> Timer<TIMG, Timer0> {
60+
/// Create new timer resources
61+
///
62+
/// This function will create 2 timers and 1 watchdog for a timer group.
63+
/// It uses the clock_control_config for obtaining the clock configuration.
64+
///
65+
/// *Note: time to clock tick conversions are done with the clock frequency when the
66+
/// [start](embedded_hal::timer::CountDown::start) function is called. The clock frequency is not locked.*
6067
pub fn new(
6168
timg: TIMG,
6269
clock_control_config: ClockControlConfig,
@@ -87,12 +94,16 @@ impl<TIMG: TimerGroup> Timer<TIMG, Timer0> {
8794
}
8895

8996
impl<INST: TimerInst> Timer<TIMG0, INST> {
97+
/// Releases the timer resources. Requires to release all timers and watchdog belonging to
98+
/// the same group at once.
9099
pub fn release(_timer0: Timer<TIMG0, Timer0>, _timer1: Timer<TIMG0, Timer1>) -> TIMG0 {
91100
unsafe { esp32::Peripherals::steal().TIMG0 }
92101
}
93102
}
94103

95104
impl<INST: TimerInst> Timer<TIMG1, INST> {
105+
/// Releases the timer resources. Requires to release all timers and watchdog belonging to
106+
/// the same group at once.
96107
pub fn release(_timer0: Timer<TIMG1, Timer0>, _timer1: Timer<TIMG1, Timer1>) -> TIMG1 {
97108
unsafe { esp32::Peripherals::steal().TIMG1 }
98109
}

0 commit comments

Comments
 (0)