@@ -57,6 +57,13 @@ pub struct Timer1 {}
57
57
impl TimerInst for Timer1 { }
58
58
59
59
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.*
60
67
pub fn new (
61
68
timg : TIMG ,
62
69
clock_control_config : ClockControlConfig ,
@@ -87,12 +94,16 @@ impl<TIMG: TimerGroup> Timer<TIMG, Timer0> {
87
94
}
88
95
89
96
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.
90
99
pub fn release ( _timer0 : Timer < TIMG0 , Timer0 > , _timer1 : Timer < TIMG0 , Timer1 > ) -> TIMG0 {
91
100
unsafe { esp32:: Peripherals :: steal ( ) . TIMG0 }
92
101
}
93
102
}
94
103
95
104
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.
96
107
pub fn release ( _timer0 : Timer < TIMG1 , Timer0 > , _timer1 : Timer < TIMG1 , Timer1 > ) -> TIMG1 {
97
108
unsafe { esp32:: Peripherals :: steal ( ) . TIMG1 }
98
109
}
0 commit comments