Automate écran capacitif

Dependencies:   BSP_DISCO_F469NI LCD_DISCO_F469NI SeeedStudioTFTv2 TFT_fonts mbed

Fork of DISCO-F469NI_LCD_demo by ST

Committer:
SquirrelGod
Date:
Fri Mar 31 15:36:26 2017 +0000
Revision:
2:2182df2d7810
Programme ?cran capacitif

Who changed what in which revision?

UserRevisionLine numberNew contents of line
SquirrelGod 2:2182df2d7810 1 //-----------------------------------------------------------
SquirrelGod 2:2182df2d7810 2 // ResetButton class -- derived class of Button class
SquirrelGod 2:2182df2d7810 3 //
SquirrelGod 2:2182df2d7810 4 // 2016/08/15, Copyright (c) 2016 MIKAMI, Naoki
SquirrelGod 2:2182df2d7810 5 //-----------------------------------------------------------
SquirrelGod 2:2182df2d7810 6
SquirrelGod 2:2182df2d7810 7 #ifndef F746_RESET_BUTTON_HPP
SquirrelGod 2:2182df2d7810 8 #define F746_RESET_BUTTON_HPP
SquirrelGod 2:2182df2d7810 9
SquirrelGod 2:2182df2d7810 10 #include "Button.hpp"
SquirrelGod 2:2182df2d7810 11
SquirrelGod 2:2182df2d7810 12 namespace Mikami
SquirrelGod 2:2182df2d7810 13 {
SquirrelGod 2:2182df2d7810 14 class ResetButton : public Button
SquirrelGod 2:2182df2d7810 15 {
SquirrelGod 2:2182df2d7810 16 public:
SquirrelGod 2:2182df2d7810 17 ResetButton(uint16_t x = 0, uint16_t y = 240,
SquirrelGod 2:2182df2d7810 18 uint16_t w = 32, uint16_t h = 32)
SquirrelGod 2:2182df2d7810 19 : Button(x, y, w, h)
SquirrelGod 2:2182df2d7810 20 {
SquirrelGod 2:2182df2d7810 21 pt_[0] = (Point){x+0.2f*w, y+h/2};
SquirrelGod 2:2182df2d7810 22 pt_[1] = (Point){x+0.75f*w, y+0.175f*h};
SquirrelGod 2:2182df2d7810 23 pt_[2] = (Point){x+0.75f*w, y+0.825f*h};
SquirrelGod 2:2182df2d7810 24 Draw();
SquirrelGod 2:2182df2d7810 25 }
SquirrelGod 2:2182df2d7810 26
SquirrelGod 2:2182df2d7810 27 void Do()
SquirrelGod 2:2182df2d7810 28 {
SquirrelGod 2:2182df2d7810 29 if (!Touched()) return;
SquirrelGod 2:2182df2d7810 30
SquirrelGod 2:2182df2d7810 31 wait(0.2f);
SquirrelGod 2:2182df2d7810 32 NVIC_SystemReset();
SquirrelGod 2:2182df2d7810 33 }
SquirrelGod 2:2182df2d7810 34
SquirrelGod 2:2182df2d7810 35 void Draw()
SquirrelGod 2:2182df2d7810 36 {
SquirrelGod 2:2182df2d7810 37 Activate();
SquirrelGod 2:2182df2d7810 38 lcd_.SetTextColor(LCD_COLOR_WHITE);
SquirrelGod 2:2182df2d7810 39 lcd_.FillPolygon(pt_, 3);
SquirrelGod 2:2182df2d7810 40 }
SquirrelGod 2:2182df2d7810 41
SquirrelGod 2:2182df2d7810 42 private:
SquirrelGod 2:2182df2d7810 43 Point pt_[3];
SquirrelGod 2:2182df2d7810 44 };
SquirrelGod 2:2182df2d7810 45 }
SquirrelGod 2:2182df2d7810 46 #endif // F746_RESET_BUTTON_HPP