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 TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
Revision 22:fa0181712d9c, committed 2016-08-17
- Comitter:
- MikamiUitOpen
- Date:
- Wed Aug 17 06:17:30 2016 +0000
- Parent:
- 21:5abb486c68e0
- Child:
- 23:2078556088a6
- Commit message:
- 23
Changed in this revision
| BlinkLabel.hpp | Show annotated file Show diff for this revision Revisions of this file |
| ResetButton.hpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/BlinkLabel.hpp Wed Aug 17 06:12:49 2016 +0000
+++ b/BlinkLabel.hpp Wed Aug 17 06:17:30 2016 +0000
@@ -2,13 +2,14 @@
// BlinkLabel class -- derived class of Label class
// For displaying error message
//
-// 2016/04/07, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/08/16, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
#ifndef F746_BLINK_LABEL_HPP
#define F746_BLINK_LABEL_HPP
#include "Label.hpp"
+#include "ResetButton.hpp"
namespace Mikami
{
@@ -24,12 +25,14 @@
uint32_t on = 500, uint32_t off = 200)
: Label(x, y, str, mode, fonts, textColor, backColor)
{
+ ResetButton *reset = new ResetButton();
while (true) // Blinking here
{
wait_ms(on);
Draw(backColor);
wait_ms(off);
Draw(textColor);
+ reset->Do();
}
}
@@ -40,4 +43,3 @@
};
}
#endif // F746_BLINK_LABEL_HPP
-
--- a/ResetButton.hpp Wed Aug 17 06:12:49 2016 +0000
+++ b/ResetButton.hpp Wed Aug 17 06:17:30 2016 +0000
@@ -1,45 +1,46 @@
//-----------------------------------------------------------
-// BlinkLabel class -- derived class of Label class
-// For displaying error message
+// ResetButton class -- derived class of Button class
//
-// 2016/08/16, Copyright (c) 2016 MIKAMI, Naoki
+// 2016/08/15, Copyright (c) 2016 MIKAMI, Naoki
//-----------------------------------------------------------
-#ifndef F746_BLINK_LABEL_HPP
-#define F746_BLINK_LABEL_HPP
+#ifndef F746_RESET_BUTTON_HPP
+#define F746_RESET_BUTTON_HPP
-#include "Label.hpp"
-#include "ResetButton.hpp"
+#include "Button.hpp"
namespace Mikami
{
- class BlinkLabel : public Label
+ class ResetButton : public Button
{
public:
- // 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)
+ 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()
{
- ResetButton *reset = new ResetButton();
- while (true) // Blinking here
- {
- wait_ms(on);
- Draw(backColor);
- wait_ms(off);
- Draw(textColor);
- reset->Do();
- }
+ if (!Touched()) return;
+
+ wait(0.2f);
+ NVIC_SystemReset();
+ }
+
+ void Draw()
+ {
+ Activate();
+ lcd_.SetTextColor(LCD_COLOR_WHITE);
+ lcd_.FillPolygon(pt_, 3);
}
private:
- // disallow copy constructor and assignment operator
- BlinkLabel(const BlinkLabel&);
- BlinkLabel& operator=(const BlinkLabel&);
+ Point pt_[3];
};
}
-#endif // F746_BLINK_LABEL_HPP
+#endif // F746_RESET_BUTTON_HPP