Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
Fork of F746_GUI by
Revision 21:5abb486c68e0, committed 2016-08-17
- Comitter:
- MikamiUitOpen
- Date:
- Wed Aug 17 06:12:49 2016 +0000
- Parent:
- 20:a3f5ef112208
- Child:
- 22:fa0181712d9c
- Commit message:
- 22
Changed in this revision
| ResetButton.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/ResetButton.hpp Mon Aug 15 06:00:29 2016 +0000
+++ b/ResetButton.hpp Wed Aug 17 06:12:49 2016 +0000
@@ -1,46 +1,45 @@
//-----------------------------------------------------------
-// ResetButton class -- derived class of Button class
+// BlinkLabel class -- derived class of Label class
+// For displaying error message
//
-// 2016/08/15, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/08/16, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
-#ifndef F746_RESET_BUTTON_HPP
-#define F746_RESET_BUTTON_HPP
+#ifndef F746_BLINK_LABEL_HPP
+#define F746_BLINK_LABEL_HPP
-#include "Button.hpp"
+#include "Label.hpp"
+#include "ResetButton.hpp"
namespace Mikami
{
- class ResetButton : public Button
+ class BlinkLabel : public Label
{
public:
- ResetButton(uint16_t x = 0, uint16_t y = 240,
- uint16_t w = 32, uint16_t h = 32)
- : Button(x, y, w, h)
- {
- pt_[0] = (Point){x+0.2f*w, y+h/2};
- pt_[1] = (Point){x+0.75f*w, y+0.175f*h};
- pt_[2] = (Point){x+0.75f*w, y+0.825f*h};
- Draw();
- }
-
- void Do()
+ // Constructor
+ BlinkLabel(uint16_t x, uint16_t y, const string str,
+ TextAlignMode mode = LEFT,
+ sFONT &fonts = Font20,
+ uint32_t textColor = LCD_COLOR_RED,
+ uint32_t backColor = GuiBase::ENUM_BACK,
+ uint32_t on = 500, uint32_t off = 200)
+ : Label(x, y, str, mode, fonts, textColor, backColor)
{
- if (!Touched()) return;
-
- wait(0.2f);
- NVIC_SystemReset();
- }
-
- void Draw()
- {
- Activate();
- lcd_.SetTextColor(LCD_COLOR_WHITE);
- lcd_.FillPolygon(pt_, 3);
+ ResetButton *reset = new ResetButton();
+ while (true) // Blinking here
+ {
+ wait_ms(on);
+ Draw(backColor);
+ wait_ms(off);
+ Draw(textColor);
+ reset->Do();
+ }
}
private:
- Point pt_[3];
+ // disallow copy constructor and assignment operator
+ BlinkLabel(const BlinkLabel&);
+ BlinkLabel& operator=(const BlinkLabel&);
};
}
-#endif // F746_RESET_BUTTON_HPP
+#endif // F746_BLINK_LABEL_HPP
