STM32足回りプログラム
Dependencies: mbed ros_lib_kinetic
Diff: library/RotaryInc.cpp
- Revision:
- 1:7b0db5ea0ab7
- Parent:
- 0:a202e1bc38a1
--- a/library/RotaryInc.cpp Mon Jun 17 13:41:24 2019 +0000 +++ b/library/RotaryInc.cpp Tue Jul 09 07:47:43 2019 +0000 @@ -8,15 +8,15 @@ RotaryInc::RotaryInc(PinName pinA,PinName pinB,double circumference,int Resolution,int mode) :mode(mode),Resolution(Resolution),circumference(circumference){ measur = true; - zero(); init(pinA,pinB); } void RotaryInc::init(PinName pinA,PinName pinB){ + reset(); A = new InterruptIn(pinA,PullUp); B = new InterruptIn(pinB,PullUp); A->rise(callback(this,&RotaryInc::riseA)); - + if(mode == 2){ A->fall(callback(this,&RotaryInc::fallA)); }else if(mode == 4){