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: BSP_DISCO_F746NG LCD_DISCO_F746NG mbed
Fork of DS1338 by
main.cpp
00001 #include "mbed.h" 00002 #include "ds1338.h" 00003 #include "LCD_DISCO_F746NG.h" 00004 00005 LCD_DISCO_F746NG lcd; 00006 00007 char date [50]; 00008 DigitalOut led1(LED1); 00009 00010 int main() { 00011 00012 struct tm time; 00013 Serial pc(USBTX, USBRX); 00014 pc.baud(9600); 00015 pc.printf("DS1338 Demo\r\n"); 00016 DS1338 ds1338(D14,D15); 00017 //#ifdef INIT_TIME 00018 00019 time.tm_sec=0; 00020 time.tm_min=46; 00021 time.tm_hour=13; 00022 time.tm_mday=12; 00023 time.tm_mon=9; 00024 time.tm_year=116; 00025 time.tm_wday=3; 00026 time.tm_yday=0; 00027 time.tm_isdst=0;*/ 00028 ds1338.writeTime(&time); 00029 //#endif 00030 00031 00032 while (true) { 00033 lcd.Clear(LCD_COLOR_RED); 00034 lcd.SetBackColor(LCD_COLOR_RED); 00035 lcd.SetTextColor(LCD_COLOR_WHITE); 00036 sprintf((char*)date, "TIME: %s", asctime(&time)); 00037 lcd.DisplayStringAt(0, LINE(1), (uint8_t *)date, LEFT_MODE); 00038 wait(0.5); 00039 ds1338.readTime(&time); 00040 pc.printf("time at %s\r\n",asctime(&time)); 00041 } 00042 00043 }
Generated on Sat Jul 23 2022 00:05:09 by
1.7.2
