A board support package for the LPC4088 Display Module.

Dependencies:   DM_HttpServer DM_USBHost

Dependents:   lpc4088_displaymodule_emwin lpc4088_displaymodule_demo_sphere sampleGUI sampleEmptyGUI ... more

Fork of DMSupport by EmbeddedArtists AB

Committer:
embeddedartists
Date:
Fri Dec 19 09:03:25 2014 +0100
Revision:
10:1ac4b213f0f7
Parent:
9:a33326afd686
Child:
17:4ea2509445ac
- Added support for executing code in SDRAM.
- Restructured the Display/Touch interfaces.
- Added loading of Display/Touch BIOS.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
embeddedartists 0:6b68dac0d986 1 /*
embeddedartists 0:6b68dac0d986 2 * Copyright 2014 Embedded Artists AB
embeddedartists 0:6b68dac0d986 3 *
embeddedartists 0:6b68dac0d986 4 * Licensed under the Apache License, Version 2.0 (the "License");
embeddedartists 0:6b68dac0d986 5 * you may not use this file except in compliance with the License.
embeddedartists 0:6b68dac0d986 6 * You may obtain a copy of the License at
embeddedartists 0:6b68dac0d986 7 *
embeddedartists 0:6b68dac0d986 8 * http://www.apache.org/licenses/LICENSE-2.0
embeddedartists 0:6b68dac0d986 9 *
embeddedartists 0:6b68dac0d986 10 * Unless required by applicable law or agreed to in writing, software
embeddedartists 0:6b68dac0d986 11 * distributed under the License is distributed on an "AS IS" BASIS,
embeddedartists 0:6b68dac0d986 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
embeddedartists 0:6b68dac0d986 13 * See the License for the specific language governing permissions and
embeddedartists 0:6b68dac0d986 14 * limitations under the License.
embeddedartists 0:6b68dac0d986 15 */
embeddedartists 0:6b68dac0d986 16
embeddedartists 0:6b68dac0d986 17 #ifndef DMBOARD_H
embeddedartists 0:6b68dac0d986 18 #define DMBOARD_H
embeddedartists 0:6b68dac0d986 19
embeddedartists 0:6b68dac0d986 20 #include "mbed.h"
embeddedartists 0:6b68dac0d986 21 #include "dm_board_config.h"
embeddedartists 2:887c6b45e7fa 22 #include "RtosLog.h"
embeddedartists 0:6b68dac0d986 23
embeddedartists 0:6b68dac0d986 24 #if defined(DM_BOARD_USE_MCI_FS)
embeddedartists 0:6b68dac0d986 25 #include "MCIFileSystem.h"
embeddedartists 0:6b68dac0d986 26 #endif
embeddedartists 0:6b68dac0d986 27 #if defined(DM_BOARD_USE_QSPI_FS)
embeddedartists 3:2fa7755f2cef 28 #include "SPIFI.h"
embeddedartists 0:6b68dac0d986 29 #include "QSPIFileSystem.h"
embeddedartists 0:6b68dac0d986 30 #elif defined(DM_BOARD_USE_QSPI)
embeddedartists 0:6b68dac0d986 31 #include "SPIFI.h"
embeddedartists 0:6b68dac0d986 32 #endif
embeddedartists 0:6b68dac0d986 33 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:6b68dac0d986 34 #include "Display.h"
embeddedartists 0:6b68dac0d986 35 #include "TouchPanel.h"
embeddedartists 0:6b68dac0d986 36 #endif
embeddedartists 0:6b68dac0d986 37
embeddedartists 0:6b68dac0d986 38 /**
embeddedartists 0:6b68dac0d986 39 * Example of using the Board class:
embeddedartists 0:6b68dac0d986 40 *
embeddedartists 0:6b68dac0d986 41 * @code
embeddedartists 0:6b68dac0d986 42 * #include "mbed.h"
embeddedartists 0:6b68dac0d986 43 * #include "DMBoard.h"
embeddedartists 0:6b68dac0d986 44 *
embeddedartists 0:6b68dac0d986 45 * int main(void) {
embeddedartists 0:6b68dac0d986 46 * DMBoard* board = &DMBoard::instance();
embeddedartists 0:6b68dac0d986 47 * board->init();
embeddedartists 0:6b68dac0d986 48 * ...
embeddedartists 0:6b68dac0d986 49 * board->setLed(1, true);
embeddedartists 0:6b68dac0d986 50 * }
embeddedartists 0:6b68dac0d986 51 * @endcode
embeddedartists 0:6b68dac0d986 52 */
embeddedartists 0:6b68dac0d986 53 class DMBoard {
embeddedartists 0:6b68dac0d986 54 public:
embeddedartists 2:887c6b45e7fa 55 enum Leds {
embeddedartists 2:887c6b45e7fa 56 Led1,
embeddedartists 2:887c6b45e7fa 57 Led2,
embeddedartists 2:887c6b45e7fa 58 Led3,
embeddedartists 2:887c6b45e7fa 59 Led4,
embeddedartists 0:6b68dac0d986 60 };
embeddedartists 0:6b68dac0d986 61
embeddedartists 0:6b68dac0d986 62 enum BoardError {
embeddedartists 10:1ac4b213f0f7 63 Ok = 0,
embeddedartists 10:1ac4b213f0f7 64 MemoryError,
embeddedartists 10:1ac4b213f0f7 65 SpifiError,
embeddedartists 10:1ac4b213f0f7 66 DisplayError,
embeddedartists 10:1ac4b213f0f7 67 TouchError,
embeddedartists 10:1ac4b213f0f7 68 BiosInvalidError,
embeddedartists 10:1ac4b213f0f7 69 BiosVersionError,
embeddedartists 0:6b68dac0d986 70 };
embeddedartists 0:6b68dac0d986 71
embeddedartists 9:a33326afd686 72 /** Get the only instance of the DMBoard
embeddedartists 9:a33326afd686 73 *
embeddedartists 9:a33326afd686 74 * @returns The DMBoard
embeddedartists 9:a33326afd686 75 */
embeddedartists 0:6b68dac0d986 76 static DMBoard& instance()
embeddedartists 0:6b68dac0d986 77 {
embeddedartists 0:6b68dac0d986 78 static DMBoard singleton;
embeddedartists 0:6b68dac0d986 79 return singleton;
embeddedartists 0:6b68dac0d986 80 }
embeddedartists 0:6b68dac0d986 81
embeddedartists 0:6b68dac0d986 82 /** Initializes the wanted features
embeddedartists 0:6b68dac0d986 83 *
embeddedartists 0:6b68dac0d986 84 * @returns
embeddedartists 0:6b68dac0d986 85 * Ok on success
embeddedartists 0:6b68dac0d986 86 * An error code on failure
embeddedartists 0:6b68dac0d986 87 */
embeddedartists 0:6b68dac0d986 88 BoardError init();
embeddedartists 0:6b68dac0d986 89
embeddedartists 9:a33326afd686 90 /** Controls the four LEDs on the Display Module
embeddedartists 9:a33326afd686 91 *
embeddedartists 9:a33326afd686 92 * @param led One of Led1, Led2, Led3 or Led4
embeddedartists 9:a33326afd686 93 * @param on true to turn the LED on regardless of its polarity
embeddedartists 9:a33326afd686 94 */
embeddedartists 2:887c6b45e7fa 95 void setLED(Leds led, bool on);
embeddedartists 5:c77fdb6e3438 96
embeddedartists 5:c77fdb6e3438 97 /** Controls the buzzer
embeddedartists 5:c77fdb6e3438 98 *
embeddedartists 5:c77fdb6e3438 99 * Examples:
embeddedartists 5:c77fdb6e3438 100 * buzzer() turns it off
embeddedartists 5:c77fdb6e3438 101 * buzzer(440) plays an A4 (440Hz) note forever
embeddedartists 5:c77fdb6e3438 102 * buzzer(200, 25) plays a 200Hz tone for 25ms and then turns it off
embeddedartists 5:c77fdb6e3438 103 *
embeddedartists 5:c77fdb6e3438 104 * Note that if duration_ms is >0 this is a blocking call
embeddedartists 5:c77fdb6e3438 105 *
embeddedartists 5:c77fdb6e3438 106 * @param frequency the frequency of the tone (in Hz) or 0 to turn it off
embeddedartists 5:c77fdb6e3438 107 * @param duration_ms the number of milliseconds to play or 0 for forever
embeddedartists 5:c77fdb6e3438 108 */
embeddedartists 5:c77fdb6e3438 109 void buzzer(int frequency=0, int duration_ms=0);
embeddedartists 9:a33326afd686 110
embeddedartists 9:a33326afd686 111 /** Test if the USER button is pressed or not
embeddedartists 9:a33326afd686 112 *
embeddedartists 9:a33326afd686 113 * @returns
embeddedartists 9:a33326afd686 114 * True if the button is pressed, false if not
embeddedartists 9:a33326afd686 115 */
embeddedartists 0:6b68dac0d986 116 bool buttonPressed();
embeddedartists 0:6b68dac0d986 117
embeddedartists 10:1ac4b213f0f7 118 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 9:a33326afd686 119 /** Returns the TouchPanel interface
embeddedartists 9:a33326afd686 120 *
embeddedartists 9:a33326afd686 121 * @returns
embeddedartists 9:a33326afd686 122 * The touch panel
embeddedartists 9:a33326afd686 123 */
embeddedartists 10:1ac4b213f0f7 124 TouchPanel* touchPanel();
embeddedartists 10:1ac4b213f0f7 125
embeddedartists 9:a33326afd686 126 /** Returns the Display interface
embeddedartists 9:a33326afd686 127 *
embeddedartists 9:a33326afd686 128 * @returns
embeddedartists 9:a33326afd686 129 * The display
embeddedartists 9:a33326afd686 130 */
embeddedartists 10:1ac4b213f0f7 131 Display* display();
embeddedartists 0:6b68dac0d986 132
embeddedartists 10:1ac4b213f0f7 133 friend class BiosDisplayAndTouch;
embeddedartists 0:6b68dac0d986 134 #endif
embeddedartists 9:a33326afd686 135 /** Returns the logger interface
embeddedartists 9:a33326afd686 136 *
embeddedartists 9:a33326afd686 137 * @returns
embeddedartists 9:a33326afd686 138 * The logger
embeddedartists 9:a33326afd686 139 */
embeddedartists 2:887c6b45e7fa 140 RtosLog* logger() { return &_logger; }
embeddedartists 0:6b68dac0d986 141
embeddedartists 0:6b68dac0d986 142 private:
embeddedartists 0:6b68dac0d986 143
embeddedartists 0:6b68dac0d986 144 bool _initialized;
embeddedartists 10:1ac4b213f0f7 145 uint8_t* _conf;
embeddedartists 10:1ac4b213f0f7 146 uint32_t _confSize;
embeddedartists 0:6b68dac0d986 147
embeddedartists 0:6b68dac0d986 148 #if defined(DM_BOARD_USE_MCI_FS)
embeddedartists 0:6b68dac0d986 149 MCIFileSystem _mcifs;
embeddedartists 0:6b68dac0d986 150 #endif
embeddedartists 0:6b68dac0d986 151 #if defined(DM_BOARD_USE_QSPI_FS)
embeddedartists 0:6b68dac0d986 152 QSPIFileSystem _qspifs;
embeddedartists 0:6b68dac0d986 153 #endif
embeddedartists 0:6b68dac0d986 154
embeddedartists 0:6b68dac0d986 155 PwmOut _buzzer;
embeddedartists 0:6b68dac0d986 156 DigitalIn _button;
embeddedartists 0:6b68dac0d986 157 DigitalOut _led1;
embeddedartists 0:6b68dac0d986 158 DigitalOut _led2;
embeddedartists 0:6b68dac0d986 159 DigitalOut _led3;
embeddedartists 0:6b68dac0d986 160 DigitalOut _led4;
embeddedartists 0:6b68dac0d986 161
embeddedartists 2:887c6b45e7fa 162 RtosLog _logger;
embeddedartists 2:887c6b45e7fa 163
embeddedartists 0:6b68dac0d986 164 explicit DMBoard();
embeddedartists 0:6b68dac0d986 165 // hide copy constructor
embeddedartists 0:6b68dac0d986 166 DMBoard(const DMBoard&);
embeddedartists 0:6b68dac0d986 167 // hide assign operator
embeddedartists 0:6b68dac0d986 168 DMBoard& operator=(const DMBoard&);
embeddedartists 0:6b68dac0d986 169 ~DMBoard();
embeddedartists 0:6b68dac0d986 170
embeddedartists 0:6b68dac0d986 171 BoardError readConfiguration();
embeddedartists 0:6b68dac0d986 172 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:6b68dac0d986 173 BoardError readDisplayConfiguration(uint8_t** data, uint32_t* size);
embeddedartists 0:6b68dac0d986 174 #endif
embeddedartists 0:6b68dac0d986 175 };
embeddedartists 0:6b68dac0d986 176
embeddedartists 0:6b68dac0d986 177 #endif