Demo to control 4 LEDs
Dependencies: BSP_DISCO_F469NI mbed
Widgets/Widget.h@0:e06404fdff2f, 2017-10-11 (annotated)
- Committer:
- Faberge
- Date:
- Wed Oct 11 22:26:45 2017 +0000
- Revision:
- 0:e06404fdff2f
- Child:
- 1:a6d179a9ffbb
Demo to control 4 LEDs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Faberge | 0:e06404fdff2f | 1 | /* |
Faberge | 0:e06404fdff2f | 2 | * Widget.h |
Faberge | 0:e06404fdff2f | 3 | * |
Faberge | 0:e06404fdff2f | 4 | * Copyright 2017 Faberge@TsarTeam |
Faberge | 0:e06404fdff2f | 5 | * |
Faberge | 0:e06404fdff2f | 6 | * This program is free software; you can redistribute it and/or modify |
Faberge | 0:e06404fdff2f | 7 | * it under the terms of the GNU General Public License as published by |
Faberge | 0:e06404fdff2f | 8 | * the Free Software Foundation; either version 2 of the License, or |
Faberge | 0:e06404fdff2f | 9 | * (at your option) any later version. |
Faberge | 0:e06404fdff2f | 10 | * |
Faberge | 0:e06404fdff2f | 11 | * This program is distributed in the hope that it will be useful, |
Faberge | 0:e06404fdff2f | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Faberge | 0:e06404fdff2f | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Faberge | 0:e06404fdff2f | 14 | * GNU General Public License for more details. |
Faberge | 0:e06404fdff2f | 15 | * |
Faberge | 0:e06404fdff2f | 16 | */ |
Faberge | 0:e06404fdff2f | 17 | |
Faberge | 0:e06404fdff2f | 18 | #ifndef WIDGET_H |
Faberge | 0:e06404fdff2f | 19 | #define WIDGET_H |
Faberge | 0:e06404fdff2f | 20 | |
Faberge | 0:e06404fdff2f | 21 | #include "LCD_F469.h" |
Faberge | 0:e06404fdff2f | 22 | #include "TS_F469.h" |
Faberge | 0:e06404fdff2f | 23 | |
Faberge | 0:e06404fdff2f | 24 | class Widget |
Faberge | 0:e06404fdff2f | 25 | { |
Faberge | 0:e06404fdff2f | 26 | private: |
Faberge | 0:e06404fdff2f | 27 | |
Faberge | 0:e06404fdff2f | 28 | protected: |
Faberge | 0:e06404fdff2f | 29 | Widget(uint16_t x, uint16_t y, uint16_t width, uint16_t height, |
Faberge | 0:e06404fdff2f | 30 | color_t backClr, color_t textClr = LCD_COLOR_WHITE) : |
Faberge | 0:e06404fdff2f | 31 | xPos(x), yPos(y), xDim(width), yDim(height), |
Faberge | 0:e06404fdff2f | 32 | backColor(backClr), textColor(textClr) {} |
Faberge | 0:e06404fdff2f | 33 | |
Faberge | 0:e06404fdff2f | 34 | uint16_t xPos; |
Faberge | 0:e06404fdff2f | 35 | uint16_t yPos; |
Faberge | 0:e06404fdff2f | 36 | uint16_t xDim; |
Faberge | 0:e06404fdff2f | 37 | uint16_t yDim; |
Faberge | 0:e06404fdff2f | 38 | |
Faberge | 0:e06404fdff2f | 39 | color_t backColor; |
Faberge | 0:e06404fdff2f | 40 | color_t textColor; |
Faberge | 0:e06404fdff2f | 41 | |
Faberge | 0:e06404fdff2f | 42 | static Display LCD; |
Faberge | 0:e06404fdff2f | 43 | static TouchScreen TS; |
Faberge | 0:e06404fdff2f | 44 | |
Faberge | 0:e06404fdff2f | 45 | public: |
Faberge | 0:e06404fdff2f | 46 | virtual ~Widget() = 0; |
Faberge | 0:e06404fdff2f | 47 | bool isTouched(); |
Faberge | 0:e06404fdff2f | 48 | virtual void draw(color_t clr) {}; |
Faberge | 0:e06404fdff2f | 49 | virtual uint16_t update(); |
Faberge | 0:e06404fdff2f | 50 | |
Faberge | 0:e06404fdff2f | 51 | }; |
Faberge | 0:e06404fdff2f | 52 | |
Faberge | 0:e06404fdff2f | 53 | #endif |