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: RA8875 VS1053 sd-driver-hs
Diff: lcd_manager.cpp
- Revision:
- 3:a60dc00bf3a2
- Parent:
- 0:86f82f777a7a
diff -r a3d00f0610f9 -r a60dc00bf3a2 lcd_manager.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/lcd_manager.cpp Tue Mar 13 06:35:47 2018 +0000
@@ -0,0 +1,67 @@
+#include "mbed.h"
+#include "RA8875.h"
+#include "pinout.h"
+
+RA8875 lcd_m(MOSI_LCD, MISO_LCD, CLK_LCD, CS_LCD, NC, "tft");
+
+int x;
+int y;
+
+
+void init_lcd()
+{
+ lcd_m.init(480,272);
+ lcd_m.foreground(Orange);
+}
+
+void print(char data[59])
+{
+ int len = strlen(data);
+ for(int i =0; i<len; i++) {
+ lcd_m.SetTextCursor(x,y);
+ lcd_m.putc(data[i]);
+ x+=8;
+ if(data[i] == '\n') {
+ x=0;
+ y+=17;
+ }
+ }
+}
+
+void print_int(int a)
+{
+ char tmp[20];//max 20 digit number
+ sprintf(tmp,"%i",a);
+ print(tmp);
+}
+
+void print_double(double a)
+{
+ char tmp[20];//max 20 digit number
+ sprintf(tmp,"%f",a);
+ print(tmp);
+}
+
+
+void backspace()
+{
+ x-=8;
+ lcd_m.SetTextCursor(x,y);
+ lcd_m.putc(NULL);
+}
+
+void lcd_cls()
+{
+ lcd_m.cls();
+ x=0;
+ y=0;
+}
+
+void set_backlight(float back)
+{
+
+ lcd_m.Backlight(back);
+}
+
+
+