Demo program for driving the memory LCD on the Zero Gecko Starter Kit.

Dependencies:   MemoryLCD mbed

This demo program shows how to drive the memory LCD on the Zero Gecko Starter Kit, by using asynchronous transfers.

Information

All examples in this repo are considered EXPERIMENTAL QUALITY, meaning this code has been created as one-off proof-of-concept and is suitable as a demonstration for experimental purposes only. This code will not be regularly maintained by Silicon Labs and there is no guarantee that these projects will work across all environments, SDK versions and hardware.

Revision:
0:ecfcdf193e3d
Child:
2:66aa675cb1a7
Child:
6:f334f0adb99b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 17 19:24:23 2015 +0000
@@ -0,0 +1,84 @@
+#include "LS013B7DH03.h"
+#include "mbed_logo.h"
+/******************** Define I/O *****************************/
+DigitalOut myled(LED1);
+ 
+#define SCK     PD2
+#define MOSI    PD0
+ 
+DigitalOut CS(PD3);
+DigitalOut EXTCOM(PC4);
+DigitalOut EXTMODE(PD4);
+DigitalOut DISP(PD5);
+ 
+SPI displaySPI(MOSI, NC, SCK);
+silabs::LS013B7DH03 display(&displaySPI, &CS, &EXTCOM);
+ 
+/******************** Define Timers *****************************/
+ 
+LowPowerTicker timeKeeping;
+ 
+/***************** Define global variables **********************/
+#define INIT_SECONDS        17600
+ 
+volatile uint32_t prevSeconds = INIT_SECONDS, seconds = INIT_SECONDS;
+volatile bool refreshed = false;
+ 
+/***************** Define callback handlers *********************/
+void secondsCallback(void);
+void refreshCallback(void);
+ 
+void secondsCallback(void) {
+    seconds++;
+}
+ 
+/**
+ * Callback for refresh completion
+ */
+void refreshCallback(void) {
+    refreshed = true;
+}
+ 
+/*************************** MAIN *******************************/
+int main() {
+    // Enable the LCD
+    EXTMODE = 1;
+    DISP = 1;
+ 
+    // Start generating the 1Hz call for keeping time
+    timeKeeping.attach(&secondsCallback, 1.0f);
+ 
+    // Reset the LCD to a blank state. (All white)
+    refreshed = false;
+    display.clearImmediate(refreshCallback);
+    while(refreshed == false) sleep();
+ 
+    printf("Initialization done! \n");
+ 
+    // Apply mbed logo bitmap to the pixel buffer
+    display.showBMP((uint8_t*)mbed_enabled_logo, 128, 128, 0, 0);
+    display.printf("I like MBED!");
+ 
+    // Push update to the display
+    refreshed = false;
+    display.update(refreshCallback);
+ 
+    // Sleep while doing the transmit
+    while(refreshed == false) sleep();
+ 
+    // Go into clock mode
+    while(1) {
+        sleep();
+ 
+        // In clock mode, only update once per second
+        if(prevSeconds != seconds) {
+            display.locate(4,15);
+            display.printf("%02d:%02d:%02d", (seconds / 1200) % 24, (seconds / 60) % 60, seconds % 60);
+            if(refreshed == true) {
+                prevSeconds = seconds;
+                refreshed = false;
+                display.update(refreshCallback);
+            }
+        }
+    }
+}
\ No newline at end of file