Embedded Artists
We are the leading providers of products and services around prototyping, evaluation and OEM platforms using NXP's ARM-based microcontrollers.
LPC4088DM Using DMBoard
The core of the software package for the display modules is the DMSupport library (described here) the core of that library and the starting point for all programs is the DMBoard class:
Import library
Public Member Functions |
|
BoardError | init () |
Initializes the wanted features.
|
|
void | setLED (Leds led, bool on) |
Controls the four LEDs on the
Display
Module.
|
|
void | buzzer (int frequency=0, int duration_ms=0) |
Controls the buzzer.
|
|
bool | buttonPressed () |
Test if the USER button is pressed or not.
|
|
TouchPanel * | touchPanel () |
Returns the
TouchPanel
interface.
|
|
Display * | display () |
Returns the
Display
interface.
|
|
RtosLog * | logger () |
Returns the logger interface.
|
|
Registry * | registry () |
Returns the
Registry
interface.
|
|
Static Public Member Functions |
|
static DMBoard & | instance () |
Get the only instance of the
DMBoard
.
|
Tightly coupled with the DMBoard class is the dm_board_config.h file:
/* * Copyright 2014 Embedded Artists AB * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef DM_BOARD_CONFIG_H #define DM_BOARD_CONFIG_H // Template to use for the project-specific settings. Copy this file to your project, // rename it to dm_board_config.h and uncomment the wanted features below: // #define DM_BOARD_USE_USB_DEVICE // #define DM_BOARD_USE_USB_HOST #define DM_BOARD_USE_MCI_FS #define DM_BOARD_USE_QSPI_FS // #define DM_BOARD_USE_QSPI #define DM_BOARD_USE_DISPLAY #define DM_BOARD_USE_TOUCH // #define DM_BOARD_USE_ETHERNET #define DM_BOARD_USE_FAST_UART // #define DM_BOARD_USE_USBSERIAL_IN_RTOSLOG // #define DM_BOARD_DISABLE_STANDARD_PRINTF // #define DM_BOARD_ENABLE_MEASSURING_PINS #define DM_BOARD_USE_REGISTRY #define DM_BOARD_USE_BUILTIN_IMAGES #endif
New Program Setup¶
When creating a new program in the mbed online compiler, selecting one of the predefined templates will get all the configuration for you, but if you prefer to create the program from scratch:
- Click the Import Library button above to open the import dialog in the online compiler
- Select a new program name and click Import. Do not select the Update all sub-libraries option.
- Wait for the import to complete
- Copy the DMSupport/dm_board_config.h.txt file to the root of your new program and rename it to dm_board_config.h
- Add a main.cpp file with this:
#include "mbed.h" #include "DMBoard.h" void 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; } // Everything initialized ok, add your code here } while(false); if (err != DMBoard::Ok) { log->printf("\nTERMINATING\n"); mbed_die(); } } }
dm_board_config.h¶
The configuration file has these options:
Option | Default On | Description | More |
---|---|---|---|
DM_BOARD_USE_USB_DEVICE | NO | Enable USB Device stack | (wiki) |
DM_BOARD_USE_USB_HOST | NO | Enable USB Host stack | (wiki), (wiki) |
DM_BOARD_USE_MCI_FS | NO | Enable uSD card file system | (wiki) |
DM_BOARD_USE_QSPI_FS | NO | Enable QSPI file system | (wiki) |
DM_BOARD_USE_QSPI | NO | Enable R/W of QSPI memory | (wiki) |
DM_BOARD_USE_DISPLAY | NO | Enable use of the display | (wiki) |
DM_BOARD_USE_TOUCH | NO | Enable use of the touch controller | (wiki) |
DM_BOARD_USE_ETHERNET | NO | Enable networking | (wiki) |
DM_BOARD_USE_FAST_UART | YES | Uses 115200baud instead of 9600baud on serial port | (wiki) |
DM_BOARD_USE_USBSERIAL_IN_RTOSLOG | NO | Redirects logging to USB Device Serial port | (wiki), (wiki) |
DM_BOARD_DISABLE_STANDARD_PRINTF | NO | Send all printf calls to /dev/null | |
DM_BOARD_ENABLE_MEASSURING_PINS | NO | Enable GPIO pins for time measurements | (wiki) |
DM_BOARD_USE_REGISTRY | YES | Use internal EEPROM to store Registry values | (wiki) |
DM_BOARD_USE_BUILTIN_IMAGES | YES | Enable DMBasicGUI to use prepared images for OK/CANCEL/REPEAT buttons |