PIR grove sensor that sends the sensed data to Thingspeak.com through the wifi module ESP 8266
Embed:
(wiki syntax)
Show/hide line numbers
rtc_time.h
00001 00002 /** \addtogroup platform */ 00003 /** @{*/ 00004 /* mbed Microcontroller Library 00005 * Copyright (c) 2006-2013 ARM Limited 00006 * 00007 * Licensed under the Apache License, Version 2.0 (the "License"); 00008 * you may not use this file except in compliance with the License. 00009 * You may obtain a copy of the License at 00010 * 00011 * http://www.apache.org/licenses/LICENSE-2.0 00012 * 00013 * Unless required by applicable law or agreed to in writing, software 00014 * distributed under the License is distributed on an "AS IS" BASIS, 00015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00016 * See the License for the specific language governing permissions and 00017 * limitations under the License. 00018 */ 00019 00020 #include <time.h> 00021 00022 #ifdef __cplusplus 00023 extern "C" { 00024 #endif 00025 00026 /** Implementation of the C time.h functions 00027 * 00028 * Provides mechanisms to set and read the current time, based 00029 * on the microcontroller Real-Time Clock (RTC), plus some 00030 * standard C manipulation and formating functions. 00031 * 00032 * Example: 00033 * @code 00034 * #include "mbed.h" 00035 * 00036 * int main() { 00037 * set_time(1256729737); // Set RTC time to Wed, 28 Oct 2009 11:35:37 00038 * 00039 * while(1) { 00040 * time_t seconds = time(NULL); 00041 * 00042 * printf("Time as seconds since January 1, 1970 = %d\n", seconds); 00043 * 00044 * printf("Time as a basic string = %s", ctime(&seconds)); 00045 * 00046 * char buffer[32]; 00047 * strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); 00048 * printf("Time as a custom formatted string = %s", buffer); 00049 * 00050 * wait(1); 00051 * } 00052 * } 00053 * @endcode 00054 */ 00055 00056 /** Set the current time 00057 * 00058 * Initialises and sets the time of the microcontroller Real-Time Clock (RTC) 00059 * to the time represented by the number of seconds since January 1, 1970 00060 * (the UNIX timestamp). 00061 * 00062 * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) 00063 * 00064 * @Note Synchronization level: Thread safe 00065 * 00066 * Example: 00067 * @code 00068 * #include "mbed.h" 00069 * 00070 * int main() { 00071 * set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37 00072 * } 00073 * @endcode 00074 */ 00075 void set_time(time_t t); 00076 00077 /** Attach an external RTC to be used for the C time functions 00078 * 00079 * @Note Synchronization level: Thread safe 00080 * 00081 * @param read_rtc pointer to function which returns current UNIX timestamp 00082 * @param write_rtc pointer to function which sets current UNIX timestamp, can be NULL 00083 * @param init_rtc pointer to funtion which initializes RTC, can be NULL 00084 * @param isenabled_rtc pointer to function wich returns if the rtc is enabled, can be NULL 00085 */ 00086 void attach_rtc(time_t (*read_rtc)(void), void (*write_rtc)(time_t), void (*init_rtc)(void), int (*isenabled_rtc)(void)); 00087 00088 #ifdef __cplusplus 00089 } 00090 #endif 00091 00092 /** @}*/
Generated on Tue Jul 12 2022 14:11:11 by 1.7.2