Example using the support package for LPC4088 DisplayModule

Dependencies:   DMBasicGUI DMSupport

Example using a lot of the features in the software package for the LPC4088 Display Module.

This project can be selected as a template when creating a new project based on the LPC4088 Display Module.

Information

This project works on the 4.3" display modules.

Some of the apps works on the 5" display modules. The ImageViewer and Slideshow app will show the images distorted as it does not take the resolution into consideration.

Information

The USB Status app is disabled. The Image viewer looks for images in the root of SD cards, USB memory sticks or the file system on the QSPI flash. The Slideshow app expects to find a slideshow script in /mci/elec14/ea_logo.txt.

This is what it looks like on the 4.3" display:

/media/uploads/embeddedartists/everything_cap_000.png /media/uploads/embeddedartists/everything_cap_001.png /media/uploads/embeddedartists/everything_cap_003.png /media/uploads/embeddedartists/everything_cap_004.png /media/uploads/embeddedartists/everything_cap_006.png /media/uploads/embeddedartists/everything_cap_008.png

Committer:
embeddedartists
Date:
Tue Dec 02 15:23:10 2014 +0000
Revision:
0:dfad71908d59
Child:
1:15ea03d72dd7
First version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:dfad71908d59 1 /******************************************************************************
embeddedartists 0:dfad71908d59 2 * Includes
embeddedartists 0:dfad71908d59 3 *****************************************************************************/
embeddedartists 0:dfad71908d59 4
embeddedartists 0:dfad71908d59 5 #include "mbed.h"
embeddedartists 0:dfad71908d59 6 #include "mbed_interface.h"
embeddedartists 0:dfad71908d59 7 #include "rtos.h"
embeddedartists 0:dfad71908d59 8 #include "EthernetInterface.h"
embeddedartists 0:dfad71908d59 9 #include "HTTPServer.h"
embeddedartists 0:dfad71908d59 10 #include "mbed_rpc.h"
embeddedartists 0:dfad71908d59 11 #include "USBHostMSD.h"
embeddedartists 0:dfad71908d59 12
embeddedartists 0:dfad71908d59 13 #include "DMBoard.h"
embeddedartists 0:dfad71908d59 14 #include "Graphics.h"
embeddedartists 0:dfad71908d59 15
embeddedartists 0:dfad71908d59 16 /******************************************************************************
embeddedartists 0:dfad71908d59 17 * Typedefs and defines
embeddedartists 0:dfad71908d59 18 *****************************************************************************/
embeddedartists 0:dfad71908d59 19
embeddedartists 0:dfad71908d59 20 /* Number of colors in 565 mode */
embeddedartists 0:dfad71908d59 21 #define NUM_COLORS 65536
embeddedartists 0:dfad71908d59 22 /* Number of red colors in 565 mode */
embeddedartists 0:dfad71908d59 23 #define RED_COLORS 0x20
embeddedartists 0:dfad71908d59 24 /* Number of green colors in 565 mode */
embeddedartists 0:dfad71908d59 25 #define GREEN_COLORS 0x40
embeddedartists 0:dfad71908d59 26 /* Number of blue colors in 565 mode */
embeddedartists 0:dfad71908d59 27 #define BLUE_COLORS 0x20
embeddedartists 0:dfad71908d59 28 /* Black color, 565 mode */
embeddedartists 0:dfad71908d59 29 #define BLACK 0x0000
embeddedartists 0:dfad71908d59 30
embeddedartists 0:dfad71908d59 31 /******************************************************************************
embeddedartists 0:dfad71908d59 32 * Local variables
embeddedartists 0:dfad71908d59 33 *****************************************************************************/
embeddedartists 0:dfad71908d59 34
embeddedartists 0:dfad71908d59 35 EthernetInterface eth;
embeddedartists 0:dfad71908d59 36
embeddedartists 0:dfad71908d59 37 /******************************************************************************
embeddedartists 0:dfad71908d59 38 * Global variables
embeddedartists 0:dfad71908d59 39 *****************************************************************************/
embeddedartists 0:dfad71908d59 40
embeddedartists 0:dfad71908d59 41 /******************************************************************************
embeddedartists 0:dfad71908d59 42 * Local functions
embeddedartists 0:dfad71908d59 43 *****************************************************************************/
embeddedartists 0:dfad71908d59 44
embeddedartists 0:dfad71908d59 45 static void verticalLine16(uint16_t* framebuffer, int w, int x, int y0, int y1, uint16_t color)
embeddedartists 0:dfad71908d59 46 {
embeddedartists 0:dfad71908d59 47 if (x < w) {
embeddedartists 0:dfad71908d59 48 int h = y1 - y0 + 1;
embeddedartists 0:dfad71908d59 49 uint16_t* fb = framebuffer;
embeddedartists 0:dfad71908d59 50 fb += x;
embeddedartists 0:dfad71908d59 51 fb += y0 * w;
embeddedartists 0:dfad71908d59 52 for (int i = 0; i < h; i++) {
embeddedartists 0:dfad71908d59 53 *fb = color;
embeddedartists 0:dfad71908d59 54 fb += w;
embeddedartists 0:dfad71908d59 55 }
embeddedartists 0:dfad71908d59 56 }
embeddedartists 0:dfad71908d59 57 }
embeddedartists 0:dfad71908d59 58
embeddedartists 0:dfad71908d59 59 /**
embeddedartists 0:dfad71908d59 60 * Draw color bars to the display
embeddedartists 0:dfad71908d59 61 */
embeddedartists 0:dfad71908d59 62 static void drawBars565(uint16_t* framebuffer, int w, int h)
embeddedartists 0:dfad71908d59 63 {
embeddedartists 0:dfad71908d59 64 uint16_t clr;
embeddedartists 0:dfad71908d59 65 uint16_t xgs, ygs, curx, cury, curym, xidx;
embeddedartists 0:dfad71908d59 66 int idx;
embeddedartists 0:dfad71908d59 67
embeddedartists 0:dfad71908d59 68 /* Compute vertical size for bars */
embeddedartists 0:dfad71908d59 69 ygs = h / 3;
embeddedartists 0:dfad71908d59 70
embeddedartists 0:dfad71908d59 71 /* Draw Red bars */
embeddedartists 0:dfad71908d59 72 cury = 0;
embeddedartists 0:dfad71908d59 73 curx = 0;
embeddedartists 0:dfad71908d59 74 curym = ygs - 1;
embeddedartists 0:dfad71908d59 75 xgs = w / RED_COLORS;
embeddedartists 0:dfad71908d59 76 clr = BLACK;
embeddedartists 0:dfad71908d59 77 for (xidx = 0; xidx < RED_COLORS; xidx++)
embeddedartists 0:dfad71908d59 78 {
embeddedartists 0:dfad71908d59 79 //swim_set_pen_color(win1, clr);
embeddedartists 0:dfad71908d59 80 for (idx = 0; idx <= xgs; idx++)
embeddedartists 0:dfad71908d59 81 {
embeddedartists 0:dfad71908d59 82 //swim_put_line(win1, curx, cury, curx, curym);
embeddedartists 0:dfad71908d59 83 //g.put_line(curx, cury, curx, curym, clr);
embeddedartists 0:dfad71908d59 84 verticalLine16(framebuffer, w, curx, cury, curym, clr);
embeddedartists 0:dfad71908d59 85 curx++;
embeddedartists 0:dfad71908d59 86 }
embeddedartists 0:dfad71908d59 87 clr = clr + 0x0800;
embeddedartists 0:dfad71908d59 88 }
embeddedartists 0:dfad71908d59 89
embeddedartists 0:dfad71908d59 90 /* Draw green bars */
embeddedartists 0:dfad71908d59 91 cury = cury + ygs;
embeddedartists 0:dfad71908d59 92 curx = 0;
embeddedartists 0:dfad71908d59 93 curym = cury + (ygs - 1);
embeddedartists 0:dfad71908d59 94 xgs = w / GREEN_COLORS;
embeddedartists 0:dfad71908d59 95 clr = BLACK;
embeddedartists 0:dfad71908d59 96 for (xidx = 0; xidx < GREEN_COLORS; xidx++)
embeddedartists 0:dfad71908d59 97 {
embeddedartists 0:dfad71908d59 98 //swim_set_pen_color(win1, clr);
embeddedartists 0:dfad71908d59 99 for (idx = 0; idx <= xgs; idx++)
embeddedartists 0:dfad71908d59 100 {
embeddedartists 0:dfad71908d59 101 //swim_put_line(win1, curx, cury, curx, curym);
embeddedartists 0:dfad71908d59 102 //g.put_line(curx, cury, curx, curym, clr);
embeddedartists 0:dfad71908d59 103 verticalLine16(framebuffer, w, curx, cury, curym, clr);
embeddedartists 0:dfad71908d59 104 curx++;
embeddedartists 0:dfad71908d59 105 }
embeddedartists 0:dfad71908d59 106 clr = clr + 0x0020;
embeddedartists 0:dfad71908d59 107 }
embeddedartists 0:dfad71908d59 108
embeddedartists 0:dfad71908d59 109 /* Draw blue bars */
embeddedartists 0:dfad71908d59 110 cury = cury + ygs;
embeddedartists 0:dfad71908d59 111 curx = 0;
embeddedartists 0:dfad71908d59 112 curym = h - 1;//cury + (ygs - 1);
embeddedartists 0:dfad71908d59 113 xgs = w / BLUE_COLORS;
embeddedartists 0:dfad71908d59 114 clr = BLACK;
embeddedartists 0:dfad71908d59 115 for (xidx = 0; xidx < BLUE_COLORS; xidx++)
embeddedartists 0:dfad71908d59 116 {
embeddedartists 0:dfad71908d59 117 //swim_set_pen_color(win1, clr);
embeddedartists 0:dfad71908d59 118 for (idx = 0; idx <= xgs; idx++)
embeddedartists 0:dfad71908d59 119 {
embeddedartists 0:dfad71908d59 120 //swim_put_line(win1, curx, cury, curx, curym);
embeddedartists 0:dfad71908d59 121 //g.put_line(curx, cury, curx, curym, clr);
embeddedartists 0:dfad71908d59 122 verticalLine16(framebuffer, w, curx, cury, curym, clr);
embeddedartists 0:dfad71908d59 123 curx++;
embeddedartists 0:dfad71908d59 124 }
embeddedartists 0:dfad71908d59 125 clr = clr + 0x0001;
embeddedartists 0:dfad71908d59 126 }
embeddedartists 0:dfad71908d59 127 }
embeddedartists 0:dfad71908d59 128
embeddedartists 0:dfad71908d59 129
embeddedartists 0:dfad71908d59 130
embeddedartists 0:dfad71908d59 131 void aliveTask(void const* args)
embeddedartists 0:dfad71908d59 132 {
embeddedartists 0:dfad71908d59 133 DMBoard* board = &DMBoard::instance();
embeddedartists 0:dfad71908d59 134
embeddedartists 0:dfad71908d59 135 while(true)
embeddedartists 0:dfad71908d59 136 {
embeddedartists 0:dfad71908d59 137 board->setLED(DMBoard::Led4, false);
embeddedartists 0:dfad71908d59 138 board->setLED(DMBoard::Led1, true);
embeddedartists 0:dfad71908d59 139 Thread::wait(300);
embeddedartists 0:dfad71908d59 140 board->setLED(DMBoard::Led1, false);
embeddedartists 0:dfad71908d59 141 board->setLED(DMBoard::Led2, true);
embeddedartists 0:dfad71908d59 142 Thread::wait(300);
embeddedartists 0:dfad71908d59 143 board->setLED(DMBoard::Led2, false);
embeddedartists 0:dfad71908d59 144 board->setLED(DMBoard::Led3, true);
embeddedartists 0:dfad71908d59 145 Thread::wait(300);
embeddedartists 0:dfad71908d59 146 board->setLED(DMBoard::Led3, false);
embeddedartists 0:dfad71908d59 147 board->setLED(DMBoard::Led4, true);
embeddedartists 0:dfad71908d59 148 Thread::wait(300);
embeddedartists 0:dfad71908d59 149 }
embeddedartists 0:dfad71908d59 150 }
embeddedartists 0:dfad71908d59 151
embeddedartists 0:dfad71908d59 152 /*
embeddedartists 0:dfad71908d59 153 * Reads the /message.txt file from the file system and prints the content
embeddedartists 0:dfad71908d59 154 */
embeddedartists 0:dfad71908d59 155 void readMessageFile(const char* prefix)
embeddedartists 0:dfad71908d59 156 {
embeddedartists 0:dfad71908d59 157 RtosLog* log = DMBoard::instance().logger();
embeddedartists 0:dfad71908d59 158 log->printf("%sTesting to read from USB\n", prefix);
embeddedartists 0:dfad71908d59 159
embeddedartists 0:dfad71908d59 160 FILE * fp = fopen("/usb/test1.txt", "r");
embeddedartists 0:dfad71908d59 161
embeddedartists 0:dfad71908d59 162 if (fp != NULL) {
embeddedartists 0:dfad71908d59 163 uint8_t* buff = (uint8_t*)malloc(1024+1);
embeddedartists 0:dfad71908d59 164 if (buff == NULL) {
embeddedartists 0:dfad71908d59 165 log->printf("%sFailed to allocate memory for test\n", prefix);
embeddedartists 0:dfad71908d59 166 } else {
embeddedartists 0:dfad71908d59 167 int num = fread(buff, 1, 1024, fp);
embeddedartists 0:dfad71908d59 168 if (num <= 0) {
embeddedartists 0:dfad71908d59 169 log->printf("%sUnable to read file, got %d as result\n", prefix, num);
embeddedartists 0:dfad71908d59 170 } else if (num < 1024) {
embeddedartists 0:dfad71908d59 171 log->printf("%sHave read all %d bytes in the file\n", prefix, num);
embeddedartists 0:dfad71908d59 172 buff[num] = '\0';
embeddedartists 0:dfad71908d59 173 log->printf((const char*)buff);
embeddedartists 0:dfad71908d59 174 } else {
embeddedartists 0:dfad71908d59 175 log->printf("%sHave read %d bytes with more to read\n", prefix, num);
embeddedartists 0:dfad71908d59 176 }
embeddedartists 0:dfad71908d59 177 free(buff);
embeddedartists 0:dfad71908d59 178 }
embeddedartists 0:dfad71908d59 179 fclose(fp);
embeddedartists 0:dfad71908d59 180 } else {
embeddedartists 0:dfad71908d59 181 log->printf("%sFILE == NULL\r\n", prefix);
embeddedartists 0:dfad71908d59 182 }
embeddedartists 0:dfad71908d59 183 }
embeddedartists 0:dfad71908d59 184
embeddedartists 0:dfad71908d59 185
embeddedartists 0:dfad71908d59 186 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:dfad71908d59 187 #define DISPLAY_TASK_PREFIX "[LCD] "
embeddedartists 0:dfad71908d59 188 void displayTask(void const* args)
embeddedartists 0:dfad71908d59 189 {
embeddedartists 0:dfad71908d59 190 // Start display in default mode (16-bit)
embeddedartists 0:dfad71908d59 191 RtosLog* log = DMBoard::instance().logger();
embeddedartists 0:dfad71908d59 192 Display* disp = DMBoard::instance().display();
embeddedartists 0:dfad71908d59 193 Display::DisplayError disperr;
embeddedartists 0:dfad71908d59 194 uint16_t* fb = (uint16_t*)disp->allocateFramebuffer();
embeddedartists 0:dfad71908d59 195 if (fb == NULL) {
embeddedartists 0:dfad71908d59 196 log->printf(DISPLAY_TASK_PREFIX"Failed to allocate memory for framebuffer\r\n");
embeddedartists 0:dfad71908d59 197 mbed_die();
embeddedartists 0:dfad71908d59 198 }
embeddedartists 0:dfad71908d59 199 drawBars565(fb, disp->width(), disp->height());
embeddedartists 0:dfad71908d59 200 disperr = disp->powerUp(fb);
embeddedartists 0:dfad71908d59 201 if (disperr != Display::Ok) {
embeddedartists 0:dfad71908d59 202 log->printf(DISPLAY_TASK_PREFIX"Failed to initialize the display, got error %d\r\n", disperr);
embeddedartists 0:dfad71908d59 203 mbed_die();
embeddedartists 0:dfad71908d59 204 }
embeddedartists 0:dfad71908d59 205
embeddedartists 0:dfad71908d59 206 int h = disp->height();
embeddedartists 0:dfad71908d59 207 int w = disp->width();
embeddedartists 0:dfad71908d59 208 uint16_t COLORS[] = { 0xFFF0, 0xF800, 0x07E0, 0x001F, 0x07FF, 0xF81F };
embeddedartists 0:dfad71908d59 209 int i = 0;
embeddedartists 0:dfad71908d59 210 while(true) {
embeddedartists 0:dfad71908d59 211 uint16_t color = COLORS[i++ % (sizeof(COLORS)/sizeof(COLORS[0]))];
embeddedartists 0:dfad71908d59 212 for (int y = 0; y < h; y++) {
embeddedartists 0:dfad71908d59 213 for (int x = 0; x < w; x++) {
embeddedartists 0:dfad71908d59 214 fb[y*w+x] = color;
embeddedartists 0:dfad71908d59 215 }
embeddedartists 0:dfad71908d59 216 Thread::wait(30);
embeddedartists 0:dfad71908d59 217 }
embeddedartists 0:dfad71908d59 218
embeddedartists 0:dfad71908d59 219 // test to read the message file
embeddedartists 0:dfad71908d59 220 //readMessageFile(DISPLAY_TASK_PREFIX);
embeddedartists 0:dfad71908d59 221 }
embeddedartists 0:dfad71908d59 222 }
embeddedartists 0:dfad71908d59 223 #endif //DM_BOARD_USE_DISPLAY
embeddedartists 0:dfad71908d59 224
embeddedartists 0:dfad71908d59 225 #define MSD_TASK_PREFIX "[MSD] "
embeddedartists 0:dfad71908d59 226
embeddedartists 0:dfad71908d59 227 void msdTask(void const* args)
embeddedartists 0:dfad71908d59 228 {
embeddedartists 0:dfad71908d59 229 USBHostMSD msd("usb");
embeddedartists 0:dfad71908d59 230 USBHost* host = USBHost::getHostInst();
embeddedartists 0:dfad71908d59 231 RtosLog* log = DMBoard::instance().logger();
embeddedartists 0:dfad71908d59 232
embeddedartists 0:dfad71908d59 233 log->printf(MSD_TASK_PREFIX"msdTask started\n");
embeddedartists 0:dfad71908d59 234
embeddedartists 0:dfad71908d59 235 while(1) {
embeddedartists 0:dfad71908d59 236
embeddedartists 0:dfad71908d59 237 log->printf(MSD_TASK_PREFIX"Attempting to connect...\n");
embeddedartists 0:dfad71908d59 238
embeddedartists 0:dfad71908d59 239 // try to connect a MSD device
embeddedartists 0:dfad71908d59 240 while(!msd.connect()) {
embeddedartists 0:dfad71908d59 241 // log->printf(MSD_TASK_PREFIX"Failed to connect, waiting 5s and trying again!\n");
embeddedartists 0:dfad71908d59 242 // Thread::wait(5000);
embeddedartists 0:dfad71908d59 243 log->printf(MSD_TASK_PREFIX"Failed to connect, press button to try again!\n");
embeddedartists 0:dfad71908d59 244 while(!DMBoard::instance().buttonPressed()) {
embeddedartists 0:dfad71908d59 245 Thread::wait(20);
embeddedartists 0:dfad71908d59 246 }
embeddedartists 0:dfad71908d59 247 Thread::wait(40);
embeddedartists 0:dfad71908d59 248 while(DMBoard::instance().buttonPressed()) {
embeddedartists 0:dfad71908d59 249 Thread::wait(20);
embeddedartists 0:dfad71908d59 250 }
embeddedartists 0:dfad71908d59 251 log->printf(MSD_TASK_PREFIX"Attempting to connect...\n");
embeddedartists 0:dfad71908d59 252 }
embeddedartists 0:dfad71908d59 253
embeddedartists 0:dfad71908d59 254 log->printf(MSD_TASK_PREFIX"Connected!\n");
embeddedartists 0:dfad71908d59 255
embeddedartists 0:dfad71908d59 256 // read a file
embeddedartists 0:dfad71908d59 257 readMessageFile(MSD_TASK_PREFIX);
embeddedartists 0:dfad71908d59 258
embeddedartists 0:dfad71908d59 259 // if/when the device is disconnected, we try to connect it again
embeddedartists 0:dfad71908d59 260 while(1) {
embeddedartists 0:dfad71908d59 261
embeddedartists 0:dfad71908d59 262 Thread::wait(500);
embeddedartists 0:dfad71908d59 263
embeddedartists 0:dfad71908d59 264 // if device disconnected, try to connect again
embeddedartists 0:dfad71908d59 265 if (!msd.connected())
embeddedartists 0:dfad71908d59 266 break;
embeddedartists 0:dfad71908d59 267 }
embeddedartists 0:dfad71908d59 268 log->printf(MSD_TASK_PREFIX"Disconnected\n");
embeddedartists 0:dfad71908d59 269 }
embeddedartists 0:dfad71908d59 270 }
embeddedartists 0:dfad71908d59 271
embeddedartists 0:dfad71908d59 272 #define NET_TASK_PREFIX "[NET] "
embeddedartists 0:dfad71908d59 273
embeddedartists 0:dfad71908d59 274 void netTask(void const* args)
embeddedartists 0:dfad71908d59 275 {
embeddedartists 0:dfad71908d59 276 RtosLog* log = DMBoard::instance().logger();
embeddedartists 0:dfad71908d59 277 log->printf(NET_TASK_PREFIX"EthernetInterface Setting up...\r\n");
embeddedartists 0:dfad71908d59 278 if(eth.init()!=0) { //for DHCP Server
embeddedartists 0:dfad71908d59 279 //if(eth.init(IPAddress,NetMasks,Gateway)!=0) { //for Static IP Address
embeddedartists 0:dfad71908d59 280 log->printf(NET_TASK_PREFIX"EthernetInterface Initialize Error \r\n");
embeddedartists 0:dfad71908d59 281 mbed_die();
embeddedartists 0:dfad71908d59 282 }
embeddedartists 0:dfad71908d59 283 if(eth.connect()!=0) {
embeddedartists 0:dfad71908d59 284 log->printf(NET_TASK_PREFIX"EthernetInterface Connect Error \r\n");
embeddedartists 0:dfad71908d59 285 mbed_die();
embeddedartists 0:dfad71908d59 286 }
embeddedartists 0:dfad71908d59 287
embeddedartists 0:dfad71908d59 288 log->printf(NET_TASK_PREFIX"IP Address is %s\r\n", eth.getIPAddress());
embeddedartists 0:dfad71908d59 289 log->printf(NET_TASK_PREFIX"NetMask is %s\r\n", eth.getNetworkMask());
embeddedartists 0:dfad71908d59 290 log->printf(NET_TASK_PREFIX"Gateway Address is %s\r\n", eth.getGateway());
embeddedartists 0:dfad71908d59 291 log->printf(NET_TASK_PREFIX"Ethernet Setup OK\r\n");
embeddedartists 0:dfad71908d59 292
embeddedartists 0:dfad71908d59 293 HTTPServerAddHandler<SimpleHandler>("/hello"); //Default handler
embeddedartists 0:dfad71908d59 294 FSHandler::mount("/usb", "/");
embeddedartists 0:dfad71908d59 295 HTTPServerAddHandler<FSHandler>("/");
embeddedartists 0:dfad71908d59 296 //HTTPServerAddHandler<RPCHandler>("/rpc");
embeddedartists 0:dfad71908d59 297 //lcd.locate(0,0);
embeddedartists 0:dfad71908d59 298 //lcd.printf("%s",eth.getIPAddress());
embeddedartists 0:dfad71908d59 299 HTTPServerStart(80);
embeddedartists 0:dfad71908d59 300 }
embeddedartists 0:dfad71908d59 301
embeddedartists 0:dfad71908d59 302 /******************************************************************************
embeddedartists 0:dfad71908d59 303 * Main function
embeddedartists 0:dfad71908d59 304 *****************************************************************************/
embeddedartists 0:dfad71908d59 305 int main()
embeddedartists 0:dfad71908d59 306 {
embeddedartists 0:dfad71908d59 307 DMBoard::BoardError err;
embeddedartists 0:dfad71908d59 308 DMBoard* board = &DMBoard::instance();
embeddedartists 0:dfad71908d59 309 RtosLog* log = board->logger();
embeddedartists 0:dfad71908d59 310 err = board->init();
embeddedartists 0:dfad71908d59 311 if (err != DMBoard::Ok) {
embeddedartists 0:dfad71908d59 312 log->printf("Failed to initialize the board, got error %d\r\n", err);
embeddedartists 0:dfad71908d59 313 mbed_die();
embeddedartists 0:dfad71908d59 314 }
embeddedartists 0:dfad71908d59 315
embeddedartists 0:dfad71908d59 316 log->printf("\n\n---\nMulti-threaded demo\nBuilt: " __DATE__ " at " __TIME__ "\n\n");
embeddedartists 0:dfad71908d59 317
embeddedartists 0:dfad71908d59 318 log->printf("Press button to start...\r\n");
embeddedartists 0:dfad71908d59 319 while(!board->buttonPressed());
embeddedartists 0:dfad71908d59 320 while(board->buttonPressed());
embeddedartists 0:dfad71908d59 321
embeddedartists 0:dfad71908d59 322 Thread tAlive(aliveTask);
embeddedartists 0:dfad71908d59 323 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:dfad71908d59 324 Thread tDisplay(displayTask, NULL, osPriorityNormal, 8192);
embeddedartists 0:dfad71908d59 325 #endif
embeddedartists 0:dfad71908d59 326 Thread tMemstick(msdTask, NULL, osPriorityNormal, 8192);
embeddedartists 0:dfad71908d59 327 Thread tNetwork(netTask, NULL, osPriorityNormal, 8192);
embeddedartists 0:dfad71908d59 328
embeddedartists 0:dfad71908d59 329 while(1) { wait(5); }
embeddedartists 0:dfad71908d59 330 }