Clock with Real-Time Clock (RTC-8564) and I2C LCD module(SB1062B).
Dependencies: DebouncedEdgeIn I2cLCD_cursor Rtc8564 mbed beep
main.cpp@3:061cccf4093a, 2014-02-22 (annotated)
- Committer:
- togayan
- Date:
- Sat Feb 22 09:24:27 2014 +0000
- Revision:
- 3:061cccf4093a
- Parent:
- 2:6f0158399eff
- Child:
- 4:75ed86b78045
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
togayan | 0:86ab67787717 | 1 | #include "mbed.h" |
togayan | 0:86ab67787717 | 2 | #include "I2cLCD/I2cLCD.h" |
togayan | 0:86ab67787717 | 3 | #include "I2cRTC/I2cRTC.h" |
togayan | 0:86ab67787717 | 4 | #include "ViewModel/ClockViewModel.h" |
togayan | 1:f8713c387a68 | 5 | #include "Model/Clock.h" |
togayan | 1:f8713c387a68 | 6 | |
togayan | 1:f8713c387a68 | 7 | //Serial uart(dp16, dp15); |
togayan | 1:f8713c387a68 | 8 | DigitalOut myled(LED1); |
togayan | 0:86ab67787717 | 9 | |
togayan | 0:86ab67787717 | 10 | int main() |
togayan | 0:86ab67787717 | 11 | { |
togayan | 3:061cccf4093a | 12 | I2C i2c(dp5, dp27); //sda scl |
togayan | 3:061cccf4093a | 13 | I2cLCD lcd(i2c, dp26); //i2c reset |
togayan | 3:061cccf4093a | 14 | I2cRTC rtc(i2c, dp25, dp18); |
togayan | 3:061cccf4093a | 15 | ViewModel::ClockViewModel clockVm(lcd, dp1, dp2, dp4); // set increment decrement |
togayan | 1:f8713c387a68 | 16 | Model::Clock clock(&clockVm, &rtc); |
togayan | 3:061cccf4093a | 17 | clock.addSetMode(&rtc); |
togayan | 3:061cccf4093a | 18 | clock.addSetMode(&clockVm); |
togayan | 1:f8713c387a68 | 19 | rtc.setClock(&clock); |
togayan | 1:f8713c387a68 | 20 | clockVm.setClock(&clock); |
togayan | 2:6f0158399eff | 21 | clock.initialize(); |
togayan | 2:6f0158399eff | 22 | clockVm.initialize(); |
togayan | 2:6f0158399eff | 23 | rtc.start(); |
togayan | 0:86ab67787717 | 24 | |
togayan | 1:f8713c387a68 | 25 | while(1) { |
togayan | 2:6f0158399eff | 26 | myled = 1; |
togayan | 2:6f0158399eff | 27 | wait(0.5); |
togayan | 2:6f0158399eff | 28 | myled = 0; |
togayan | 2:6f0158399eff | 29 | wait(0.5); |
togayan | 1:f8713c387a68 | 30 | } |
togayan | 0:86ab67787717 | 31 | } |