Project
Dependencies: Hotboards_keypad TextLCD eeprom
LCDDisplay.cpp
00001 #include "mbed.h" 00002 #include "TextLCD.h" 00003 #include <string> 00004 #include "Time.h" 00005 00006 #define LCD_RS PC_2 00007 #define LCD_EN PC_3 00008 #define LCD_D4 PA_13 00009 #define LCD_D5 PA_14 00010 #define LCD_D6 PA_15 00011 #define LCD_D7 PB_7 00012 00013 00014 00015 TextLCD lcd {LCD_RS,LCD_EN,LCD_D4,LCD_D5,LCD_D6,LCD_D7,TextLCD::LCD16x2}; 00016 00017 00018 void Display_LCD(int col,int row,char *str) 00019 { 00020 00021 lcd.locate(col,row); 00022 lcd.printf("%s",str); 00023 00024 } 00025 void Clear_LCD(void) 00026 { 00027 lcd.cls(); 00028 } 00029 00030 void Display_time(void) 00031 { 00032 // Disable Interrupts 00033 while(1) 00034 { 00035 // do something that can't be interrupted 00036 // Thread::signal_wait(0x1); 00037 time_t curr_time; 00038 tm * curr_tm; 00039 char date_string[10]; 00040 char time_string[10]; 00041 time(&curr_time); 00042 curr_tm = localtime(&curr_time); 00043 strftime(date_string, 10, "%d%b%y", curr_tm); 00044 strftime(time_string, 10, " %T", curr_tm); 00045 lcd.locate(0,1); 00046 lcd.printf("%s",date_string); 00047 lcd.printf("%s",time_string); 00048 wait(1); 00049 } 00050 00051 }
Generated on Fri Jul 15 2022 15:37:46 by
1.7.2