Initial commit

Dependencies:   FastPWM

Committer:
lypinator
Date:
Wed Sep 16 01:11:49 2020 +0000
Revision:
0:bb348c97df44
Added PWM

Who changed what in which revision?

UserRevisionLine numberNew contents of line
lypinator 0:bb348c97df44 1
lypinator 0:bb348c97df44 2 /** \addtogroup platform */
lypinator 0:bb348c97df44 3 /** @{*/
lypinator 0:bb348c97df44 4 /**
lypinator 0:bb348c97df44 5 * \defgroup platform_rtc_time rtc_time functions
lypinator 0:bb348c97df44 6 * @{
lypinator 0:bb348c97df44 7 */
lypinator 0:bb348c97df44 8 /* mbed Microcontroller Library
lypinator 0:bb348c97df44 9 * Copyright (c) 2006-2013 ARM Limited
lypinator 0:bb348c97df44 10 *
lypinator 0:bb348c97df44 11 * Licensed under the Apache License, Version 2.0 (the "License");
lypinator 0:bb348c97df44 12 * you may not use this file except in compliance with the License.
lypinator 0:bb348c97df44 13 * You may obtain a copy of the License at
lypinator 0:bb348c97df44 14 *
lypinator 0:bb348c97df44 15 * http://www.apache.org/licenses/LICENSE-2.0
lypinator 0:bb348c97df44 16 *
lypinator 0:bb348c97df44 17 * Unless required by applicable law or agreed to in writing, software
lypinator 0:bb348c97df44 18 * distributed under the License is distributed on an "AS IS" BASIS,
lypinator 0:bb348c97df44 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
lypinator 0:bb348c97df44 20 * See the License for the specific language governing permissions and
lypinator 0:bb348c97df44 21 * limitations under the License.
lypinator 0:bb348c97df44 22 */
lypinator 0:bb348c97df44 23
lypinator 0:bb348c97df44 24 #include <time.h>
lypinator 0:bb348c97df44 25
lypinator 0:bb348c97df44 26 #ifdef __cplusplus
lypinator 0:bb348c97df44 27 extern "C" {
lypinator 0:bb348c97df44 28 #endif
lypinator 0:bb348c97df44 29
lypinator 0:bb348c97df44 30 /** Implementation of the C time.h functions
lypinator 0:bb348c97df44 31 *
lypinator 0:bb348c97df44 32 * Provides mechanisms to set and read the current time, based
lypinator 0:bb348c97df44 33 * on the microcontroller Real-Time Clock (RTC), plus some
lypinator 0:bb348c97df44 34 * standard C manipulation and formating functions.
lypinator 0:bb348c97df44 35 *
lypinator 0:bb348c97df44 36 * Example:
lypinator 0:bb348c97df44 37 * @code
lypinator 0:bb348c97df44 38 * #include "mbed.h"
lypinator 0:bb348c97df44 39 *
lypinator 0:bb348c97df44 40 * int main() {
lypinator 0:bb348c97df44 41 * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37
lypinator 0:bb348c97df44 42 *
lypinator 0:bb348c97df44 43 * while(1) {
lypinator 0:bb348c97df44 44 * time_t seconds = time(NULL);
lypinator 0:bb348c97df44 45 *
lypinator 0:bb348c97df44 46 * printf("Time as seconds since January 1, 1970 = %d\n", seconds);
lypinator 0:bb348c97df44 47 *
lypinator 0:bb348c97df44 48 * printf("Time as a basic string = %s", ctime(&seconds));
lypinator 0:bb348c97df44 49 *
lypinator 0:bb348c97df44 50 * char buffer[32];
lypinator 0:bb348c97df44 51 * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
lypinator 0:bb348c97df44 52 * printf("Time as a custom formatted string = %s", buffer);
lypinator 0:bb348c97df44 53 *
lypinator 0:bb348c97df44 54 * wait(1);
lypinator 0:bb348c97df44 55 * }
lypinator 0:bb348c97df44 56 * }
lypinator 0:bb348c97df44 57 * @endcode
lypinator 0:bb348c97df44 58 */
lypinator 0:bb348c97df44 59
lypinator 0:bb348c97df44 60 /** Set the current time
lypinator 0:bb348c97df44 61 *
lypinator 0:bb348c97df44 62 * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
lypinator 0:bb348c97df44 63 * to the time represented by the number of seconds since January 1, 1970
lypinator 0:bb348c97df44 64 * (the UNIX timestamp).
lypinator 0:bb348c97df44 65 *
lypinator 0:bb348c97df44 66 * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
lypinator 0:bb348c97df44 67 *
lypinator 0:bb348c97df44 68 * @note Synchronization level: Thread safe
lypinator 0:bb348c97df44 69 *
lypinator 0:bb348c97df44 70 * Example:
lypinator 0:bb348c97df44 71 * @code
lypinator 0:bb348c97df44 72 * #include "mbed.h"
lypinator 0:bb348c97df44 73 *
lypinator 0:bb348c97df44 74 * int main() {
lypinator 0:bb348c97df44 75 * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
lypinator 0:bb348c97df44 76 * }
lypinator 0:bb348c97df44 77 * @endcode
lypinator 0:bb348c97df44 78 */
lypinator 0:bb348c97df44 79 void set_time(time_t t);
lypinator 0:bb348c97df44 80
lypinator 0:bb348c97df44 81 /** Attach an external RTC to be used for the C time functions
lypinator 0:bb348c97df44 82 *
lypinator 0:bb348c97df44 83 * @note Synchronization level: Thread safe
lypinator 0:bb348c97df44 84 *
lypinator 0:bb348c97df44 85 * @param read_rtc pointer to function which returns current UNIX timestamp
lypinator 0:bb348c97df44 86 * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL
lypinator 0:bb348c97df44 87 * @param init_rtc pointer to funtion which initializes RTC, can be NULL
lypinator 0:bb348c97df44 88 * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL
lypinator 0:bb348c97df44 89 */
lypinator 0:bb348c97df44 90 void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void));
lypinator 0:bb348c97df44 91
lypinator 0:bb348c97df44 92 #ifdef __cplusplus
lypinator 0:bb348c97df44 93 }
lypinator 0:bb348c97df44 94 #endif
lypinator 0:bb348c97df44 95
lypinator 0:bb348c97df44 96 /** @}*/
lypinator 0:bb348c97df44 97 /** @}*/