GUI parts for DISCO-F469I a fork of DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup
Dependents: DISCO-F469NI_LCDTS_GUI_demo DISCO-F469NI_LCDTS_GUI_demo projekt_PSW_v1 DISCO-F469NI_LCDTS_GUI_demoaaaaaaaaaxxxx ... more
Fork of F746_GUI by
ResetButton.hpp@20:a3f5ef112208, 2016-08-15 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Mon Aug 15 06:00:29 2016 +0000
- Revision:
- 20:a3f5ef112208
- Parent:
- 18:506535948dc4
- Child:
- 21:5abb486c68e0
21
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 18:506535948dc4 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 18:506535948dc4 | 2 | // ResetButton class -- derived class of Button class |
MikamiUitOpen | 18:506535948dc4 | 3 | // |
MikamiUitOpen | 18:506535948dc4 | 4 | // 2016/08/15, Copyright (c) 2016 MIKAMI, Naoki |
MikamiUitOpen | 18:506535948dc4 | 5 | //----------------------------------------------------------- |
MikamiUitOpen | 18:506535948dc4 | 6 | |
MikamiUitOpen | 18:506535948dc4 | 7 | #ifndef F746_RESET_BUTTON_HPP |
MikamiUitOpen | 18:506535948dc4 | 8 | #define F746_RESET_BUTTON_HPP |
MikamiUitOpen | 18:506535948dc4 | 9 | |
MikamiUitOpen | 18:506535948dc4 | 10 | #include "Button.hpp" |
MikamiUitOpen | 18:506535948dc4 | 11 | |
MikamiUitOpen | 18:506535948dc4 | 12 | namespace Mikami |
MikamiUitOpen | 18:506535948dc4 | 13 | { |
MikamiUitOpen | 18:506535948dc4 | 14 | class ResetButton : public Button |
MikamiUitOpen | 18:506535948dc4 | 15 | { |
MikamiUitOpen | 18:506535948dc4 | 16 | public: |
MikamiUitOpen | 20:a3f5ef112208 | 17 | ResetButton(uint16_t x = 0, uint16_t y = 240, |
MikamiUitOpen | 20:a3f5ef112208 | 18 | uint16_t w = 32, uint16_t h = 32) |
MikamiUitOpen | 18:506535948dc4 | 19 | : Button(x, y, w, h) |
MikamiUitOpen | 18:506535948dc4 | 20 | { |
MikamiUitOpen | 18:506535948dc4 | 21 | pt_[0] = (Point){x+0.2f*w, y+h/2}; |
MikamiUitOpen | 18:506535948dc4 | 22 | pt_[1] = (Point){x+0.75f*w, y+0.175f*h}; |
MikamiUitOpen | 18:506535948dc4 | 23 | pt_[2] = (Point){x+0.75f*w, y+0.825f*h}; |
MikamiUitOpen | 18:506535948dc4 | 24 | Draw(); |
MikamiUitOpen | 18:506535948dc4 | 25 | } |
MikamiUitOpen | 18:506535948dc4 | 26 | |
MikamiUitOpen | 18:506535948dc4 | 27 | void Do() |
MikamiUitOpen | 18:506535948dc4 | 28 | { |
MikamiUitOpen | 18:506535948dc4 | 29 | if (!Touched()) return; |
MikamiUitOpen | 18:506535948dc4 | 30 | |
MikamiUitOpen | 18:506535948dc4 | 31 | wait(0.2f); |
MikamiUitOpen | 18:506535948dc4 | 32 | NVIC_SystemReset(); |
MikamiUitOpen | 18:506535948dc4 | 33 | } |
MikamiUitOpen | 18:506535948dc4 | 34 | |
MikamiUitOpen | 18:506535948dc4 | 35 | void Draw() |
MikamiUitOpen | 18:506535948dc4 | 36 | { |
MikamiUitOpen | 18:506535948dc4 | 37 | Activate(); |
MikamiUitOpen | 18:506535948dc4 | 38 | lcd_.SetTextColor(LCD_COLOR_WHITE); |
MikamiUitOpen | 18:506535948dc4 | 39 | lcd_.FillPolygon(pt_, 3); |
MikamiUitOpen | 18:506535948dc4 | 40 | } |
MikamiUitOpen | 18:506535948dc4 | 41 | |
MikamiUitOpen | 18:506535948dc4 | 42 | private: |
MikamiUitOpen | 18:506535948dc4 | 43 | Point pt_[3]; |
MikamiUitOpen | 18:506535948dc4 | 44 | }; |
MikamiUitOpen | 18:506535948dc4 | 45 | } |
MikamiUitOpen | 18:506535948dc4 | 46 | #endif // F746_RESET_BUTTON_HPP |