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.
Dependencies: DebouncedEdgeIn I2cLCD_cursor Rtc8564 mbed beep
main.cpp
00001 #include "mbed.h" 00002 #include "I2cLCD/I2cLCD.h" 00003 #include "Rtc8564/Rtc8564.h" 00004 #include "ViewModel/ClockViewModel.h" 00005 #include "Mechanism/RtcMechanism.h" 00006 #include "Model/Clock.h" 00007 00008 extern "C" void HardFault_Handler() 00009 { 00010 puts("Hard Fault!"); 00011 while(1); 00012 } 00013 00014 void no_memory () 00015 { 00016 puts("panic: can't allocate to memory!"); 00017 exit(-1); 00018 } 00019 00020 int main() 00021 { 00022 set_new_handler(no_memory); 00023 00024 DigitalOut led(LED1); 00025 I2C i2c(dp5, dp27); //sda scl 00026 I2cLCD lcd(i2c, dp26); //i2c reset 00027 Rtc8564 rtc(i2c, dp25, PullUp); 00028 ViewModel::ClockViewModel clockVm(lcd, dp28, dp24, dp17, dp1, dp2); // set increment decrement sound1 sound2 00029 RtcMechanism rtcMechanism; 00030 Model::Clock clock(&clockVm, &rtcMechanism); 00031 clock.addSetMode(&rtcMechanism); 00032 clock.addSetMode(&clockVm); 00033 rtcMechanism.setClock(&clock); 00034 rtcMechanism.setRtc(&rtc); 00035 clockVm.setClock(&clock); 00036 clock.initialize(); 00037 clockVm.initialize(); 00038 rtc.initialize(); 00039 00040 while(1) { 00041 led = 1; 00042 wait(0.5); 00043 led = 0; 00044 wait(0.5); 00045 } 00046 }
Generated on Wed Jul 13 2022 02:25:45 by
1.7.2