Dependencies: DMSupport DMemWin
Diff: main.cpp
- Revision:
- 0:08606a13a816
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jun 02 05:04:57 2016 +0000 @@ -0,0 +1,59 @@ +#include "mbed.h" +#include "DMBoard.h" +#include "EwHAL.h" +#include "WM.h" + +void MainTask(void); + + +extern "C" void mbed_mac_address(char *mac) +{ + mac[0] = 0x00; + mac[1] = 0x02; + mac[2] = 0xF7; + mac[3] = 0xF0; + mac[4] = 0x00; + mac[5] = 0x00; +}; + + +int main() +{ +// set_time(1461971280); + DMBoard::BoardError err; + DMBoard* board = &DMBoard::instance(); + RtosLog* log = board->logger(); + Display* disp = board->display(); + + do { + err = board->init(); + if (err != DMBoard::Ok) { + log->printf("Failed to initialize the board, got error %d\r\n", err); + break; + } + + log->printf("\n\nHello World!\r\n\n"); + + // Create the HAL for emWin + // - Use 3 frame buffers for tripple-buffering + // - Allow emWin to use 12MByte of external SDRAM + EwHAL hal(3, 12*1024*1024); + + // Start display in default mode (16-bit) + Display::DisplayError disperr = disp->powerUp(hal.getFrameBufferAddress()); + if (disperr != Display::DisplayError_Ok) { + log->printf("Failed to initialize the display, got error %d\r\n", disperr); + break; + } + + // Add extra options here + // - Set WM_CF_MEMDEV option to use "Memory Devices" to reduce flickering + WM_SetCreateFlags(WM_CF_MEMDEV); + + // Execute the emWin example and never return... + MainTask(); + } while(false); + + mbed_die(); +} +