|
1 |
| -# RTC HAL API |
| 1 | +## RTC HAL API |
2 | 2 |
|
3 |
| -The RTC HAL API provides a low level interface to the Real Time Counter (RTC) of a target. |
| 3 | +The RTC HAL API provides a low-level interface to the Real Time Counter (RTC) of a target. |
4 | 4 |
|
5 |
| -## Assumptions |
| 5 | +### Assumptions |
6 | 6 |
|
7 |
| -### Defined behavior |
| 7 | +#### Defined behavior |
8 | 8 |
|
9 |
| -- The function `rtc_init` is safe to call repeatedly |
10 |
| -- RTC accuracy is at least 10% |
11 |
| -- `Init`/`free` doesn't stop RTC from counting |
12 |
| -- Software reset doesn't stop RTC from counting |
13 |
| -- Sleep modes don't stop RTC from counting |
14 |
| -- Shutdown mode doesn't stop RTC from counting |
| 9 | +- The function `rtc_init` is safe to call repeatedly. |
| 10 | +- RTC accuracy is at least 10%. |
| 11 | +- `Init`/`free` doesn't stop RTC from counting. |
| 12 | +- Software reset doesn't stop RTC from counting. |
| 13 | +- Sleep modes don't stop RTC from counting. |
| 14 | +- Shutdown mode doesn't stop RTC from counting. |
15 | 15 |
|
16 |
| -### Undefined behavior |
| 16 | +#### Undefined behavior |
17 | 17 |
|
18 |
| -- Calling any function other than `rtc_init` before the initialization of the RTC |
| 18 | +- Calling any function other than `rtc_init` before the initialization of the RTC. |
19 | 19 |
|
20 |
| -### Potential bugs |
| 20 | +#### Potential bugs |
21 | 21 |
|
22 |
| -- Incorrect overflow handling |
23 |
| -- Glitches due to ripple counter |
| 22 | +- Incorrect overflow handling. |
| 23 | +- Glitches due to ripple counter. |
24 | 24 |
|
25 |
| -## Implementing the RTC API |
| 25 | +### Implementing the RTC API |
26 | 26 |
|
27 |
| -RTC HAL API is located in [hal/rtc_api.h](). Following functions need to be implemented to support RTC: |
| 27 | +RTC HAL API is in [hal/rtc_api.h](). You need to implement the following functions to support RTC: |
28 | 28 |
|
| 29 | +To enable sleep support in Mbed OS, you need to add the `RTC` label in the `device_has` option of the target's section in the `targets.json` file. |
29 | 30 |
|
30 |
| -To enable sleep support in mbed OS `RTC` label needs to be added in `device_has` option of target's section in `targets.json` file. |
31 |
| - |
32 |
| -## Testing |
| 31 | +### Testing |
33 | 32 |
|
34 | 33 | The [RTC HAL API test suite]() validates:
|
35 | 34 |
|
36 |
| -- `rtc_init` is safe to call repeatedly - Verified by test `rtc_init_test` |
37 |
| -- `Init`/`free` doesn't stop RTC from counting - Verified by test `rtc_persist_test` |
38 |
| -- Software reset doesn't stop RTC from counting - Verified by `rtc_reset_test` |
39 |
| -- Sleep modes don't stop RTC from counting - Verified by `rtc_sleep_test` |
40 |
| -- Overflow handling - Verified by `rtc_range_test` |
41 |
| -- No backward glitches - Verified by `rtc_glitch_test` |
| 35 | +- `rtc_init` is safe to call repeatedly - Verified by test `rtc_init_test`. |
| 36 | +- `Init`/`free` doesn't stop RTC from counting - Verified by test `rtc_persist_test`. |
| 37 | +- Software reset doesn't stop RTC from counting - Verified by `rtc_reset_test`. |
| 38 | +- Sleep modes don't stop RTC from counting - Verified by `rtc_sleep_test`. |
| 39 | +- Overflow handling - Verified by `rtc_range_test`. |
| 40 | +- No backward glitches - Verified by `rtc_glitch_test`. |
0 commit comments