Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 8a6cdbe

Browse files
authored
Refactor Encoders class and remove statics
1 parent 7e94dc9 commit 8a6cdbe

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

Diff for: src/Arduino_MachineControl.h

+5-6
Original file line numberDiff line numberDiff line change
@@ -390,12 +390,11 @@ extern AnalogOutClass analog_out;
390390
TODO: writeme
391391
Use QEI library for mbed since it implements index pin
392392
*/
393-
394-
static QEI _enc_0(PJ_8, PH_12, PH_11, 0);
395-
static QEI _enc_1(PC_13, PI_7, PJ_10, 0);
396-
397393
class EncoderClass {
398394
public:
395+
EncoderClass()
396+
: enc_0{PJ_8, PH_12, PH_11, 0}
397+
, enc_1{PC_13, PI_7, PJ_10, 0} {};
399398
QEI& operator[](int index) {
400399
switch (index) {
401400
case 0:
@@ -405,8 +404,8 @@ class EncoderClass {
405404
}
406405
}
407406
private:
408-
QEI& enc_0 = _enc_0;
409-
QEI& enc_1 = _enc_1;
407+
QEI enc_0;
408+
QEI enc_1;
410409
};
411410

412411
extern EncoderClass encoders;

0 commit comments

Comments
 (0)