[Taranis X9E] We need to have a VARIANT in eeprom to recognize a Taranis
from a Taranis X9E EEPROM
This commit is contained in:
+5
-17
@@ -894,16 +894,17 @@ ifeq ($(PCB), TARANIS)
|
||||
PPM_LIMITS_SYMETRICAL = YES
|
||||
PPM_CENTER_ADJUSTABLE = YES
|
||||
DSM2 = PPM
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DEEPROM_RLC -DEEPROM_VARIANT=0 -DAUDIO -DPXX
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DCPUSTM32 -DVIRTUALINPUTS -DLUAINPUTS -DXCURVES -DEEPROM_RLC -DAUDIO -DPXX
|
||||
INCDIRS += targets/taranis $(THIRDPARTY) $(COOSDIR) $(COOSDIR)/kernel $(COOSDIR)/portable
|
||||
CPPDEFS += -DHSE_VALUE=12000000
|
||||
ifeq ($(PCBREV), REV9E)
|
||||
STM32LIBPATH = $(THIRDPARTY)/STM32F4xx_DSP_StdPeriph_Lib_V1.4.0/Libraries
|
||||
CPPDEFS += -DSTM32F4 -DSTM32F40_41xxx
|
||||
CPPDEFS += -DSTM32F4 -DSTM32F40_41xxx -DEEPROM_VARIANT=32768
|
||||
INCDIRS += $(STM32LIBPATH)/CMSIS/Device/ST/STM32F4xx/Include $(STM32LIBPATH)/CMSIS/Include $(STM32LIBPATH)/STM32F4xx_StdPeriph_Driver/inc
|
||||
LDSCRIPT = targets/taranis/stm32f4_flash.ld
|
||||
else
|
||||
STM32LIBPATH= $(THIRDPARTY)/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries
|
||||
CPPDEFS += -DEEPROM_VARIANT=0
|
||||
INCDIRS += $(STM32LIBPATH)/STM32F2xx_StdPeriph_Driver/inc $(STM32LIBPATH)/CMSIS/Device/ST/STM32F2xx/Include $(STM32LIBPATH)/CMSIS/include
|
||||
LDSCRIPT = targets/taranis/stm32f2_flash.ld
|
||||
endif
|
||||
@@ -1016,9 +1017,6 @@ ifeq ($(PCB), TARANIS)
|
||||
ifeq ($(MIXERS_MONITOR), YES)
|
||||
CPPDEFS += -DMIXERS_MONITOR
|
||||
endif
|
||||
ifeq ($(PCBREV), REV9E)
|
||||
CPPSRC += targets/taranis/rotenc_driver.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
@@ -1801,16 +1799,6 @@ gtest-all.o : $(GTEST_SRCS_)
|
||||
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) -I$(GTEST_DIR)/include -c \
|
||||
$(GTEST_DIR)/src/gtest-all.cc
|
||||
|
||||
gtest_main.o : $(GTEST_SRCS_)
|
||||
$(CXX) $(CPPFLAGS) -I$(GTEST_DIR) -I$(GTEST_DIR)/include -c \
|
||||
$(GTEST_DIR)/src/gtest_main.cc
|
||||
|
||||
gtest.a : gtest-all.o
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
gtest_main.a : gtest-all.o gtest_main.o
|
||||
$(AR) $(ARFLAGS) $@ $^
|
||||
|
||||
# Builds a sample test. A test should link with either gtest.a or
|
||||
# gtest_main.a, depending on whether it defines its own main()
|
||||
# function.
|
||||
@@ -1818,6 +1806,6 @@ gtest_main.a : gtest-all.o gtest_main.o
|
||||
#use all .cpp files from tests/ dir
|
||||
GTEST_TESTS_SRCS = $(shell find tests/ -type f -name '*.cpp')
|
||||
|
||||
gtests: allsimusrc.cpp $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp *.h gtest_main.a
|
||||
g++ -std=gnu++0x $(CPPFLAGS) $(SIMUCPPFLAGS) allsimusrc.cpp $(LUASRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp -I$(GTEST_DIR) ${INCFLAGS} -I$(GTEST_DIR)/include -I/usr/include/qt4 -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest_main.a -fexceptions
|
||||
gtests: allsimusrc.cpp $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp *.h gtest-all.o
|
||||
g++ -std=gnu++0x $(CPPFLAGS) $(SIMUCPPFLAGS) allsimusrc.cpp $(LUASRC) $(GTEST_TESTS_SRCS) targets/simu/simpgmspace.cpp -I$(GTEST_DIR) ${INCFLAGS} -I$(GTEST_DIR)/include -I/usr/include/qt4 -o gtests -lpthread -MD -DSIMU -lQtCore -lQtGui gtest-all.o -fexceptions
|
||||
|
||||
|
||||
@@ -893,12 +893,6 @@ void RlcFile::DisplayProgressBar(uint8_t x)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD)
|
||||
#define CHECK_EEPROM_VARIANT() (g_eeGeneral.variant == EEPROM_VARIANT)
|
||||
#else
|
||||
#define CHECK_EEPROM_VARIANT() (1)
|
||||
#endif
|
||||
|
||||
// For conversions ...
|
||||
#if defined(CPUARM)
|
||||
void loadGeneralSettings()
|
||||
@@ -921,13 +915,17 @@ bool eeLoadGeneral()
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, 1) == 1 && g_eeGeneral.version == EEPROM_VER) {
|
||||
theFile.openRlc(FILE_GENERAL);
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral) && CHECK_EEPROM_VARIANT()) {
|
||||
if (theFile.readRlc((uint8_t*)&g_eeGeneral, sizeof(g_eeGeneral)) <= sizeof(EEGeneral) && g_eeGeneral.variant == EEPROM_VARIANT) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (g_eeGeneral.version != EEPROM_VER) {
|
||||
if (g_eeGeneral.variant != EEPROM_VARIANT) {
|
||||
TRACE("EEPROM variant %d instead of %d", g_eeGeneral.variant, EEPROM_VARIANT);
|
||||
return false;
|
||||
}
|
||||
else if (g_eeGeneral.version != EEPROM_VER) {
|
||||
TRACE("EEPROM version %d instead of %d", g_eeGeneral.version, EEPROM_VER);
|
||||
if (!eeConvert()) {
|
||||
return false;
|
||||
|
||||
@@ -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