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:
Wed Dec 03 16:17:10 2014 +0000
Revision:
3:2fa7755f2cef
Parent:
2:887c6b45e7fa
Child:
5:c77fdb6e3438
Corrected the SPIFI initialization so that it can run at max speed (i.e. 60MHz). Updated used libraries including the Keyboard, Mouse and Hub changes for USB Host.

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 #endif
embeddedartists 0:6b68dac0d986 36 #if defined(DM_BOARD_USE_TOUCH)
embeddedartists 0:6b68dac0d986 37 #include "TouchPanel.h"
embeddedartists 0:6b68dac0d986 38 #endif
embeddedartists 0:6b68dac0d986 39
embeddedartists 0:6b68dac0d986 40 /**
embeddedartists 0:6b68dac0d986 41 * Example of using the Board class:
embeddedartists 0:6b68dac0d986 42 *
embeddedartists 0:6b68dac0d986 43 * @code
embeddedartists 0:6b68dac0d986 44 * #include "mbed.h"
embeddedartists 0:6b68dac0d986 45 * #include "DMBoard.h"
embeddedartists 0:6b68dac0d986 46 *
embeddedartists 0:6b68dac0d986 47 * int main(void) {
embeddedartists 0:6b68dac0d986 48 * DMBoard* board = &DMBoard::instance();
embeddedartists 0:6b68dac0d986 49 * board->init();
embeddedartists 0:6b68dac0d986 50 * ...
embeddedartists 0:6b68dac0d986 51 * board->setLed(1, true);
embeddedartists 0:6b68dac0d986 52 * }
embeddedartists 0:6b68dac0d986 53 * @endcode
embeddedartists 0:6b68dac0d986 54 */
embeddedartists 0:6b68dac0d986 55 class DMBoard {
embeddedartists 0:6b68dac0d986 56 public:
embeddedartists 2:887c6b45e7fa 57 enum Leds {
embeddedartists 2:887c6b45e7fa 58 Led1,
embeddedartists 2:887c6b45e7fa 59 Led2,
embeddedartists 2:887c6b45e7fa 60 Led3,
embeddedartists 2:887c6b45e7fa 61 Led4,
embeddedartists 0:6b68dac0d986 62 };
embeddedartists 0:6b68dac0d986 63
embeddedartists 0:6b68dac0d986 64 enum BoardError {
embeddedartists 0:6b68dac0d986 65 Ok = 0,
embeddedartists 0:6b68dac0d986 66 MemoryError = 1,
embeddedartists 0:6b68dac0d986 67 SpifiError = 1,
embeddedartists 0:6b68dac0d986 68 DisplayError = 2,
embeddedartists 0:6b68dac0d986 69 TouchError = 3,
embeddedartists 0:6b68dac0d986 70 };
embeddedartists 0:6b68dac0d986 71
embeddedartists 0:6b68dac0d986 72 static DMBoard& instance()
embeddedartists 0:6b68dac0d986 73 {
embeddedartists 0:6b68dac0d986 74 static DMBoard singleton;
embeddedartists 0:6b68dac0d986 75 return singleton;
embeddedartists 0:6b68dac0d986 76 }
embeddedartists 0:6b68dac0d986 77
embeddedartists 0:6b68dac0d986 78
embeddedartists 0:6b68dac0d986 79 /** Initializes the wanted features
embeddedartists 0:6b68dac0d986 80 *
embeddedartists 0:6b68dac0d986 81 * @returns
embeddedartists 0:6b68dac0d986 82 * Ok on success
embeddedartists 0:6b68dac0d986 83 * An error code on failure
embeddedartists 0:6b68dac0d986 84 */
embeddedartists 0:6b68dac0d986 85 BoardError init();
embeddedartists 0:6b68dac0d986 86
embeddedartists 2:887c6b45e7fa 87 void setLED(Leds led, bool on);
embeddedartists 0:6b68dac0d986 88 void buzzer(float value);
embeddedartists 0:6b68dac0d986 89 bool buttonPressed();
embeddedartists 0:6b68dac0d986 90
embeddedartists 0:6b68dac0d986 91 #if defined(DM_BOARD_USE_TOUCH)
embeddedartists 0:6b68dac0d986 92 TouchPanel* touchPanel() { return _touch; }
embeddedartists 0:6b68dac0d986 93 #endif
embeddedartists 0:6b68dac0d986 94 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:6b68dac0d986 95 Display* display() { return &(Display::instance()); }
embeddedartists 0:6b68dac0d986 96
embeddedartists 0:6b68dac0d986 97 friend class Display;
embeddedartists 0:6b68dac0d986 98 #endif
embeddedartists 2:887c6b45e7fa 99 RtosLog* logger() { return &_logger; }
embeddedartists 0:6b68dac0d986 100
embeddedartists 0:6b68dac0d986 101 private:
embeddedartists 0:6b68dac0d986 102
embeddedartists 0:6b68dac0d986 103 bool _initialized;
embeddedartists 0:6b68dac0d986 104
embeddedartists 0:6b68dac0d986 105 #if defined(DM_BOARD_USE_MCI_FS)
embeddedartists 0:6b68dac0d986 106 MCIFileSystem _mcifs;
embeddedartists 0:6b68dac0d986 107 #endif
embeddedartists 0:6b68dac0d986 108 #if defined(DM_BOARD_USE_QSPI_FS)
embeddedartists 0:6b68dac0d986 109 QSPIFileSystem _qspifs;
embeddedartists 0:6b68dac0d986 110 #endif
embeddedartists 0:6b68dac0d986 111 #if defined(DM_BOARD_USE_TOUCH)
embeddedartists 0:6b68dac0d986 112 TouchPanel* _touch;
embeddedartists 0:6b68dac0d986 113 #endif
embeddedartists 0:6b68dac0d986 114
embeddedartists 0:6b68dac0d986 115 PwmOut _buzzer;
embeddedartists 0:6b68dac0d986 116 DigitalIn _button;
embeddedartists 0:6b68dac0d986 117 DigitalOut _led1;
embeddedartists 0:6b68dac0d986 118 DigitalOut _led2;
embeddedartists 0:6b68dac0d986 119 DigitalOut _led3;
embeddedartists 0:6b68dac0d986 120 DigitalOut _led4;
embeddedartists 0:6b68dac0d986 121
embeddedartists 2:887c6b45e7fa 122 RtosLog _logger;
embeddedartists 2:887c6b45e7fa 123
embeddedartists 0:6b68dac0d986 124 explicit DMBoard();
embeddedartists 0:6b68dac0d986 125 // hide copy constructor
embeddedartists 0:6b68dac0d986 126 DMBoard(const DMBoard&);
embeddedartists 0:6b68dac0d986 127 // hide assign operator
embeddedartists 0:6b68dac0d986 128 DMBoard& operator=(const DMBoard&);
embeddedartists 0:6b68dac0d986 129 ~DMBoard();
embeddedartists 0:6b68dac0d986 130
embeddedartists 0:6b68dac0d986 131 BoardError readConfiguration();
embeddedartists 0:6b68dac0d986 132 #if defined(DM_BOARD_USE_DISPLAY)
embeddedartists 0:6b68dac0d986 133 BoardError readDisplayConfiguration(uint8_t** data, uint32_t* size);
embeddedartists 0:6b68dac0d986 134 #endif
embeddedartists 0:6b68dac0d986 135 };
embeddedartists 0:6b68dac0d986 136
embeddedartists 0:6b68dac0d986 137 #endif
embeddedartists 0:6b68dac0d986 138