Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

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