Pinky and the Brain / Mbed OS Clock

Dependencies:   SPI_TFT_ILI9341 TFT_fonts Adafruit_RTCLib RTC-DS1307 TSI

Committer:
sfaghihi
Date:
Tue May 23 23:28:27 2017 +0000
Revision:
8:e7fce7d9ebdd
Parent:
7:5269fbadd5d7
Child:
11:80a6facfd9f1
Non working( it worked 20 mins ago :'(

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sfaghihi 7:5269fbadd5d7 1 #ifndef __UTILITY__
sfaghihi 7:5269fbadd5d7 2 #define __UTILITY__
sfaghihi 7:5269fbadd5d7 3
sfaghihi 7:5269fbadd5d7 4 // Headers inclusion
sfaghihi 2:56a27b66d03a 5 #include "mbed.h"
sfaghihi 2:56a27b66d03a 6 #include "stdio.h"
sfaghihi 8:e7fce7d9ebdd 7 #include "math.h"
sfaghihi 7:5269fbadd5d7 8 #include "string"
sfaghihi 7:5269fbadd5d7 9
sfaghihi 7:5269fbadd5d7 10 // Some macros
sfaghihi 8:e7fce7d9ebdd 11 extern RawSerial pc_io;
sfaghihi 7:5269fbadd5d7 12 #define LOG(...) pc_io.printf(__VA_ARGS__)
sfaghihi 8:e7fce7d9ebdd 13 #define M_PI 3.14159265358979323846 /* pi */
sfaghihi 8:e7fce7d9ebdd 14 #define REFRESH_PERIOD 1 // (s)
sfaghihi 2:56a27b66d03a 15
sfaghihi 2:56a27b66d03a 16 class TimeClass {
amilner1 4:519ffdf16d25 17 public:
amilner1 4:519ffdf16d25 18 int hour;
amilner1 4:519ffdf16d25 19 int minute;
sfaghihi 8:e7fce7d9ebdd 20 float second;
sfaghihi 8:e7fce7d9ebdd 21 TimeClass(int h, int m, float s);
sfaghihi 8:e7fce7d9ebdd 22 void inc(float i);
sfaghihi 2:56a27b66d03a 23 };
sfaghihi 2:56a27b66d03a 24
sfaghihi 2:56a27b66d03a 25 class WeatherClass {
sfaghihi 7:5269fbadd5d7 26 public:
sfaghihi 7:5269fbadd5d7 27 WeatherClass();
sfaghihi 2:56a27b66d03a 28 };
sfaghihi 2:56a27b66d03a 29
sfaghihi 2:56a27b66d03a 30 class DateClass {
amilner1 5:fe6910712822 31 public:
amilner1 5:fe6910712822 32 int day;
amilner1 5:fe6910712822 33 int month;
amilner1 5:fe6910712822 34 int year;
amilner1 5:fe6910712822 35 int dow;
amilner1 5:fe6910712822 36 DateClass(int d, int m, int y, int dow);
sfaghihi 7:5269fbadd5d7 37 };
sfaghihi 7:5269fbadd5d7 38
sfaghihi 7:5269fbadd5d7 39 class StateClass {
sfaghihi 7:5269fbadd5d7 40 public:
sfaghihi 7:5269fbadd5d7 41 TimeClass *time;
sfaghihi 7:5269fbadd5d7 42 WeatherClass *weather;
sfaghihi 7:5269fbadd5d7 43 DateClass *date;
sfaghihi 7:5269fbadd5d7 44 TimeClass *alarm;
sfaghihi 7:5269fbadd5d7 45 int screenState;
sfaghihi 7:5269fbadd5d7 46 bool screenActive;
sfaghihi 7:5269fbadd5d7 47 StateClass(TimeClass *t, WeatherClass *w, DateClass *d, TimeClass *a);
sfaghihi 7:5269fbadd5d7 48 };
sfaghihi 7:5269fbadd5d7 49
sfaghihi 7:5269fbadd5d7 50 #endif