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.
ResetButton.hpp
00001 //----------------------------------------------------------- 00002 // ResetButton class -- derived class of Button class 00003 // 00004 // 2017/01/16, Copyright (c) 2017 MIKAMI, Naoki 00005 //----------------------------------------------------------- 00006 00007 #ifndef F746_RESET_BUTTON_HPP 00008 #define F746_RESET_BUTTON_HPP 00009 00010 #include "Button.hpp" 00011 00012 namespace Mikami 00013 { 00014 class ResetButton : public Button 00015 { 00016 public: 00017 ResetButton(uint16_t x = 0, uint16_t y = 240, 00018 uint16_t w = 32, uint16_t h = 32) 00019 : Button(x, y, w, h) 00020 { 00021 pt_[0] = (Point){x+0.2f*w, y+h/2}; 00022 pt_[1] = (Point){x+0.75f*w, y+0.175f*h}; 00023 pt_[2] = (Point){x+0.75f*w, y+0.825f*h}; 00024 Draw(); 00025 } 00026 00027 void DoIfTouched() 00028 { 00029 if (!Touched()) return; 00030 00031 wait(0.2f); 00032 NVIC_SystemReset(); 00033 } 00034 00035 void Draw() 00036 { 00037 Activate(); 00038 lcd_.SetTextColor(LCD_COLOR_WHITE); 00039 lcd_.FillPolygon(pt_, 3); 00040 } 00041 00042 private: 00043 Point pt_[3]; 00044 }; 00045 } 00046 #endif // F746_RESET_BUTTON_HPP
Generated on Tue Jul 12 2022 15:39:21 by
1.7.2