Alarm Clock

Dependents:   IF-SmartClock

Committer:
takashikojo
Date:
Sun Nov 22 08:44:38 2015 +0000
Revision:
4:864d5c5f98ee
Parent:
1:d544fbfb330c
Cleaned debug messages

Who changed what in which revision?

UserRevisionLine numberNew contents of line
takashikojo 0:d69dc4537754 1 #ifndef ALARMCLOCK_H
takashikojo 0:d69dc4537754 2 #define ALARMCLOCK_H
takashikojo 0:d69dc4537754 3
takashikojo 0:d69dc4537754 4 #include "mbed.h"
takashikojo 0:d69dc4537754 5 #include "DigitalClock.h"
takashikojo 0:d69dc4537754 6
takashikojo 0:d69dc4537754 7 class AlarmClock : public DigitalClock {
takashikojo 0:d69dc4537754 8 public:
takashikojo 0:d69dc4537754 9 AlarmClock (PinName seg0, PinName seg1, PinName seg2, PinName seg3,
takashikojo 0:d69dc4537754 10 PinName seg4, PinName seg5, PinName seg6, PinName dot,
takashikojo 0:d69dc4537754 11 PinName digit0, PinName digit1, PinName digit2, PinName digit3,
takashikojo 0:d69dc4537754 12 PinName alartB, PinName hourB, PinName minB, PinName toneP
takashikojo 0:d69dc4537754 13 );
takashikojo 0:d69dc4537754 14 ~AlarmClock();
takashikojo 0:d69dc4537754 15 bool getAlarm(int *h, int *min, int *sec) ;
takashikojo 0:d69dc4537754 16 bool setAlarm(int h, int min, int sec) ;
takashikojo 4:864d5c5f98ee 17 void alarmAhead(int sec) ;
takashikojo 0:d69dc4537754 18 void alarmTone(bool) ;
takashikojo 0:d69dc4537754 19 void poll(void) ;
takashikojo 0:d69dc4537754 20
takashikojo 0:d69dc4537754 21 private:
takashikojo 0:d69dc4537754 22 DigitalIn *alarmButton ;
takashikojo 0:d69dc4537754 23 DigitalIn *hourButton ;
takashikojo 0:d69dc4537754 24 DigitalIn *minButton ;
takashikojo 0:d69dc4537754 25 PwmOut *tone ;
takashikojo 0:d69dc4537754 26
takashikojo 0:d69dc4537754 27 void checkAlarmTime(void) ;
takashikojo 0:d69dc4537754 28 void checkAlarmButton(void) ;
takashikojo 0:d69dc4537754 29 void checkHourButton(void) ;
takashikojo 0:d69dc4537754 30 void checkMinButton(void) ;
takashikojo 0:d69dc4537754 31 void checkButtons(void);
takashikojo 0:d69dc4537754 32 void checkTime(void) ;
takashikojo 0:d69dc4537754 33 time_t alarmTime ;
takashikojo 0:d69dc4537754 34 bool alarmActive ;
takashikojo 0:d69dc4537754 35 bool alarmB_stat ;
takashikojo 0:d69dc4537754 36 bool hourB_stat ;
takashikojo 0:d69dc4537754 37 bool minB_stat ;
takashikojo 0:d69dc4537754 38 bool newAlarmTime ;
takashikojo 0:d69dc4537754 39 bool timeMatched ;
takashikojo 4:864d5c5f98ee 40 int AlarmAhead ;
takashikojo 0:d69dc4537754 41 } ;
takashikojo 0:d69dc4537754 42
takashikojo 0:d69dc4537754 43 #endif