Skip to content

Add RTC HAL page to PG #242

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 15, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/contributing/rtc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## RTC HAL API

The RTC HAL API provides a low-level interface to the Real Time Counter (RTC) of a target.

### Assumptions

#### Defined behavior

- The function `rtc_init` is safe to call repeatedly.
- RTC accuracy is at least 10%.
- `Init`/`free` doesn't stop RTC from counting.
- Software reset doesn't stop RTC from counting.
- Sleep modes don't stop RTC from counting.
- Shutdown mode doesn't stop RTC from counting.

#### Undefined behavior

- Calling any function other than `rtc_init` before the initialization of the RTC.

#### Potential bugs

- Incorrect overflow handling.
- Glitches due to ripple counter.

### Implementing the RTC API

RTC HAL API is in [hal/rtc_api.h](/docs/v5.4/mbed-os-api-doxy/rtc__api_8h_source.html). You need to implement the following functions to support RTC:

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.