this hurts

Dependencies:   FFT

Committer:
annieluo2
Date:
Wed Dec 02 18:02:03 2020 +0000
Revision:
0:d6c9b09b4042
boo

Who changed what in which revision?

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