chore(hal): streamline rotary encoder definitions (#2550)
This commit is contained in:
@@ -91,7 +91,7 @@ void rotaryEncoderCheck()
|
|||||||
static uint8_t state = 0;
|
static uint8_t state = 0;
|
||||||
uint8_t pins = ROTARY_ENCODER_POSITION();
|
uint8_t pins = ROTARY_ENCODER_POSITION();
|
||||||
|
|
||||||
#if (defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)) || defined(RADIO_TX12)
|
#if defined(ROTARY_ENCODER_SUPPORT_BUGGY_WIRING)
|
||||||
if (pins != (state & 0x03) && !(readKeys() & (1 << KEY_ENTER))) {
|
if (pins != (state & 0x03) && !(readKeys() & (1 << KEY_ENTER))) {
|
||||||
if ((pins ^ (state & 0x03)) == 0x03) {
|
if ((pins ^ (state & 0x03)) == 0x03) {
|
||||||
if (pins == 3) {
|
if (pins == 3) {
|
||||||
@@ -111,7 +111,7 @@ void rotaryEncoderCheck()
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (pins != state && !(readKeys() & (1 << KEY_ENTER))) {
|
if (pins != state && !(readKeys() & (1 << KEY_ENTER))) {
|
||||||
#if defined(RADIO_ZORRO) || defined(RADIO_TX12MK2) // def. rotation dir is inverse of other radios
|
#if defined(ROTARY_ENCODER_INVERTED)
|
||||||
if (!(state & 0x01) ^ ((pins & 0x02) >> 1)) {
|
if (!(state & 0x01) ^ ((pins & 0x02) >> 1)) {
|
||||||
#else
|
#else
|
||||||
if ((state & 0x01) ^ ((pins & 0x02) >> 1)) {
|
if ((state & 0x01) ^ ((pins & 0x02) >> 1)) {
|
||||||
|
|||||||
@@ -92,6 +92,10 @@
|
|||||||
#define ROTARY_ENCODER_TIMER_IRQn TIM4_IRQn
|
#define ROTARY_ENCODER_TIMER_IRQn TIM4_IRQn
|
||||||
#define ROTARY_ENCODER_TIMER_IRQHandler TIM4_IRQHandler
|
#define ROTARY_ENCODER_TIMER_IRQHandler TIM4_IRQHandler
|
||||||
|
|
||||||
|
#if defined(RADIO_FAMILY_T16) && !defined(RADIO_T18)
|
||||||
|
#define ROTARY_ENCODER_SUPPORT_BUGGY_WIRING
|
||||||
|
#endif
|
||||||
|
|
||||||
// Switches
|
// Switches
|
||||||
#define STORAGE_SWITCH_A
|
#define STORAGE_SWITCH_A
|
||||||
#define HARDWARE_SWITCH_A
|
#define HARDWARE_SWITCH_A
|
||||||
|
|||||||
@@ -249,6 +249,12 @@
|
|||||||
#define ROTARY_ENCODER_EXTI_PortSource EXTI_PortSourceGPIOE
|
#define ROTARY_ENCODER_EXTI_PortSource EXTI_PortSourceGPIOE
|
||||||
#define ROTARY_ENCODER_EXTI_PinSource1 EXTI_PinSource9
|
#define ROTARY_ENCODER_EXTI_PinSource1 EXTI_PinSource9
|
||||||
#define ROTARY_ENCODER_EXTI_PinSource2 EXTI_PinSource10
|
#define ROTARY_ENCODER_EXTI_PinSource2 EXTI_PinSource10
|
||||||
|
#if defined(RADIO_TX12)
|
||||||
|
#define ROTARY_ENCODER_SUPPORT_BUGGY_WIRING
|
||||||
|
#endif
|
||||||
|
#if defined(RADIO_TX12MK2) || defined(RADIO_ZORRO)
|
||||||
|
#define ROTARY_ENCODER_INVERTED
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
|
|||||||
Reference in New Issue
Block a user