xrocusOS_ADXL355 version

Dependencies:   mbed SDFileSystem

Committer:
Inscape_ao
Date:
Tue Apr 23 08:47:11 2019 +0000
Revision:
2:a694440145e9
add TimeManager

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Inscape_ao 2:a694440145e9 1 #ifndef _TIMEMANAGER_H_
Inscape_ao 2:a694440145e9 2 #define _TIMEMANAGER_H_
Inscape_ao 2:a694440145e9 3
Inscape_ao 2:a694440145e9 4 #include "mbed.h"
Inscape_ao 2:a694440145e9 5 #include "string.h"
Inscape_ao 2:a694440145e9 6
Inscape_ao 2:a694440145e9 7 class TimeManager
Inscape_ao 2:a694440145e9 8 {
Inscape_ao 2:a694440145e9 9 public:
Inscape_ao 2:a694440145e9 10 /** Opcode for setCurrentTime(YY/MM/DD-HH/mm/SS) */
Inscape_ao 2:a694440145e9 11 class SetTimeMethod {
Inscape_ao 2:a694440145e9 12 public:
Inscape_ao 2:a694440145e9 13 const static int Year = 0;
Inscape_ao 2:a694440145e9 14 const static int Month = 1;
Inscape_ao 2:a694440145e9 15 const static int Day = 2;
Inscape_ao 2:a694440145e9 16 const static int Hour = 3;
Inscape_ao 2:a694440145e9 17 const static int Min = 4;
Inscape_ao 2:a694440145e9 18 const static int Sec = 5;
Inscape_ao 2:a694440145e9 19 };
Inscape_ao 2:a694440145e9 20 static const int TimeStampLength = sizeof("YYYY-MM-DD_HH:MM:SS") - 1;
Inscape_ao 2:a694440145e9 21 private:
Inscape_ao 2:a694440145e9 22 /* Tick base class */
Inscape_ao 2:a694440145e9 23 Ticker baseclock;
Inscape_ao 2:a694440145e9 24 /* current time */
Inscape_ao 2:a694440145e9 25 struct tm current;
Inscape_ao 2:a694440145e9 26 public:
Inscape_ao 2:a694440145e9 27 /* Constractor */
Inscape_ao 2:a694440145e9 28 TimeManager(void);
Inscape_ao 2:a694440145e9 29 /* tick (currenttime++) */
Inscape_ao 2:a694440145e9 30 void tick(void);
Inscape_ao 2:a694440145e9 31 /* copy Struct Time to arg */
Inscape_ao 2:a694440145e9 32 void getCurrentTime(struct tm *ret);
Inscape_ao 2:a694440145e9 33 /* get string of timestamp */
Inscape_ao 2:a694440145e9 34 int getTimeStamp(char *dst);
Inscape_ao 2:a694440145e9 35 /* set time parameters */
Inscape_ao 2:a694440145e9 36 bool setCurrentTime(int selector, int set);
Inscape_ao 2:a694440145e9 37 private:
Inscape_ao 2:a694440145e9 38 /* calcurate Number of Days in month */
Inscape_ao 2:a694440145e9 39 int getDaysInMonth(int month, int year);
Inscape_ao 2:a694440145e9 40 };
Inscape_ao 2:a694440145e9 41
Inscape_ao 2:a694440145e9 42 #endif /* _TIMEMANAGER_H_ */