EXTRA_ROTARY_ENCODERS changed as:

REb - left on same place - not moving to REa
REa reused as UART function
3 encoders from daughter board becomes as REa, REc, REd
push buttons sending from all 3 additional encoders
but decodes only from REa
This commit is contained in:
maxim.karban@gmail.com
2012-05-23 09:12:06 +00:00
parent 714bbf4fa2
commit f9673e3b8b
2 changed files with 8 additions and 17 deletions
+5 -7
View File
@@ -145,18 +145,18 @@ ISR(USART1_RX_vect)
/* Filter the 9th bit, then return */ /* Filter the 9th bit, then return */
resh = (resh >> 1) & 0x01; resh = (resh >> 1) & 0x01;
res = ((resh << 8) | resl); res = ((resh << 8) | resl);
if((res == 0x181) | (res == 0x1C1)){ //button REb filter if((res == 0x180) | (res == 0x1C0)){ //button REb filter
keys[BTN_REb].input((res & 0x1C1) == 0x1C1, BTN_REb); keys[BTN_REa].input((res & 0x1C0) == 0x1C0, BTN_REa);
} else if((res & 0x100) == 0x100){ //rotary filter } else if((res & 0x100) == 0x100){ //rotary filter
vpotToChange = res & 0xEF; vpotToChange = res & 0xEF;
vpot_mod_state = 1; vpot_mod_state = 1;
} }
else { else {
if(vpot_mod_state & (vpotToChange>0) & (vpotToChange<=NUM_UART_ROTARY_ENCODERS)) if(vpot_mod_state & (vpotToChange < NUM_ROTARY_ENCODERS))
{ {
int8_t vpot_inc = res & 0xFF; int8_t vpot_inc = res & 0xFF;
if(vpot_inc){ if(vpot_inc){
incRotaryEncoder((NUM_ROTARY_ENCODERS - NUM_UART_ROTARY_ENCODERS) + (vpotToChange - 1), vpot_inc); incRotaryEncoder(vpotToChange, vpot_inc);
} }
vpot_mod_state = 0; vpot_mod_state = 0;
} }
@@ -266,10 +266,8 @@ void readKeysAndTrims()
#if !defined(EXTRA_ROTARY_ENCODERS) #if !defined(EXTRA_ROTARY_ENCODERS)
keys[BTN_REa].input(~PIND & 0x20, BTN_REa); keys[BTN_REa].input(~PIND & 0x20, BTN_REa);
#endif //!EXTRA_ROTARY_ENCODERS
keys[BTN_REb].input(~PIND & 0x10, BTN_REb); keys[BTN_REb].input(~PIND & 0x10, BTN_REb);
#else //EXTRA_ROTARY_ENCODERS
keys[BTN_REa].input(~PIND & 0x10, BTN_REa);
#endif //EXTRA_ROTARY_ENCODERS
uint8_t tin = ~PINL; uint8_t tin = ~PINL;
uint8_t in; uint8_t in;
+3 -10
View File
@@ -2503,24 +2503,17 @@ ISR(INT3_vect)
} }
#endif //EXTRA_ROTARY_ENCODERS #endif //EXTRA_ROTARY_ENCODERS
#if !defined(EXTRA_ROTARY_ENCODERS)
#define ENC_B_ID 1
#else
#define ENC_B_ID 0
#endif
ISR(INT5_vect) ISR(INT5_vect)
{ {
uint8_t input = PINE & 0b01100000; uint8_t input = PINE & 0b01100000;
if (input == 0 || input == 0b01100000) incRotaryEncoder(ENC_B_ID, +1); if (input == 0 || input == 0b01100000) incRotaryEncoder(1, +1);
} }
ISR(INT6_vect) ISR(INT6_vect)
{ {
uint8_t input = PINE & 0b01100000; uint8_t input = PINE & 0b01100000;
if (input == 0 || input == 0b01100000) incRotaryEncoder(ENC_B_ID, -1); if (input == 0 || input == 0b01100000) incRotaryEncoder(1, -1);
} }
#endif #endif //PCBV4
#if !defined(PCBARM) #if !defined(PCBARM)
extern unsigned char __bss_end ; extern unsigned char __bss_end ;