The last version programs
Dependencies: mbed TrapezoidControl Pulse QEI
Diff: Input/Encoder/Encoder.cpp
- Revision:
- 22:7d93f79a3686
- Parent:
- 16:3f2c2d89372b
diff -r e3b58d675c1c -r 7d93f79a3686 Input/Encoder/Encoder.cpp --- a/Input/Encoder/Encoder.cpp Mon Sep 09 00:19:28 2019 +0000 +++ b/Input/Encoder/Encoder.cpp Tue Sep 17 04:40:17 2019 +0000 @@ -1,30 +1,20 @@ #include "Encoder.h" #include "mbed.h" -#include "../../System/Process/InterruptProcess.h" - -InterruptIn BoardECD[] = { - InterruptIn(ECD_A_0), - InterruptIn(ECD_A_1), - InterruptIn(ECD_A_2), - InterruptIn(ECD_A_3), +const int PerRev = 256; - InterruptIn(ECD_B_0), - InterruptIn(ECD_B_1), - InterruptIn(ECD_B_2), - InterruptIn(ECD_B_3), -}; + QEI encoder[] = { + QEI(ECD_A_0,ECD_B_0,NC,PerRev,QEI::X4_ENCODING), + QEI(ECD_A_1,ECD_B_1,NC,PerRev,QEI::X4_ENCODING), + QEI(ECD_A_2,ECD_B_2,NC,PerRev,QEI::X4_ENCODING), + QEI(ECD_A_3,ECD_B_3,NC,PerRev,QEI::X4_ENCODING), + }; namespace ENCODER { + + + void ECD::Initialize() { - BoardECD[0].mode(PullUp); - BoardECD[1].mode(PullUp); - BoardECD[2].mode(PullUp); - BoardECD[3].mode(PullUp); - - BoardECD[0].fall(int2); - BoardECD[1].fall(int3); - BoardECD[2].fall(int4); - BoardECD[3].fall(int5); + } } \ No newline at end of file