[Taranis X9E] We need to have a VARIANT in eeprom to recognize a Taranis
from a Taranis X9E EEPROM
This commit is contained in:
@@ -140,7 +140,6 @@ void boardInit()
|
||||
#endif
|
||||
|
||||
#if defined(REV9E)
|
||||
rotencInit();
|
||||
bt_open();
|
||||
#endif
|
||||
|
||||
|
||||
@@ -337,7 +337,7 @@ void bt_wakeup(void);
|
||||
// Top LCD driver
|
||||
#if defined(REV9E)
|
||||
void topLcdInit(void);
|
||||
void topLcdOff();
|
||||
void topLcdOff(void);
|
||||
void topLcdRefreshStart(void);
|
||||
void topLcdRefreshEnd(void);
|
||||
void setTopFirstTimer(int32_t value);
|
||||
|
||||
@@ -179,10 +179,6 @@ CPPSRC = ../lcd_driver.cpp \
|
||||
../../../strhelpers.cpp \
|
||||
boot.cpp
|
||||
|
||||
ifeq ($(PCBREV), REV9E)
|
||||
CPPSRC += ../rotenc_driver.cpp
|
||||
endif
|
||||
|
||||
# List ASM source files here
|
||||
|
||||
ifeq ($(PCBREV), REV9E)
|
||||
|
||||
@@ -26,6 +26,11 @@
|
||||
#define KEYS_GPIO_PIN_PAGE GPIO_Pin_3 // PD.02
|
||||
#define KEYS_GPIO_PIN_EXIT GPIO_Pin_2 // PD.03
|
||||
|
||||
// Rotary Encoder
|
||||
#define ENC_GPIO GPIOD
|
||||
#define ENC_GPIO_PIN_A GPIO_Pin_12 // PD.12
|
||||
#define ENC_GPIO_PIN_B GPIO_Pin_13 // PD.13
|
||||
|
||||
// Trims
|
||||
#if defined(REV9E)
|
||||
#define TRIMS_GPIO_REG_LHL GPIOG->IDR
|
||||
@@ -208,7 +213,7 @@
|
||||
#define KEYS_GPIOA_PINS (SWITCHES_GPIO_PIN_M_L)
|
||||
#define KEYS_GPIOB_PINS (SWITCHES_GPIO_PIN_N_H | SWITCHES_GPIO_PIN_N_L | SWITCHES_GPIO_PIN_R_H)
|
||||
#define KEYS_GPIOC_PINS (TRIMS_GPIO_PIN_RVD | TRIMS_GPIO_PIN_RVU | TRIMS_GPIO_PIN_RHL | TRIMS_GPIO_PIN_RHR)
|
||||
#define KEYS_GPIOD_PINS (KEYS_GPIO_PIN_MENU | KEYS_GPIO_PIN_EXIT | KEYS_GPIO_PIN_PAGE | SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_A_L)
|
||||
#define KEYS_GPIOD_PINS (KEYS_GPIO_PIN_MENU | KEYS_GPIO_PIN_EXIT | KEYS_GPIO_PIN_PAGE | SWITCHES_GPIO_PIN_A_H | SWITCHES_GPIO_PIN_A_L | ENC_GPIO_PIN_A | ENC_GPIO_PIN_B)
|
||||
#define KEYS_GPIOE_PINS (TRIMS_GPIO_PIN_LVU | TRIMS_GPIO_PIN_LVD | SWITCHES_GPIO_PIN_D_H | SWITCHES_GPIO_PIN_D_L| SWITCHES_GPIO_PIN_E_H | SWITCHES_GPIO_PIN_E_L | SWITCHES_GPIO_PIN_F | SWITCHES_GPIO_PIN_I_L | SWITCHES_GPIO_PIN_L_H | SWITCHES_GPIO_PIN_L_L | SWITCHES_GPIO_PIN_M_H | SWITCHES_GPIO_PIN_O_L | SWITCHES_GPIO_PIN_R_L)
|
||||
#define KEYS_GPIOF_PINS (KEYS_GPIO_PIN_ENTER | SWITCHES_GPIO_PIN_C_H | SWITCHES_GPIO_PIN_C_L | SWITCHES_GPIO_PIN_G_H | SWITCHES_GPIO_PIN_G_L | SWITCHES_GPIO_PIN_H | SWITCHES_GPIO_PIN_I_H | SWITCHES_GPIO_PIN_O_H | SWITCHES_GPIO_PIN_P_H | SWITCHES_GPIO_PIN_P_L | SWITCHES_GPIO_PIN_Q_H | SWITCHES_GPIO_PIN_Q_L)
|
||||
#define KEYS_GPIOG_PINS (TRIMS_GPIO_PIN_LHL | TRIMS_GPIO_PIN_LHR| SWITCHES_GPIO_PIN_B_H | SWITCHES_GPIO_PIN_B_L | SWITCHES_GPIO_PIN_J_H | SWITCHES_GPIO_PIN_J_L | SWITCHES_GPIO_PIN_K_H | SWITCHES_GPIO_PIN_K_L)
|
||||
|
||||
@@ -98,7 +98,29 @@ uint8_t keyDown()
|
||||
}
|
||||
|
||||
#if defined(REV9E)
|
||||
extern rotenc_t x9de_rotenc;
|
||||
uint32_t Rotary_position;
|
||||
rotenc_t x9de_rotenc;
|
||||
void checkRotaryEncoder()
|
||||
{
|
||||
register uint32_t dummy ;
|
||||
|
||||
dummy = ENC_GPIO->IDR; // Read Rotary encoder
|
||||
dummy >>= 12; // quick & dirty!
|
||||
dummy &= 0x03;
|
||||
if ( dummy != ( Rotary_position & 0x03 ) )
|
||||
{
|
||||
if ( ( Rotary_position & 0x01 ) ^ ( ( dummy & 0x02) >> 1 ) )
|
||||
{
|
||||
--x9de_rotenc;
|
||||
}
|
||||
else
|
||||
{
|
||||
++x9de_rotenc;
|
||||
}
|
||||
Rotary_position &= ~0x03 ;
|
||||
Rotary_position |= dummy ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* TODO common to ARM */
|
||||
@@ -230,38 +252,46 @@ bool switchState(EnumKeys enuk)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
void keysInit()
|
||||
{
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitTypeDef GPIO_InitStructure;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOA_PINS;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
|
||||
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
|
||||
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP ;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
#if defined(KEYS_GPIOA_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOA_PINS;
|
||||
GPIO_Init(GPIOA, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOB_PINS;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
#if defined(KEYS_GPIOB_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOB_PINS;
|
||||
GPIO_Init(GPIOB, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOC_PINS;
|
||||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
#if defined(KEYS_GPIOC_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOC_PINS;
|
||||
GPIO_Init(GPIOC, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOD_PINS;
|
||||
GPIO_Init(GPIOD, &GPIO_InitStructure);
|
||||
#if defined(KEYS_GPIOD_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOD_PINS;
|
||||
GPIO_Init(GPIOD, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOE_PINS;
|
||||
GPIO_Init(GPIOE, &GPIO_InitStructure);
|
||||
#if defined(KEYS_GPIOE_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOE_PINS;
|
||||
GPIO_Init(GPIOE, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIOF_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOF_PINS;
|
||||
GPIO_Init(GPIOF, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOF_PINS;
|
||||
GPIO_Init(GPIOF, &GPIO_InitStructure);
|
||||
#endif
|
||||
|
||||
#if defined(KEYS_GPIOG_PINS)
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOG_PINS;
|
||||
GPIO_Init(GPIOG, &GPIO_InitStructure);
|
||||
GPIO_InitStructure.GPIO_Pin = KEYS_GPIOG_PINS;
|
||||
GPIO_Init(GPIOG, &GPIO_InitStructure);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* 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( GPIO_Pin_12|GPIO_Pin_13, PIN_INPUT | PIN_PULLUP | PIN_PORTD ) ;
|
||||
}
|
||||
|
||||
void rotencEnd()
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t Rotary_position;
|
||||
rotenc_t x9de_rotenc;
|
||||
void checkRotaryEncoder()
|
||||
{
|
||||
register uint32_t dummy ;
|
||||
|
||||
dummy = GPIOD->IDR ; // Read Rotary encoder ( PE6, PE5 )
|
||||
dummy >>= 12 ;
|
||||
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