ライブラリ化を行った後

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_Practice1 by kusano kiyoshige

varEvent.h

Committer:
echo_piyo
Date:
2017-09-13
Revision:
50:e4e1f38d1bd5
Child:
51:70d45b959d6b

File content as of revision 50:e4e1f38d1bd5:

class varEvent {
    
public:
    void input(int inputState) {
        valState = ((valState<<1)|inputState)&3;
        if(valState == 1) {
            riseState = 1;
            fallState = 0;
        } else if(valState == 2){
            riseState = 0;
            fallState = 1;
        } else {
            riseState = 0;
            fallState = 0;
        }
    }
    
    int getRiseState(){
        return riseState;   
    }
    
    int getFallState(){
        return fallState;   
    }
    
private:
    int inputState, valState;
    int riseState, fallState;
};