customized mbed library sources for nrf51822

Dependents:   Grove_Node Potentiometer BLE_Beacon I2C_Scanner

Committer:
yihui
Date:
Tue Nov 04 07:38:53 2014 +0000
Revision:
0:700cadd8b708
customized mbed-src library for nrf51822

Who changed what in which revision?

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