![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
sampleProgram
Dependencies: QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo
Fork of 17robo_fuzi by
Diff: varEvent.h
- Revision:
- 51:70d45b959d6b
- Parent:
- 50:e4e1f38d1bd5
- Child:
- 52:f5ae47e683fa
--- a/varEvent.h Wed Sep 13 02:17:38 2017 +0000 +++ b/varEvent.h Wed Sep 13 02:58:53 2017 +0000 @@ -1,5 +1,24 @@ +/****************************************************** +-Class [varEvent] + +The [varEvent] interface is used to trigger an event when input data state changes. + +目的: + 入力された状態の[立ち上がり],[立ち下がり]を検知する + [Rise(0->1)],[Fall(1->0)] + Sbdbt用として作成,流用可 + +使い方: +Public Member Functions: + + varEvent <useName> //宣言 + .input((int)<inputData>) //(void)検出したい変数(Data)を引数に代入 + .getRise() //(int)立ち上がり検知 検出時は(int)1,それ以外は(int)0を返す + .getFall() //(int)立ち下がり検知 検出時は(int)1,それ以外は(int)0を返す + +***************************************************************/ + class varEvent { - public: void input(int inputState) { valState = ((valState<<1)|inputState)&3; @@ -15,11 +34,11 @@ } } - int getRiseState(){ + int getRise(){ return riseState; } - int getFallState(){ + int getFall(){ return fallState; }