![](/media/cache/profiles/eaa6b3305e7ecaf165c780ff4c56708d.jpg.50x50_q85.jpg)
Demo to control 4 LEDs
Dependencies: BSP_DISCO_F469NI mbed
Widgets/Widget.cpp@2:e6fc24fbd86c, 2017-10-31 (annotated)
- Committer:
- Faberge
- Date:
- Tue Oct 31 14:46:28 2017 +0000
- Revision:
- 2:e6fc24fbd86c
- Parent:
- 1:a6d179a9ffbb
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Faberge | 0:e06404fdff2f | 1 | /* |
Faberge | 0:e06404fdff2f | 2 | * Widget.cpp |
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 | #include "Widget.h" |
Faberge | 0:e06404fdff2f | 19 | |
Faberge | 0:e06404fdff2f | 20 | Display Widget :: LCD; |
Faberge | 0:e06404fdff2f | 21 | TouchScreen Widget :: TS; |
Faberge | 0:e06404fdff2f | 22 | |
Faberge | 0:e06404fdff2f | 23 | bool Widget :: isTouched() |
Faberge | 0:e06404fdff2f | 24 | { |
Faberge | 0:e06404fdff2f | 25 | if (TS.getState()) |
Faberge | 0:e06404fdff2f | 26 | { |
Faberge | 0:e06404fdff2f | 27 | uint16_t x = TS.getX(); |
Faberge | 0:e06404fdff2f | 28 | uint16_t y = TS.getY(); |
Faberge | 0:e06404fdff2f | 29 | |
Faberge | 0:e06404fdff2f | 30 | /* Actual size a little bigger */ |
Faberge | 0:e06404fdff2f | 31 | if (( x >= xPos - 2) && (x <= xPos + xDim + 2) && |
Faberge | 0:e06404fdff2f | 32 | (y >= yPos - 2) && (y <= yPos + yDim + 2)) |
Faberge | 0:e06404fdff2f | 33 | return true; |
Faberge | 0:e06404fdff2f | 34 | } |
Faberge | 0:e06404fdff2f | 35 | |
Faberge | 0:e06404fdff2f | 36 | return false; |
Faberge | 0:e06404fdff2f | 37 | } |
Faberge | 0:e06404fdff2f | 38 | |
Faberge | 0:e06404fdff2f | 39 | Widget :: ~Widget() {} |
Faberge | 0:e06404fdff2f | 40 | uint16_t Widget :: update() {return 0;} |
Faberge | 0:e06404fdff2f | 41 |