diff --git a/radio/src/bootloader/boot.cpp b/radio/src/bootloader/boot.cpp index 7ea8a9de0..c4edd59a3 100644 --- a/radio/src/bootloader/boot.cpp +++ b/radio/src/bootloader/boot.cpp @@ -198,7 +198,7 @@ void interrupt10ms(void) for (int i = 1; i < 7; i++) { uint8_t value = in & (1 << i); - keys[enuk].input(value, (EnumKeys) enuk); + keys[enuk].input(value); ++enuk; } } diff --git a/radio/src/targets/gruvin9x/board_gruvin9x.cpp b/radio/src/targets/gruvin9x/board_gruvin9x.cpp index eb00ad7d0..8a6e0927d 100644 --- a/radio/src/targets/gruvin9x/board_gruvin9x.cpp +++ b/radio/src/targets/gruvin9x/board_gruvin9x.cpp @@ -147,7 +147,7 @@ ISR(USART1_RX_vect) resh = (resh >> 1) & 0x01; res = ((resh << 8) | resl); if((res == 0x180) | (res == 0x1C0)){ //button REb filter - keys[BTN_REa].input((res & 0x1C0) == 0x1C0, BTN_REa); + keys[BTN_REa].input((res & 0x1C0) == 0x1C0); } else if((res & 0x100) == 0x100){ //rotary filter vpotToChange = res & 0xEF; vpot_mod_state = 1; @@ -283,7 +283,7 @@ FORCEINLINE void readKeysAndTrims() in |= (tin & 0x30) >> 3; for (int i=1; i<7; i++) { // INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6 - keys[enuk].input(in & (1< 0 - keys[BTN_REa].input(REA_DOWN(), BTN_REa); + keys[BTN_REa].input(REA_DOWN()); #endif uint8_t enuk = KEY_MENU; uint8_t in = ~readKeys(); for (i = 1; i < 7; i++) { - keys[enuk].input(in & (1 << i), (EnumKeys) enuk); + keys[enuk].input(in & (1 << i)); ++enuk; } in = readTrims(); for (i = 1; i < 256; i <<= 1) { - keys[enuk].input(in & i, (EnumKeys) enuk); + keys[enuk].input(in & i); ++enuk; } } diff --git a/radio/src/targets/stock/board_stock.cpp b/radio/src/targets/stock/board_stock.cpp index eaf5f2201..c7114a979 100644 --- a/radio/src/targets/stock/board_stock.cpp +++ b/radio/src/targets/stock/board_stock.cpp @@ -260,7 +260,7 @@ FORCEINLINE void readKeysAndTrims() uint8_t in = ~PINB; for (int i=1; i<7; i++) { // INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6 - keys[enuk].input(in & (1< + * - Andreas Weitl + * - Bertrand Songis + * - Bryan J. Rentoul (Gruvin) + * - Cameron Weeks + * - Erez Raviv + * - Gabriel Birkus + * - Jean-Pierre Parisy + * - Karl Szmutny + * - Michael Blandford + * - Michal Hlavinka + * - Pat Mackenzie + * - Philip Moss + * - Rob Thomson + * - Romolo Manfredini + * - Thomas Husterer + * + * opentx is based on code named + * gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/, + * er9x by Erez Raviv: http://code.google.com/p/er9x/, + * and the original (and ongoing) project by + * Thomas Husterer, th9x: http://code.google.com/p/th9x/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ + +#include "../opentx.h" + +void rotencInit() +{ + configure_pins( 0x0060, PIN_INPUT | PIN_PULLUP | PIN_PORTE ) ; +} + +void rotencEnd() +{ +} + +uint32_t Rotary_position; +rotenc_t x9de_rotenc; +void checkRotaryEncoder() +{ + register uint32_t dummy ; + + dummy = GPIOE->IDR ; // Read Rotary encoder ( PE6, PE5 ) + dummy >>= 5 ; + dummy &= 0x03 ; // pick out the two bits + if ( dummy != ( Rotary_position & 0x03 ) ) + { + if ( ( Rotary_position & 0x01 ) ^ ( ( dummy & 0x02) >> 1 ) ) + { + ++x9de_rotenc; + } + else + { + --x9de_rotenc; + } + Rotary_position &= ~0x03 ; + Rotary_position |= dummy ; + } +}