Template for creating new programs for the LPC4088 Display Module
Dependencies: DMBasicGUI DMSupport
Fork of lpc4088_displaymodule_hello_world by
A minimal example showing how to initialize the display module and draw a message on the display.
This project can be selected as a template when creating a new project based on the LPC4088 Display Module.
Information
This project works on both the 4.3" and 5" display modules.
This is what it looks like:
Diff: main.cpp
- Revision:
- 7:791d32dd9dd9
- Parent:
- 0:8ef5f57e33dc
--- a/main.cpp Thu Oct 17 09:44:11 2019 +0000 +++ b/main.cpp Wed Oct 23 07:00:18 2019 +0000 @@ -1,15 +1,17 @@ #include "mbed.h" +#include "platform/mbed_thread.h" #include "DMBoard.h" #include "lpc_swim.h" #include "lpc_swim_font.h" int main() { + DMBoard::BoardError err; DMBoard* board = &DMBoard::instance(); RtosLog* log = board->logger(); Display* disp = board->display(); - + do { err = board->init(); if (err != DMBoard::Ok) { @@ -26,7 +28,7 @@ err = DMBoard::MemoryError; break; } - + // Prepare fullscreen swim_window_open(&win, disp->width(), disp->height(), // full size @@ -37,19 +39,20 @@ swim_set_title(&win, "My Program", BLACK); // Message - swim_put_text_xy(&win, "Hello World!", 100, 100); - + swim_put_text_xy(&win, "Hello World!", 100, 100); + // Start display in default mode (16-bit) - Display::DisplayError disperr = disp->powerUp(fb); + Display::DisplayError disperr = disp->powerUp(fb); if (disperr != Display::DisplayError_Ok) { log->printf("Failed to initialize the display, got error %d\r\n", disperr); break; } + } while(false); if (err != DMBoard::Ok) { log->printf("\nTERMINATING\n"); - wait_ms(2000); // allow RtosLog to flush messages + thread_sleep_for(2000); // allow RtosLog to flush messages mbed_die(); }