Project
Dependencies: Hotboards_keypad TextLCD eeprom
Diff: LCDDisplay.cpp
- Revision:
- 0:194ff03a2e6a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LCDDisplay.cpp Tue Oct 23 08:12:53 2018 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "TextLCD.h"
+#include <string>
+#include "Time.h"
+
+#define LCD_RS PC_2
+#define LCD_EN PC_3
+#define LCD_D4 PA_13
+#define LCD_D5 PA_14
+#define LCD_D6 PA_15
+#define LCD_D7 PB_7
+
+
+
+TextLCD lcd {LCD_RS,LCD_EN,LCD_D4,LCD_D5,LCD_D6,LCD_D7,TextLCD::LCD16x2};
+
+
+void Display_LCD(int col,int row,char *str)
+{
+
+lcd.locate(col,row);
+lcd.printf("%s",str);
+
+}
+void Clear_LCD(void)
+{
+ lcd.cls();
+}
+
+void Display_time(void)
+{
+ // Disable Interrupts
+ while(1)
+ {
+// do something that can't be interrupted
+ // Thread::signal_wait(0x1);
+ time_t curr_time;
+ tm * curr_tm;
+ char date_string[10];
+ char time_string[10];
+ time(&curr_time);
+ curr_tm = localtime(&curr_time);
+ strftime(date_string, 10, "%d%b%y", curr_tm);
+ strftime(time_string, 10, " %T", curr_tm);
+ lcd.locate(0,1);
+ lcd.printf("%s",date_string);
+ lcd.printf("%s",time_string);
+ wait(1);
+ }
+
+}