Skip to content

Commit 28d8f45

Browse files
committed
Add requirements and pseudo code for HAL ticker_free() function.
1 parent 0df9e15 commit 28d8f45

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

hal/us_ticker_api.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ extern "C" {
7373
* Verified by ::ticker_fire_now_test
7474
* * The ticker operations ticker_read, ticker_clear_interrupt, ticker_set_interrupt and ticker_fire_interrupt
7575
* take less than 20us to complete - Verified by ::ticker_speed_test
76+
* * The function ticker_free disables the ticker interrupt - ::ticker_free_interrupt_test
77+
* * The function ticker_init re-initializes ticker after has been disabled by means of ticker_free - Verified by ::ticker_init_free_test
7678
*
7779
* # Undefined behavior
7880
* * Calling any function other than ticker_init before the initialization of the ticker
@@ -170,6 +172,25 @@ void us_ticker_init(void);
170172
* except us_ticker_init(), calling any function other than init is undefined.
171173
*
172174
* @note This function stops the ticker from counting.
175+
*
176+
* Pseudo Code:
177+
* @code
178+
* uint32_t us_ticker_free()
179+
* {
180+
* // Disable timer
181+
* TIMER_CTRL &= ~TIMER_CTRL_ENABLE_Msk;
182+
*
183+
* // Disable the compare interrupt
184+
* TIMER_CTRL &= ~TIMER_CTRL_COMPARE_ENABLE_Msk;
185+
*
186+
* // Disable timer interrupt
187+
* NVIC_DisableIRQ(TIMER_IRQn);
188+
*
189+
* // Disable clock gate so processor cannot read TIMER registers
190+
* POWER_CTRL &= ~POWER_CTRL_TIMER_Msk;
191+
* }
192+
* @endcode
193+
*
173194
*/
174195
void us_ticker_free(void);
175196

0 commit comments

Comments
 (0)