Charles Young's development fork. Going forward I only want to push mature code to main repository.
Fork of GEO_COUNTER_L432KC by
Diff: RotarySwitch.cpp
- Revision:
- 34:10550b327e3d
- Parent:
- 26:166dbe6022e8
- Child:
- 36:7fc5487bcc22
--- a/RotarySwitch.cpp Wed Sep 05 14:38:42 2018 -0700 +++ b/RotarySwitch.cpp Thu Sep 06 05:37:59 2018 -0700 @@ -10,16 +10,6 @@ // use it to select the current mode. QEI Wheel(D12, D11, NC, 16); // Quadrature encoder -#define CPM 0x01 -#define CPS 0x02 -#define PLS 0x04 -#define VOLTS 0x08 -#define CNT1 0x10 -#define CNT2 0x20 -#define HV 0x40 -#define MENU 0x80 -uint8_t LED_statuses[] = {CPM, CPS, PLS, VOLTS, CNT1, CNT2, HV, MENU}; - RotarySwitch::RotarySwitch() { LED_status = CPM; @@ -95,7 +85,7 @@ if (WHEEL_INACTIVE == currentWheelState) LEDs_write(0); else - LEDs_write(LED_statuses[LED_status_index]); + LEDs_write(0x01 << LED_status_index); // react to wheel if in proper state WheelCurrent = int(Wheel.getPulses()); @@ -105,14 +95,14 @@ if (WheelCurrent > WheelPrevious) { if (WHEEL_MODE_SELECT == currentWheelState) - LED_status_index = ++LED_status_index % sizeof(LED_statuses); + LED_status_index = ++LED_status_index % LED_status_index_size; direction = 1; } else if (WheelCurrent < WheelPrevious) { if (WHEEL_MODE_SELECT == currentWheelState) - LED_status_index = --LED_status_index % sizeof(LED_statuses); + LED_status_index = --LED_status_index % LED_status_index_size; direction = -1; }