File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ # RTC HAL API
2
+
3
+ The RTC HAL API provides a low level interface to the Real Time Counter (RTC) of a target.
4
+
5
+ ## Assumptions
6
+
7
+ ### Defined behavior
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
15
+
16
+ ### Undefined behavior
17
+
18
+ - Calling any function other than ` rtc_init ` before the initialization of the RTC
19
+
20
+ ### Potential bugs
21
+
22
+ - Incorrect overflow handling
23
+ - Glitches due to ripple counter
24
+
25
+ ## Implementing the RTC API
26
+
27
+ RTC HAL API is located in [ hal/rtc_api.h] ( ) . Following functions need to be implemented to support RTC:
28
+
29
+
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
33
+
34
+ The [ RTC HAL API test suite] ( ) validates:
35
+
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 `
You can’t perform that action at this time.
0 commit comments