Issue #192 - Trims and Rotary encoders buttons added to the switches

list
This commit is contained in:
Bertrand Songis
2014-02-06 12:45:53 +01:00
parent 46fe25fd24
commit 4a20329b2b
14 changed files with 178 additions and 108 deletions
+7 -14
View File
@@ -182,12 +182,6 @@ void pwrOff()
#endif
}
#if ROTARY_ENCODERS <= 2
#define ROTENC_DOWN() ((~PIND & 0x20) || (~PIND & 0x10))
#else
#define ROTENC_DOWN() (0)
#endif
FORCEINLINE uint8_t keyDown()
{
return ((~PINL) & 0x3F) || ROTENC_DOWN();
@@ -278,25 +272,24 @@ FORCEINLINE void readKeysAndTrims()
uint8_t enuk = KEY_MENU;
#if ROTARY_ENCODERS <= 2
keys[BTN_REa].input(~PIND & 0x20, BTN_REa);
#if defined(ROTARY_ENCODERS)
keys[BTN_REa].input(REA_DOWN(), BTN_REa);
keys[BTN_REb].input(REB_DOWN(), BTN_REb);
#endif
keys[BTN_REb].input(~PIND & 0x10, BTN_REb);
uint8_t tin = ~PINL;
uint8_t in;
in = (tin & 0x0f) << 3;
in |= (tin & 0x30) >> 3;
for (int i=1; i<7; i++)
{
for (int i=1; i<7; i++) {
//INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
keys[enuk].input(in & (1<<i),(EnumKeys)enuk);
keys[enuk].input(in & (1<<i), (EnumKeys)enuk);
++enuk;
}
// Trim switches ...
static const pm_uchar crossTrim[] PROGMEM ={
static const pm_uchar crossTrim[] PROGMEM = {
1<<INP_J_TRM_LH_DWN,
1<<INP_J_TRM_LH_UP,
1<<INP_J_TRM_LV_DWN,
@@ -311,7 +304,7 @@ FORCEINLINE void readKeysAndTrims()
for (int i=0; i<8; i++) {
// INP_D_TRM_RH_UP 0 .. INP_D_TRM_LH_UP 7
keys[enuk].input(in & pgm_read_byte(crossTrim+i),(EnumKeys)enuk);
keys[enuk].input(in & pgm_read_byte(crossTrim+i), (EnumKeys)enuk);
++enuk;
}
}