first lib
Dependents: 17robo_fuzi 17robo_tokyo_kaede
event_var.h@0:c5f25a970069, 2017-09-24 (annotated)
- Committer:
- echo_piyo
- Date:
- Sun Sep 24 05:24:48 2017 +0000
- Revision:
- 0:c5f25a970069
- Child:
- 1:0643baecf9e9
????2??
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
echo_piyo | 0:c5f25a970069 | 1 | /****************************************************** |
echo_piyo | 0:c5f25a970069 | 2 | -Class [varEvent] |
echo_piyo | 0:c5f25a970069 | 3 | |
echo_piyo | 0:c5f25a970069 | 4 | The [varEvent] is used to trigger an event when input data state changes. |
echo_piyo | 0:c5f25a970069 | 5 | |
echo_piyo | 0:c5f25a970069 | 6 | 目的: |
echo_piyo | 0:c5f25a970069 | 7 | 入力された状態の[立ち上がり],[立ち下がり]を検知する |
echo_piyo | 0:c5f25a970069 | 8 | [Rise(0->1)],[Fall(1->0)] |
echo_piyo | 0:c5f25a970069 | 9 | Sbdbt用として作成,流用可 |
echo_piyo | 0:c5f25a970069 | 10 | |
echo_piyo | 0:c5f25a970069 | 11 | 使い方: |
echo_piyo | 0:c5f25a970069 | 12 | Public Member Functions: |
echo_piyo | 0:c5f25a970069 | 13 | |
echo_piyo | 0:c5f25a970069 | 14 | varEvent <useName> //宣言 |
echo_piyo | 0:c5f25a970069 | 15 | .input((int)<inputData>) //(void)検出したい変数(Data)を引数に代入 |
echo_piyo | 0:c5f25a970069 | 16 | .getRise() //(int)立ち上がり検知 検出時は(int)1,それ以外は(int)0を返す |
echo_piyo | 0:c5f25a970069 | 17 | .getFall() //(int)立ち下がり検知 検出時は(int)1,それ以外は(int)0を返す |
echo_piyo | 0:c5f25a970069 | 18 | |
echo_piyo | 0:c5f25a970069 | 19 | ***************************************************************/ |
echo_piyo | 0:c5f25a970069 | 20 | |
echo_piyo | 0:c5f25a970069 | 21 | #ifndef MBED_EVENT_VAR_H |
echo_piyo | 0:c5f25a970069 | 22 | #define MBED_EVENT_VAR_H |
echo_piyo | 0:c5f25a970069 | 23 | #include "mbed.h" |
echo_piyo | 0:c5f25a970069 | 24 | |
echo_piyo | 0:c5f25a970069 | 25 | class eventVar { |
echo_piyo | 0:c5f25a970069 | 26 | public: |
echo_piyo | 0:c5f25a970069 | 27 | void input(int inputState); |
echo_piyo | 0:c5f25a970069 | 28 | int getRise(); |
echo_piyo | 0:c5f25a970069 | 29 | int getFall(); |
echo_piyo | 0:c5f25a970069 | 30 | |
echo_piyo | 0:c5f25a970069 | 31 | private: |
echo_piyo | 0:c5f25a970069 | 32 | int inputState, valState; |
echo_piyo | 0:c5f25a970069 | 33 | int riseState, fallState; |
echo_piyo | 0:c5f25a970069 | 34 | }; |
echo_piyo | 0:c5f25a970069 | 35 | |
echo_piyo | 0:c5f25a970069 | 36 | #endif |