A simple Hello World program, to demonstrate the current problem with the dm_board_config.h file - if it is in its normal place, the root directory, the project will not build, while if I copy it to the DMSupport subdirectory, the project builds OK.

Dependencies:   DMBasicGUI DMSupport

main.cpp

Committer:
jmitc91516
Date:
2018-10-04
Revision:
0:4d73151d9b87

File content as of revision 0:4d73151d9b87:

#include "mbed.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) {
      log->printf("Failed to initialize the board, got error %d\r\n", err);
      break;
    }
    
    log->printf("\n\nHello World!\n\n");
    
    SWIM_WINDOW_T win;
    void* fb = disp->allocateFramebuffer();
    if (fb == NULL) {
      log->printf("Failed to allocate memory for a frame buffer\r\n");
      err = DMBoard::MemoryError;
      break;
    }
    
    // Prepare fullscreen
    swim_window_open(&win, 
                     disp->width(), disp->height(),         // full size
                     (COLOR_T*)fb,
                     0,0,disp->width()-1, disp->height()-1, // window position and size
                     1,                                     // border
                     WHITE, BLUE, BLACK);                   // colors: pen, backgr, forgr
    swim_set_title(&win, "My Program", BLACK);
  
    // Message
    swim_put_text_xy(&win, "Hello World!", 100, 100);
    
    // Start display in default mode (16-bit)
    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
    mbed_die();
  }  

  while(true) {
  }   
}