Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
mbed-os/hal/rtc_api.h@0:4beb2ea291ec, 2020-03-16 (annotated)
- Committer:
- boro
- Date:
- Mon Mar 16 13:12:31 2020 +0000
- Revision:
- 0:4beb2ea291ec
a
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| boro | 0:4beb2ea291ec | 1 | |
| boro | 0:4beb2ea291ec | 2 | /** \addtogroup hal */ |
| boro | 0:4beb2ea291ec | 3 | /** @{*/ |
| boro | 0:4beb2ea291ec | 4 | /* mbed Microcontroller Library |
| boro | 0:4beb2ea291ec | 5 | * Copyright (c) 2006-2013 ARM Limited |
| boro | 0:4beb2ea291ec | 6 | * |
| boro | 0:4beb2ea291ec | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| boro | 0:4beb2ea291ec | 8 | * you may not use this file except in compliance with the License. |
| boro | 0:4beb2ea291ec | 9 | * You may obtain a copy of the License at |
| boro | 0:4beb2ea291ec | 10 | * |
| boro | 0:4beb2ea291ec | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| boro | 0:4beb2ea291ec | 12 | * |
| boro | 0:4beb2ea291ec | 13 | * Unless required by applicable law or agreed to in writing, software |
| boro | 0:4beb2ea291ec | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| boro | 0:4beb2ea291ec | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| boro | 0:4beb2ea291ec | 16 | * See the License for the specific language governing permissions and |
| boro | 0:4beb2ea291ec | 17 | * limitations under the License. |
| boro | 0:4beb2ea291ec | 18 | */ |
| boro | 0:4beb2ea291ec | 19 | #ifndef MBED_RTC_API_H |
| boro | 0:4beb2ea291ec | 20 | #define MBED_RTC_API_H |
| boro | 0:4beb2ea291ec | 21 | |
| boro | 0:4beb2ea291ec | 22 | #include "device.h" |
| boro | 0:4beb2ea291ec | 23 | |
| boro | 0:4beb2ea291ec | 24 | #if DEVICE_RTC |
| boro | 0:4beb2ea291ec | 25 | |
| boro | 0:4beb2ea291ec | 26 | #include <time.h> |
| boro | 0:4beb2ea291ec | 27 | |
| boro | 0:4beb2ea291ec | 28 | #ifdef __cplusplus |
| boro | 0:4beb2ea291ec | 29 | extern "C" { |
| boro | 0:4beb2ea291ec | 30 | #endif |
| boro | 0:4beb2ea291ec | 31 | |
| boro | 0:4beb2ea291ec | 32 | /** |
| boro | 0:4beb2ea291ec | 33 | * \defgroup hal_rtc RTC hal functions |
| boro | 0:4beb2ea291ec | 34 | * @{ |
| boro | 0:4beb2ea291ec | 35 | */ |
| boro | 0:4beb2ea291ec | 36 | |
| boro | 0:4beb2ea291ec | 37 | /** Initialize the RTC peripheral |
| boro | 0:4beb2ea291ec | 38 | * |
| boro | 0:4beb2ea291ec | 39 | */ |
| boro | 0:4beb2ea291ec | 40 | void rtc_init(void); |
| boro | 0:4beb2ea291ec | 41 | |
| boro | 0:4beb2ea291ec | 42 | /** Deinitialize RTC |
| boro | 0:4beb2ea291ec | 43 | * |
| boro | 0:4beb2ea291ec | 44 | * TODO: The function is not used by rtc api in mbed-drivers. |
| boro | 0:4beb2ea291ec | 45 | */ |
| boro | 0:4beb2ea291ec | 46 | void rtc_free(void); |
| boro | 0:4beb2ea291ec | 47 | |
| boro | 0:4beb2ea291ec | 48 | /** Get the RTC enable status |
| boro | 0:4beb2ea291ec | 49 | * |
| boro | 0:4beb2ea291ec | 50 | * @retval 0 disabled |
| boro | 0:4beb2ea291ec | 51 | * @retval 1 enabled |
| boro | 0:4beb2ea291ec | 52 | */ |
| boro | 0:4beb2ea291ec | 53 | int rtc_isenabled(void); |
| boro | 0:4beb2ea291ec | 54 | |
| boro | 0:4beb2ea291ec | 55 | /** Get the current time from the RTC peripheral |
| boro | 0:4beb2ea291ec | 56 | * |
| boro | 0:4beb2ea291ec | 57 | * @return The current time |
| boro | 0:4beb2ea291ec | 58 | */ |
| boro | 0:4beb2ea291ec | 59 | time_t rtc_read(void); |
| boro | 0:4beb2ea291ec | 60 | |
| boro | 0:4beb2ea291ec | 61 | /** Set the current time to the RTC peripheral |
| boro | 0:4beb2ea291ec | 62 | * |
| boro | 0:4beb2ea291ec | 63 | * @param t The current time to be set |
| boro | 0:4beb2ea291ec | 64 | */ |
| boro | 0:4beb2ea291ec | 65 | void rtc_write(time_t t); |
| boro | 0:4beb2ea291ec | 66 | |
| boro | 0:4beb2ea291ec | 67 | /**@}*/ |
| boro | 0:4beb2ea291ec | 68 | |
| boro | 0:4beb2ea291ec | 69 | #ifdef __cplusplus |
| boro | 0:4beb2ea291ec | 70 | } |
| boro | 0:4beb2ea291ec | 71 | #endif |
| boro | 0:4beb2ea291ec | 72 | |
| boro | 0:4beb2ea291ec | 73 | #endif |
| boro | 0:4beb2ea291ec | 74 | |
| boro | 0:4beb2ea291ec | 75 | #endif |
| boro | 0:4beb2ea291ec | 76 | |
| boro | 0:4beb2ea291ec | 77 | /** @}*/ |