Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
AlarmClock.h@0:d69dc4537754, 2015-06-25 (annotated)
- Committer:
 - takashikojo
 - Date:
 - Thu Jun 25 23:30:44 2015 +0000
 - Revision:
 - 0:d69dc4537754
 - Child:
 - 1:d544fbfb330c
 
Initial version
Who changed what in which revision?
| User | Revision | Line number | New 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 "7segment4LED.h" | 
| takashikojo | 0:d69dc4537754 | 6 | #include "DigitalClock.h" | 
| takashikojo | 0:d69dc4537754 | 7 | |
| takashikojo | 0:d69dc4537754 | 8 | class AlarmClock : public DigitalClock { | 
| takashikojo | 0:d69dc4537754 | 9 | public: | 
| takashikojo | 0:d69dc4537754 | 10 | AlarmClock (PinName seg0, PinName seg1, PinName seg2, PinName seg3, | 
| takashikojo | 0:d69dc4537754 | 11 | PinName seg4, PinName seg5, PinName seg6, PinName dot, | 
| takashikojo | 0:d69dc4537754 | 12 | PinName digit0, PinName digit1, PinName digit2, PinName digit3, | 
| takashikojo | 0:d69dc4537754 | 13 | PinName alartB, PinName hourB, PinName minB, PinName toneP | 
| takashikojo | 0:d69dc4537754 | 14 | ); | 
| takashikojo | 0:d69dc4537754 | 15 | ~AlarmClock(); | 
| takashikojo | 0:d69dc4537754 | 16 | bool getAlarm(int *h, int *min, int *sec) ; | 
| takashikojo | 0:d69dc4537754 | 17 | bool setAlarm(int h, int min, 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 | 0:d69dc4537754 | 40 | } ; | 
| takashikojo | 0:d69dc4537754 | 41 | |
| takashikojo | 0:d69dc4537754 | 42 | #endif |