Demo for Embedded World 2015.
Dependencies: DMBasicGUI DMSupport
Demo running on several LPC4088 Display Modules on the Embedded World 2015 exhibition.
Information
To run the demo first drag-n-drop the to_sync.fs3 file to the MBED drive and then drag-n-drop the demo itself. This way both the file system and software are up to date.
This is what the launcher will look like:
AppLauncherSpecial.h@1:1a01ef434a72, 2019-11-05 (annotated)
- Committer:
- embeddedartists
- Date:
- Tue Nov 05 08:20:16 2019 +0000
- Revision:
- 1:1a01ef434a72
- Parent:
- 0:6bd24cbb88a1
Updates related to mbed OS 5
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
alindvall | 0:6bd24cbb88a1 | 1 | /* |
alindvall | 0:6bd24cbb88a1 | 2 | * Copyright 2014 Embedded Artists AB |
alindvall | 0:6bd24cbb88a1 | 3 | * |
alindvall | 0:6bd24cbb88a1 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
alindvall | 0:6bd24cbb88a1 | 5 | * you may not use this file except in compliance with the License. |
alindvall | 0:6bd24cbb88a1 | 6 | * You may obtain a copy of the License at |
alindvall | 0:6bd24cbb88a1 | 7 | * |
alindvall | 0:6bd24cbb88a1 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
alindvall | 0:6bd24cbb88a1 | 9 | * |
alindvall | 0:6bd24cbb88a1 | 10 | * Unless required by applicable law or agreed to in writing, software |
alindvall | 0:6bd24cbb88a1 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
alindvall | 0:6bd24cbb88a1 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
alindvall | 0:6bd24cbb88a1 | 13 | * See the License for the specific language governing permissions and |
alindvall | 0:6bd24cbb88a1 | 14 | * limitations under the License. |
alindvall | 0:6bd24cbb88a1 | 15 | */ |
alindvall | 0:6bd24cbb88a1 | 16 | |
alindvall | 0:6bd24cbb88a1 | 17 | #ifndef APP_LAUNCHER_SPECIAL_H |
alindvall | 0:6bd24cbb88a1 | 18 | #define APP_LAUNCHER_SPECIAL_H |
alindvall | 0:6bd24cbb88a1 | 19 | |
alindvall | 0:6bd24cbb88a1 | 20 | #include "App.h" |
alindvall | 0:6bd24cbb88a1 | 21 | #include "DMBoard.h" |
alindvall | 0:6bd24cbb88a1 | 22 | #include "lpc_swim.h" |
alindvall | 0:6bd24cbb88a1 | 23 | #include "Clickable.h" |
alindvall | 0:6bd24cbb88a1 | 24 | #include "Image.h" |
alindvall | 0:6bd24cbb88a1 | 25 | |
alindvall | 0:6bd24cbb88a1 | 26 | /** |
alindvall | 0:6bd24cbb88a1 | 27 | * An App example. This uses a number of buttons to launch different Apps. |
alindvall | 0:6bd24cbb88a1 | 28 | * |
alindvall | 0:6bd24cbb88a1 | 29 | * The purpose of this example is to demonstrate how to manage a set of |
alindvall | 0:6bd24cbb88a1 | 30 | * Apps and launch them either as a result of clicked buttons or (in the |
alindvall | 0:6bd24cbb88a1 | 31 | * case of the TouchCalibrationApp) after an extended press of the USER |
alindvall | 0:6bd24cbb88a1 | 32 | * button on the back of the display module. |
alindvall | 0:6bd24cbb88a1 | 33 | */ |
alindvall | 0:6bd24cbb88a1 | 34 | class AppLauncherSpecial : public App { |
alindvall | 0:6bd24cbb88a1 | 35 | public: |
alindvall | 0:6bd24cbb88a1 | 36 | |
alindvall | 0:6bd24cbb88a1 | 37 | AppLauncherSpecial(); |
alindvall | 0:6bd24cbb88a1 | 38 | virtual ~AppLauncherSpecial(); |
alindvall | 0:6bd24cbb88a1 | 39 | |
alindvall | 0:6bd24cbb88a1 | 40 | enum CommonApplicationIDs { |
alindvall | 0:6bd24cbb88a1 | 41 | CalibrationApp = 0xffff, |
alindvall | 0:6bd24cbb88a1 | 42 | }; |
alindvall | 0:6bd24cbb88a1 | 43 | |
alindvall | 0:6bd24cbb88a1 | 44 | virtual bool setup(); |
alindvall | 0:6bd24cbb88a1 | 45 | virtual void runToCompletion(); |
alindvall | 0:6bd24cbb88a1 | 46 | virtual bool teardown(); |
alindvall | 0:6bd24cbb88a1 | 47 | |
alindvall | 0:6bd24cbb88a1 | 48 | void setAppCreatorFunc(App*(*callback)(uint32_t buttonID)); |
alindvall | 0:6bd24cbb88a1 | 49 | |
alindvall | 0:6bd24cbb88a1 | 50 | bool addButton(uint32_t buttonID, const char* caption); |
alindvall | 0:6bd24cbb88a1 | 51 | bool addImageButton(uint32_t buttonID, const char* imgUp, const char* imgDown = 0); |
alindvall | 0:6bd24cbb88a1 | 52 | bool addImageButton(uint32_t buttonID, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown = 0, unsigned int imgDownSize = 0); |
alindvall | 0:6bd24cbb88a1 | 53 | bool addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const char* imgUp, const char* imgDown = 0); |
alindvall | 0:6bd24cbb88a1 | 54 | bool addImageButton(uint32_t buttonID, const char* caption, COLOR_T color, const unsigned char* imgUp, unsigned int imgUpSize, const unsigned char* imgDown = 0, unsigned int imgDownSize = 0); |
alindvall | 0:6bd24cbb88a1 | 55 | |
alindvall | 0:6bd24cbb88a1 | 56 | private: |
alindvall | 0:6bd24cbb88a1 | 57 | enum Constants { |
alindvall | 0:6bd24cbb88a1 | 58 | TitleHeight = 20, |
alindvall | 0:6bd24cbb88a1 | 59 | ButtonWidth = 75, |
alindvall | 0:6bd24cbb88a1 | 60 | ButtonHeight = 75, |
alindvall | 0:6bd24cbb88a1 | 61 | ButtonRows = 2, |
alindvall | 0:6bd24cbb88a1 | 62 | ButtonColumns = 5, |
alindvall | 0:6bd24cbb88a1 | 63 | NumberOfButtons = ButtonRows*ButtonColumns, |
alindvall | 0:6bd24cbb88a1 | 64 | }; |
alindvall | 0:6bd24cbb88a1 | 65 | |
alindvall | 0:6bd24cbb88a1 | 66 | Display* _disp; |
alindvall | 0:6bd24cbb88a1 | 67 | SWIM_WINDOW_T* _win; |
alindvall | 0:6bd24cbb88a1 | 68 | void* _fb; |
alindvall | 0:6bd24cbb88a1 | 69 | Clickable* _buttons[NumberOfButtons]; |
alindvall | 0:6bd24cbb88a1 | 70 | int _usedButtons; |
alindvall | 0:6bd24cbb88a1 | 71 | App*(*_callback)(uint32_t buttonID); |
alindvall | 0:6bd24cbb88a1 | 72 | bool _supportsCalibration; |
alindvall | 0:6bd24cbb88a1 | 73 | bool _newTouchEvent; |
alindvall | 0:6bd24cbb88a1 | 74 | bool _newButtonEvent; |
alindvall | 0:6bd24cbb88a1 | 75 | Image::ImageData_t _bgImg; |
alindvall | 0:6bd24cbb88a1 | 76 | char _currentTime[30]; |
alindvall | 0:6bd24cbb88a1 | 77 | |
alindvall | 0:6bd24cbb88a1 | 78 | void draw(); |
alindvall | 0:6bd24cbb88a1 | 79 | void onTouchEvent(); |
alindvall | 0:6bd24cbb88a1 | 80 | void onButtonEvent(); |
alindvall | 0:6bd24cbb88a1 | 81 | }; |
alindvall | 0:6bd24cbb88a1 | 82 | |
alindvall | 0:6bd24cbb88a1 | 83 | #endif |
alindvall | 0:6bd24cbb88a1 | 84 |