TRC
Dependents: RTC_terminal HorlogeSimple
RTC_IUT.h
- Committer:
- gr91
- Date:
- 2020-05-29
- Revision:
- 0:f17b3622fae1
- Child:
- 1:b85409cf9f7b
File content as of revision 0:f17b3622fae1:
/// @file IHM_L476.h Bibliothéque de classe pour la carte L476 compatible IHM NBOARD /// @mainpage /// /// /// /// @author Bruno LARNAUDIE, IUT Cachan /// /// @note /// History /// v3.00 31/10/2019 #include "mbed.h" typedef int int32_t; #include <time.h> /// RealTimeClock is an interface to the mbed RTC module /// /// It provides interfaces to get and set the time in text representation /// as well as a means to get and set the timezone offset so that it /// maintains time in UTC format. /// /// /// @note It is recommended that the system has a battery connected to /// the mbed battery backup pin. /// /// /// Example: /// @code /// RTC rtc; /// /// void main() { /// bool success; /// char TimeTest[] = "05/29/2011 14:15:18 (-6:00)"; /// char buf[50]; /// success = rtc.SetTime(TimeTest); /// rtc.GetTimeString(buf); /// printf("success: %i, time: %s\n", success, buf); /// } /// prints the following: /// success: 1, time: Sun May 29 14:15:18 2011 (tzo: -6:00) /// @endcode /// class Rtc { public: /// Constructor for the RealTimeClock interface, usually implemented /// outside of main( ) /// Rtc(); /// Destructor for the RealTimeClock, usually not executed /// ~Rtc(); /// GetTimeValue gets the current time in time_t format /// /// Gets the current time from the rtc and returns the time in time_t format. /// This is functionally identical to "return time(NULL);", /// simply wrapped in this class for convenience. /// /// @returns current time in time_t format /// time_t GetTimeValue(); /// SetTimeValue will set the current time in time_t format /// /// example SetTimeValue(1463673534) set the current time /// 19 May 2016 15:58:54 /// the min value is 978307200 (01/01/2001 00:00:00) void SetTimeValue(time_t t); /// GetTimeString gets the formatted time /// /// It places the formatted string into the buffer in the format of /// DD/MM/YYYY HH:MM:SS 30/12/2016 07:19:24 /// /// @returns nothing /// void GetTimeString(char * buffer); /// SetTimeString will set the Real Time Clock from a well formatted string /// /// This will read a string, and if it is well formed, it will then /// set the RTC based on this string. The string should be of the form: /// 'DD/MM/YYYY HH:MM:SS' /// /// example: 30/12/2011 13:15:07 /// /// @param timestring is the string to parse /// @returns true if the time was set /// bool SetTimeString(char * timestring); /// SetYear writes the year /// /// year format YYYY (2001 - 2106) void SetYear(unsigned short yyyy); /// GetYear reads the year /// /// @param void /// @returns the year unsigned short unsigned short GetYear(void); /// SetMon writes the month /// /// month format mm (1 - 12) void SetMon(unsigned char mm); /// GetMon reads the month /// /// @param void /// @returns the month unsigned char unsigned char GetMon(void); /// SetDay writes the day /// /// day format dd (1 - 31) void SetDay(unsigned char dd); /// GetDay reads the day /// /// @param void /// @returns the day unsigned char unsigned char GetDay(void); /// SetHour writes the hour /// /// hour format hh (0 - 23) void SetHour(unsigned char hh); /// GetHour reads the hour /// /// @param void /// @returns the hour unsigned char unsigned char GetHour(void); /// SetMin writes the minutes /// /// minute format mm (0 - 59) void SetMin(unsigned char mm); /// GetMin reads the minute /// /// @param void /// @returns the minute unsigned char unsigned char GetMin(void); /// SetSec writes the seconds /// /// second format ss (0 - 59) void SetSec(unsigned char ss); /// GetSec reads the second /// /// @param void /// @returns the second unsigned char unsigned char GetSec(void); private: };