Missing stuff
This commit is contained in:
@@ -198,7 +198,7 @@ void interrupt10ms(void)
|
|||||||
|
|
||||||
for (int i = 1; i < 7; i++) {
|
for (int i = 1; i < 7; i++) {
|
||||||
uint8_t value = in & (1 << i);
|
uint8_t value = in & (1 << i);
|
||||||
keys[enuk].input(value, (EnumKeys) enuk);
|
keys[enuk].input(value);
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ ISR(USART1_RX_vect)
|
|||||||
resh = (resh >> 1) & 0x01;
|
resh = (resh >> 1) & 0x01;
|
||||||
res = ((resh << 8) | resl);
|
res = ((resh << 8) | resl);
|
||||||
if((res == 0x180) | (res == 0x1C0)){ //button REb filter
|
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
|
} else if((res & 0x100) == 0x100){ //rotary filter
|
||||||
vpotToChange = res & 0xEF;
|
vpotToChange = res & 0xEF;
|
||||||
vpot_mod_state = 1;
|
vpot_mod_state = 1;
|
||||||
@@ -283,7 +283,7 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
in |= (tin & 0x30) >> 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
|
// INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
|
||||||
keys[enuk].input(in & (1<<i), (EnumKeys)enuk);
|
keys[enuk].input(in & (1<<i));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,13 +291,13 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
in = ~PINJ;
|
in = ~PINJ;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
// INP_D_TRM_RH_UP 0 .. INP_D_TRM_LH_UP 7
|
// 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));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODERS)
|
#if defined(ROTARY_ENCODERS)
|
||||||
keys[BTN_REa].input(REA_DOWN(), BTN_REa);
|
keys[BTN_REa].input(REA_DOWN());
|
||||||
keys[BTN_REb].input(REB_DOWN(), BTN_REb);
|
keys[BTN_REb].input(REB_DOWN());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -193,8 +193,8 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
{
|
{
|
||||||
uint8_t enuk = KEY_MENU;
|
uint8_t enuk = KEY_MENU;
|
||||||
|
|
||||||
keys[BTN_REa].input(~PINJ & 0b00000001, BTN_REa);
|
keys[BTN_REa].input(~PINJ & 0b00000001);
|
||||||
keys[BTN_REb].input(~PINJ & 0b00000010, BTN_REb);
|
keys[BTN_REb].input(~PINJ & 0b00000010);
|
||||||
|
|
||||||
uint8_t tin = ~PINL;
|
uint8_t tin = ~PINL;
|
||||||
uint8_t in;
|
uint8_t in;
|
||||||
@@ -203,7 +203,7 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
|
|
||||||
for (int i=1; i<7; i++) {
|
for (int i=1; i<7; i++) {
|
||||||
//INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
|
//INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
|
||||||
keys[enuk].input(in & (1<<i),(EnumKeys)enuk);
|
keys[enuk].input(in & (1<<i));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
in = ~PINF;
|
in = ~PINF;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
// INP_D_TRM_RH_UP 0 .. INP_D_TRM_LH_UP 7
|
// 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));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,20 +125,20 @@ void readKeysAndTrims()
|
|||||||
register uint32_t i;
|
register uint32_t i;
|
||||||
|
|
||||||
#if ROTARY_ENCODERS > 0
|
#if ROTARY_ENCODERS > 0
|
||||||
keys[BTN_REa].input(REA_DOWN(), BTN_REa);
|
keys[BTN_REa].input(REA_DOWN());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t enuk = KEY_MENU;
|
uint8_t enuk = KEY_MENU;
|
||||||
uint8_t in = ~readKeys();
|
uint8_t in = ~readKeys();
|
||||||
for (i = 1; i < 7; i++) {
|
for (i = 1; i < 7; i++) {
|
||||||
keys[enuk].input(in & (1 << i), (EnumKeys) enuk);
|
keys[enuk].input(in & (1 << i));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
in = readTrims();
|
in = readTrims();
|
||||||
|
|
||||||
for (i = 1; i < 256; i <<= 1) {
|
for (i = 1; i < 256; i <<= 1) {
|
||||||
keys[enuk].input(in & i, (EnumKeys) enuk);
|
keys[enuk].input(in & i);
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
uint8_t in = ~PINB;
|
uint8_t in = ~PINB;
|
||||||
for (int i=1; i<7; i++) {
|
for (int i=1; i<7; i++) {
|
||||||
// INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
|
// INP_B_KEY_MEN 1 .. INP_B_KEY_LFT 6
|
||||||
keys[enuk].input(in & (1<<i), (EnumKeys)enuk);
|
keys[enuk].input(in & (1<<i));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,12 +268,12 @@ FORCEINLINE void readKeysAndTrims()
|
|||||||
in = ~PIND;
|
in = ~PIND;
|
||||||
for (int i=0; i<8; i++) {
|
for (int i=0; i<8; i++) {
|
||||||
// INP_D_TRM_RH_UP 0 .. INP_D_TRM_LH_UP 7
|
// 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));
|
||||||
++enuk;
|
++enuk;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(ROTARY_ENCODER_NAVIGATION)
|
#if defined(ROTARY_ENCODER_NAVIGATION)
|
||||||
keys[enuk].input(ROTENC_DOWN(), (EnumKeys)enuk); // Rotary Enc. Switch
|
keys[enuk].input(ROTENC_DOWN()); // Rotary Enc. Switch
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(NAVIGATION_STICKS)
|
#if defined(NAVIGATION_STICKS)
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* Authors (alphabetical order)
|
||||||
|
* - Andre Bernet <bernet.andre@gmail.com>
|
||||||
|
* - Andreas Weitl
|
||||||
|
* - Bertrand Songis <bsongis@gmail.com>
|
||||||
|
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||||
|
* - Cameron Weeks <th9xer@gmail.com>
|
||||||
|
* - Erez Raviv
|
||||||
|
* - Gabriel Birkus
|
||||||
|
* - Jean-Pierre Parisy
|
||||||
|
* - Karl Szmutny
|
||||||
|
* - Michael Blandford
|
||||||
|
* - Michal Hlavinka
|
||||||
|
* - Pat Mackenzie
|
||||||
|
* - Philip Moss
|
||||||
|
* - Rob Thomson
|
||||||
|
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||||
|
* - 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 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user