Clock with Real-Time Clock (RTC-8564) and I2C LCD module(SB1062B).
Dependencies: DebouncedEdgeIn I2cLCD_cursor Rtc8564 mbed beep
ViewModel/ClockViewModel.h@6:e7073adacdc8, 2014-03-01 (annotated)
- Committer:
- togayan
- Date:
- Sat Mar 01 00:18:23 2014 +0000
- Revision:
- 6:e7073adacdc8
- Parent:
- 5:e374481e7554
Add indicator LED.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
togayan | 0:86ab67787717 | 1 | #ifndef CLOCK_VIEW_MODEL_H |
togayan | 0:86ab67787717 | 2 | #define CLOCK_VIEW_MODEL_H |
togayan | 0:86ab67787717 | 3 | |
togayan | 0:86ab67787717 | 4 | #include "mbed.h" |
togayan | 1:f8713c387a68 | 5 | #include "Model/Clock.h" |
togayan | 0:86ab67787717 | 6 | #include "I2cLCD/I2cLCD.h" |
togayan | 1:f8713c387a68 | 7 | #include "Model/I_NotifyUpdate.h" |
togayan | 4:75ed86b78045 | 8 | #include "DebouncedEdgeIn/DebouncedEdgeIn.h" |
togayan | 5:e374481e7554 | 9 | #include "beep.h" |
togayan | 0:86ab67787717 | 10 | |
togayan | 0:86ab67787717 | 11 | namespace ViewModel |
togayan | 0:86ab67787717 | 12 | { |
togayan | 3:061cccf4093a | 13 | class ClockViewModel : public Model::I_NotifyUpdate, public Model::I_SetMode |
togayan | 0:86ab67787717 | 14 | { |
togayan | 0:86ab67787717 | 15 | public: |
togayan | 5:e374481e7554 | 16 | ClockViewModel(I2cLCD& i2clcd, PinName set, PinName increment, PinName decrement, PinName sound1, PinName Sound2); |
togayan | 1:f8713c387a68 | 17 | void setClock(Model::Clock* clock); |
togayan | 0:86ab67787717 | 18 | void initialize(); |
togayan | 1:f8713c387a68 | 19 | |
togayan | 1:f8713c387a68 | 20 | virtual void dateTimeUpdated(); |
togayan | 2:6f0158399eff | 21 | virtual void mode(Model::OperationMode mode); |
togayan | 0:86ab67787717 | 22 | |
togayan | 0:86ab67787717 | 23 | private: |
togayan | 0:86ab67787717 | 24 | I2cLCD& m_i2clcd; |
togayan | 4:75ed86b78045 | 25 | DebouncedEdgeIn m_set; |
togayan | 4:75ed86b78045 | 26 | DebouncedEdgeIn m_increment; |
togayan | 4:75ed86b78045 | 27 | DebouncedEdgeIn m_decrement; |
togayan | 5:e374481e7554 | 28 | Beep m_beep; |
togayan | 5:e374481e7554 | 29 | DigitalOut m_beepGnd; |
togayan | 1:f8713c387a68 | 30 | Model::Clock* m_clock; |
togayan | 2:6f0158399eff | 31 | struct tm* m_dateTime; |
togayan | 2:6f0158399eff | 32 | Model::OperationMode m_mode; |
togayan | 2:6f0158399eff | 33 | static const char* WEEKDAYS[]; |
togayan | 5:e374481e7554 | 34 | |
togayan | 5:e374481e7554 | 35 | void modeButtonOn(); |
togayan | 2:6f0158399eff | 36 | void incrementButtonOn(); |
togayan | 2:6f0158399eff | 37 | void decrementButtonOn(); |
togayan | 2:6f0158399eff | 38 | void setCurSor(); |
togayan | 0:86ab67787717 | 39 | }; |
togayan | 0:86ab67787717 | 40 | } |
togayan | 0:86ab67787717 | 41 | |
togayan | 0:86ab67787717 | 42 | #endif // CLOCK_VIEW_MODEL_H |