mega2560 RotaryB ok
This commit is contained in:
@@ -71,11 +71,11 @@ inline void boardInit()
|
|||||||
|
|
||||||
/* Rotary encoder interrupt set-up */
|
/* Rotary encoder interrupt set-up */
|
||||||
EIMSK = 0; // disable ALL external interrupts.
|
EIMSK = 0; // disable ALL external interrupts.
|
||||||
// encoder 1
|
// encoder 1 //KO, wrong interrupt ?
|
||||||
EICRB = (1<<ISC60) | (1<<ISC50); // 01 = interrupt on any edge
|
EICRA = (1<<ISC10) | (1<<ISC00); // 01 = interrupt on any edge
|
||||||
EIFR = (3<<INTF5); // clear the int. flag in case it got set when changing modes
|
EIFR = (3<<INTF0); // clear the int. flag in case it got set when changing modes
|
||||||
// encoder 2
|
// encoder 2 //OK
|
||||||
EICRA = (1<<ISC30) | (1<<ISC20); // do the same for encoder 1
|
EICRA = (1<<ISC30) | (1<<ISC20);
|
||||||
EIFR = (3<<INTF2);
|
EIFR = (3<<INTF2);
|
||||||
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
EIMSK = (3<<INT5) | (3<<INT2); // enable the two rot. enc. ext. int. pairs.
|
||||||
}
|
}
|
||||||
@@ -216,27 +216,28 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rotary encoders increment/decrement (0 = rotary 1, 1 = rotary 2)
|
||||||
ISR(INT2_vect)
|
ISR(INT0_vect) // Arduino2560 IO21 (portD pin0)
|
||||||
{
|
|
||||||
uint8_t input = (PIND & 0x0C);
|
|
||||||
if (input == 0 || input == 0x0C) incRotaryEncoder(0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(INT3_vect)
|
|
||||||
{
|
|
||||||
uint8_t input = (PIND & 0x0C);
|
|
||||||
if (input == 0 || input == 0x0C) incRotaryEncoder(0, +1);
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR(INT5_vect)
|
|
||||||
{
|
{
|
||||||
uint8_t input = (PIND & 0x03);
|
uint8_t input = (PIND & 0x03);
|
||||||
if (input == 0 || input == 0x03) incRotaryEncoder(1, +1);
|
if (input == 0 || input == 0x03) incRotaryEncoder(0, +1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(INT6_vect)
|
ISR(INT1_vect) // Arduino2560 IO20 (portD pin1)
|
||||||
{
|
{
|
||||||
uint8_t input = (PIND & 0x03);
|
uint8_t input = (PIND & 0x03);
|
||||||
if (input == 0 || input == 0x03) incRotaryEncoder(1, -1);
|
if (input == 0 || input == 0x03) incRotaryEncoder(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ISR(INT2_vect) // Arduino2560 IO19 (portD pin2) //OK
|
||||||
|
{
|
||||||
|
uint8_t input = (PIND & 0x0C);
|
||||||
|
if (input == 0 || input == 0x0C) incRotaryEncoder(1, +1);
|
||||||
|
}
|
||||||
|
|
||||||
|
ISR(INT3_vect) // Arduino2560 IO18 (portD pin3) //OK
|
||||||
|
{
|
||||||
|
uint8_t input = (PIND & 0x0C);
|
||||||
|
if (input == 0 || input == 0x0C) incRotaryEncoder(1, -1);
|
||||||
|
}
|
||||||
|
|
||||||
@@ -142,10 +142,10 @@
|
|||||||
# define OUT_E_TELEM_TX 0 //same as Gruvin9x
|
# define OUT_E_TELEM_TX 0 //same as Gruvin9x
|
||||||
|
|
||||||
// Rotary encoders driver
|
// Rotary encoders driver
|
||||||
# define INP_D_ROT_ENC_1_A 0 //ko
|
# define INP_D_ROT_ENC_1_A 0 //ok
|
||||||
# define INP_D_ROT_ENC_1_B 1 //ko
|
# define INP_D_ROT_ENC_1_B 1 //ok
|
||||||
# define INP_D_ROT_ENC_2_A 2 //ok, but recognised as rotary 1
|
# define INP_D_ROT_ENC_2_A 2 //ok
|
||||||
# define INP_D_ROT_ENC_2_B 3 //ok, but recognised as rotary 1
|
# define INP_D_ROT_ENC_2_B 3 //ok
|
||||||
# define INP_J_ROT_ENC_1_PUSH 0 //ok
|
# define INP_J_ROT_ENC_1_PUSH 0 //ok
|
||||||
# define INP_J_ROT_ENC_2_PUSH 1 //ok
|
# define INP_J_ROT_ENC_2_PUSH 1 //ok
|
||||||
# define REA_DOWN() (~PINJ & (1<<INP_J_ROT_ENC_1_PUSH))
|
# define REA_DOWN() (~PINJ & (1<<INP_J_ROT_ENC_1_PUSH))
|
||||||
|
|||||||
Reference in New Issue
Block a user