GUI parts for DISCO-F746NG. GuiBase, Button, ButtonGroup, ResetButton, Label, BlinkLabel, NumericLabel, SeekBar, SeekbarGroup, NumericUpDown
Dependencies: Array_Matrix TS_DISCO_F746NG LCD_DISCO_F746NG BSP_DISCO_F746NG
DelayedEnabler.hpp@33:50b8f7654c36, 2018-03-12 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Mon Mar 12 04:22:48 2018 +0000
- Revision:
- 33:50b8f7654c36
34; Added: NumericUpDown
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 33:50b8f7654c36 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 33:50b8f7654c36 | 2 | // ある機能を一定の時間が経過するまでは無効にし,その後有効に |
MikamiUitOpen | 33:50b8f7654c36 | 3 | // するためのクラス |
MikamiUitOpen | 33:50b8f7654c36 | 4 | // |
MikamiUitOpen | 33:50b8f7654c36 | 5 | // 2018/03/12, Copyright (c) 2018 MIKAMI, Naoki |
MikamiUitOpen | 33:50b8f7654c36 | 6 | //----------------------------------------------------------- |
MikamiUitOpen | 33:50b8f7654c36 | 7 | |
MikamiUitOpen | 33:50b8f7654c36 | 8 | #ifndef DELAYED_ENABLER_HPP |
MikamiUitOpen | 33:50b8f7654c36 | 9 | #define DELAYED_ENABLER_HPP |
MikamiUitOpen | 33:50b8f7654c36 | 10 | |
MikamiUitOpen | 33:50b8f7654c36 | 11 | #include "mbed.h" |
MikamiUitOpen | 33:50b8f7654c36 | 12 | |
MikamiUitOpen | 33:50b8f7654c36 | 13 | namespace Mikami |
MikamiUitOpen | 33:50b8f7654c36 | 14 | { |
MikamiUitOpen | 33:50b8f7654c36 | 15 | class DelayedEnabler |
MikamiUitOpen | 33:50b8f7654c36 | 16 | { |
MikamiUitOpen | 33:50b8f7654c36 | 17 | public: |
MikamiUitOpen | 33:50b8f7654c36 | 18 | DelayedEnabler(float delayTime = 0.3f) |
MikamiUitOpen | 33:50b8f7654c36 | 19 | : DELAY_TIME_(delayTime), enable_(true) {} |
MikamiUitOpen | 33:50b8f7654c36 | 20 | |
MikamiUitOpen | 33:50b8f7654c36 | 21 | // このメンバ関数の実行直後から指定された時間,IsEnabled() は false を |
MikamiUitOpen | 33:50b8f7654c36 | 22 | // 返し,その後 InEnabled() は true を返す |
MikamiUitOpen | 33:50b8f7654c36 | 23 | void Disable() |
MikamiUitOpen | 33:50b8f7654c36 | 24 | { |
MikamiUitOpen | 33:50b8f7654c36 | 25 | enable_ = false; |
MikamiUitOpen | 33:50b8f7654c36 | 26 | Enabler_.attach(callback(this, &DelayedEnabler::TimeoutIsr), |
MikamiUitOpen | 33:50b8f7654c36 | 27 | DELAY_TIME_); |
MikamiUitOpen | 33:50b8f7654c36 | 28 | } |
MikamiUitOpen | 33:50b8f7654c36 | 29 | |
MikamiUitOpen | 33:50b8f7654c36 | 30 | bool IsEnabled() { return enable_; } |
MikamiUitOpen | 33:50b8f7654c36 | 31 | |
MikamiUitOpen | 33:50b8f7654c36 | 32 | private: |
MikamiUitOpen | 33:50b8f7654c36 | 33 | const float DELAY_TIME_; // 無効になっている時間 |
MikamiUitOpen | 33:50b8f7654c36 | 34 | |
MikamiUitOpen | 33:50b8f7654c36 | 35 | __IO bool enable_; |
MikamiUitOpen | 33:50b8f7654c36 | 36 | Timeout Enabler_; |
MikamiUitOpen | 33:50b8f7654c36 | 37 | |
MikamiUitOpen | 33:50b8f7654c36 | 38 | // 有効にする(Timeout 割り込みに対応する ISR) |
MikamiUitOpen | 33:50b8f7654c36 | 39 | void TimeoutIsr() { enable_ = true; } |
MikamiUitOpen | 33:50b8f7654c36 | 40 | |
MikamiUitOpen | 33:50b8f7654c36 | 41 | // disallow copy constructor and assignment operator |
MikamiUitOpen | 33:50b8f7654c36 | 42 | DelayedEnabler(const DelayedEnabler&); |
MikamiUitOpen | 33:50b8f7654c36 | 43 | DelayedEnabler& operator=(const DelayedEnabler&); |
MikamiUitOpen | 33:50b8f7654c36 | 44 | }; |
MikamiUitOpen | 33:50b8f7654c36 | 45 | } |
MikamiUitOpen | 33:50b8f7654c36 | 46 | #endif // DELAYED_ENABLER_HPP |