インクリメント方式エンコーダ用ライブラリ

Dependents:   RobotControl_Sample2022 sotsuken_mecha

初期化 IncEncoder name(pinA,pinB,分解能); 分解能 : x2_resolution x4_resolution

リセット name.reset();

IncEncoder.h

Committer:
koki_konishi
Date:
23 months ago
Revision:
0:c40c29a063c0

File content as of revision 0:c40c29a063c0:

#ifndef MBED_INCENCODER_H
#define MBED_INCENCODER_H

#include "mbed.h"

class IncEncoder{
public: 
    typedef enum Encoding {
        x2_Resolution,
        x4_Resolution
    } Encoding;
    
    IncEncoder(PinName ENC_A,PinName ENC_B,Encoding encoding);
    
    int IncEncoder::GetIncPulses();
    
    void IncEncoder::reset();
    
    void IncEncoder::A_RISE();
    
    void IncEncoder::A_FALL();
    
    void IncEncoder::B_RISE();
    
    void IncEncoder::B_FALL();

private:
    int pulses;
    
    InterruptIn ENC_A_;
    InterruptIn ENC_B_;
};

#endif