1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 12:25:12 +03:00

Taranis X9E Simulator - with rotary encoder

This commit is contained in:
bsongis 2014-12-01 20:15:13 +01:00
parent de43ce71df
commit fa963041ef
29 changed files with 465 additions and 50 deletions

View file

@ -129,6 +129,7 @@ set(common_SRCS
firmwares/opentx/open9xSky9xeeprom.cpp firmwares/opentx/open9xSky9xeeprom.cpp
firmwares/opentx/opentxinterface.cpp firmwares/opentx/opentxinterface.cpp
firmwares/opentx/opentxTaranisSimulator.cpp firmwares/opentx/opentxTaranisSimulator.cpp
firmwares/opentx/opentxTaranisX9ESimulator.cpp
firmwares/opentx/opentxSky9xsimulator.cpp firmwares/opentx/opentxSky9xsimulator.cpp
firmwares/opentx/opentxGruvin9xsimulator.cpp firmwares/opentx/opentxGruvin9xsimulator.cpp
firmwares/opentx/opentxM128simulator.cpp firmwares/opentx/opentxM128simulator.cpp

View file

@ -49,7 +49,8 @@ enum BoardEnum {
BOARD_SKY9X, BOARD_SKY9X,
BOARD_9XRPRO, BOARD_9XRPRO,
BOARD_TARANIS, BOARD_TARANIS,
BOARD_TARANIS_PLUS BOARD_TARANIS_PLUS,
BOARD_TARANIS_X9E
}; };
QString getBoardName(BoardEnum board); QString getBoardName(BoardEnum board);
@ -59,8 +60,8 @@ QString getBoardName(BoardEnum board);
#define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560) #define IS_2560(board) (board==BOARD_GRUVIN9X || board==BOARD_MEGA2560)
#define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO) #define IS_SKY9X(board) (board==BOARD_SKY9X || board==BOARD_9XRPRO)
#define IS_9XRPRO(board) (board==BOARD_9XRPRO) #define IS_9XRPRO(board) (board==BOARD_9XRPRO)
#define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS) #define IS_TARANIS(board) (board==BOARD_TARANIS || board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS) #define IS_TARANIS_PLUS(board) (board==BOARD_TARANIS_PLUS || board==BOARD_TARANIS_X9E)
#define IS_ARM(board) (IS_TARANIS(board) || IS_SKY9X(board)) #define IS_ARM(board) (IS_TARANIS(board) || IS_SKY9X(board))
const uint8_t modn12x3[4][4]= { const uint8_t modn12x3[4][4]= {

View file

@ -0,0 +1,307 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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 "opentxTaranisX9ESimulator.h"
#include "opentxinterface.h"
#include "appdata.h"
#define SIMU
#define SIMU_EXCEPTIONS
#define PCBTARANIS
#define CPUARM
#define HELI
#define SPLASH
#define FLIGHT_MODES
#define FRSKY
#define FRSKY_HUB
#define FRSKY_SPORT
#define GPS
#define VARIO
#define GAUGES
#define PPM_UNIT_PERCENT_PREC1
#define AUDIO
#define VOICE
#define PXX
#define DSM2
#define DSM2_PPM
#define DBLKEYS
#define AUTOSWITCH
#define GRAPHICS
#define SDCARD
#define RTCLOCK
#define CURVES
#define XCURVES
#define GVARS
#define BOLD_FONT
#define PPM_CENTER_ADJUSTABLE
#define PPM_LIMITS_SYMETRICAL
#define FAI_CHOICE
#define LUA
#define LUA_MODEL_SCRIPTS
#define EEPROM_VARIANT 3
#define HAPTIC
#define REVPLUS
#define REV9E
#define OVERRIDE_CHANNEL_FUNCTION
#define NUM_POTS 5
#undef min
#undef max
#include <exception>
namespace Open9xX9E {
int taranisSimulatorBoard = 0;
inline int geteepromsize() {
return 32*1024;
}
#define EESIZE geteepromsize()
#include "radio/src/targets/taranis/board_taranis.cpp"
#include "radio/src/pulses/ppm_arm.cpp"
#include "radio/src/pulses/pxx_arm.cpp"
#include "radio/src/pulses/dsm2_arm.cpp"
#include "radio/src/eeprom_common.cpp"
#include "radio/src/eeprom_conversions.cpp"
#include "radio/src/eeprom_rlc.cpp"
#include "radio/src/opentx.cpp"
#include "radio/src/strhelpers.cpp"
#include "radio/src/switches.cpp"
#include "radio/src/functions.cpp"
#include "radio/src/curves.cpp"
#include "radio/src/mixer.cpp"
#include "radio/src/targets/taranis/pulses_driver.cpp"
#include "radio/src/targets/taranis/rtc_driver.cpp"
#include "radio/src/targets/taranis/rotenc_driver.cpp"
#include "radio/src/targets/taranis/trainer_driver.cpp"
#include "radio/src/targets/taranis/uart3_driver.cpp"
#include "radio/src/pulses/pulses_arm.cpp"
#include "radio/src/tasks_arm.cpp"
#include "radio/src/stamp.cpp"
#include "radio/src/maths.cpp"
#include "radio/src/vario.cpp"
#include "radio/src/gui/menus.cpp"
#include "radio/src/gui/menu_model.cpp"
#include "radio/src/gui/menu_general.cpp"
#include "radio/src/gui/Taranis/view_main.cpp"
#include "radio/src/gui/view_statistics.cpp"
#include "radio/src/gui/view_channels.cpp"
#include "radio/src/gui/view_telemetry.cpp"
#include "radio/src/gui/view_text.cpp"
#include "radio/src/gui/view_about.cpp"
#include "radio/src/lcd_common.cpp"
#include "radio/src/lcd_taranis.cpp"
#include "radio/src/logs.cpp"
#include "radio/src/rtc.cpp"
#include "radio/src/targets/taranis/keys_driver.cpp"
#include "radio/src/keys.cpp"
#include "radio/src/bmp.cpp"
#include "radio/src/haptic.cpp"
#include "radio/src/sbus.cpp"
#include "radio/src/targets/taranis/haptic_driver.cpp"
// TODO Because FatFS in not C++ there cannot be namespaces there and the functions are defined several times!
#undef SDCARD
#include "radio/src/targets/simu/simpgmspace.cpp"
#define SDCARD
#include "radio/src/translations.cpp"
#include "radio/src/fonts.cpp"
#include "radio/src/telemetry/telemetry.cpp"
#include "radio/src/telemetry/frsky.cpp"
#include "radio/src/telemetry/frsky_sport.cpp"
#include "radio/src/telemetry/frsky_d.cpp"
#include "radio/src/targets/taranis/audio_driver.cpp"
#include "radio/src/targets/taranis/telemetry_driver.cpp"
#include "radio/src/audio_arm.cpp"
#include "radio/src/translations/tts_cz.cpp"
#include "radio/src/translations/tts_de.cpp"
#include "radio/src/translations/tts_en.cpp"
#include "radio/src/translations/tts_es.cpp"
#include "radio/src/translations/tts_se.cpp"
#include "radio/src/translations/tts_it.cpp"
#include "radio/src/translations/tts_fr.cpp"
#include "radio/src/translations/tts_pt.cpp"
#include "radio/src/translations/tts_sk.cpp"
#include "radio/src/translations/tts_pl.cpp"
#include "radio/src/translations/tts_hu.cpp"
#include "radio/src/lua.cpp"
#include "radio/src/lua/src/lapi.c"
#include "radio/src/lua/src/lcode.c"
#include "radio/src/lua/src/lctype.c"
#include "radio/src/lua/src/ldebug.c"
#include "radio/src/lua/src/ldo.c"
#include "radio/src/lua/src/ldump.c"
#include "radio/src/lua/src/lfunc.c"
#include "radio/src/lua/src/lgc.c"
#include "radio/src/lua/src/llex.c"
#include "radio/src/lua/src/lmem.c"
#include "radio/src/lua/src/lobject.c"
#include "radio/src/lua/src/lopcodes.c"
#include "radio/src/lua/src/lparser.c"
#include "radio/src/lua/src/lstate.c"
#include "radio/src/lua/src/lstring.c"
#include "radio/src/lua/src/ltable.c"
#include "radio/src/lua/src/lrotable.c"
#include "radio/src/lua/src/ltm.c"
#include "radio/src/lua/src/lundump.c"
#include "radio/src/lua/src/lvm.c"
#include "radio/src/lua/src/lzio.c"
#include "radio/src/lua/src/lbaselib.c"
#include "radio/src/lua/src/linit.c"
#include "radio/src/lua/src/lmathlib.c"
#include "radio/src/lua/src/lbitlib.c"
#include "radio/src/lua/src/loadlib.c"
#include "radio/src/lua/src/lauxlib.c"
#include "radio/src/lua/src/ltablib.c"
#include "radio/src/lua/src/lcorolib.c"
int16_t g_anas[NUM_STICKS+5];
uint16_t anaIn(uint8_t chan)
{
return g_anas[chan];
}
bool hasExtendedTrims()
{
return g_model.extendedTrims;
}
uint8_t getStickMode()
{
return limit<uint8_t>(0, g_eeGeneral.stickMode, 3);
}
void resetTrims()
{
GPIOE->IDR |= PIN_TRIM_LH_L | PIN_TRIM_LH_R | PIN_TRIM_LV_DN | PIN_TRIM_LV_UP;
GPIOC->IDR |= PIN_TRIM_RV_DN | PIN_TRIM_RV_UP | PIN_TRIM_RH_L | PIN_TRIM_RH_R;
}
}
using namespace Open9xX9E;
OpentxTaranisX9ESimulator::OpentxTaranisX9ESimulator()
{
taranisSimulatorBoard = GetEepromInterface()->getBoard();
QString path=g.profile[g.id()].sdPath()+"/";
int i=0;
for (i=0; i< std::min(path.length(),1022); i++) {
simuSdDirectory[i]=path.at(i).toAscii();
}
simuSdDirectory[i]=0;
}
bool OpentxTaranisX9ESimulator::timer10ms()
{
#define TIMER10MS_IMPORT
#include "simulatorimport.h"
}
uint8_t * OpentxTaranisX9ESimulator::getLcd()
{
#define GETLCD_IMPORT
#include "simulatorimport.h"
}
bool OpentxTaranisX9ESimulator::lcdChanged(bool & lightEnable)
{
#define LCDCHANGED_IMPORT
#include "simulatorimport.h"
}
void OpentxTaranisX9ESimulator::start(QByteArray & eeprom, bool tests)
{
memcpy(Open9xX9E::eeprom, eeprom.data(), std::min<int>(sizeof(Open9xX9E::eeprom), eeprom.size()));
StartEepromThread(NULL);
StartMainThread(tests);
}
void OpentxTaranisX9ESimulator::start(const char * filename, bool tests)
{
StartEepromThread(filename);
StartMainThread(tests);
}
void OpentxTaranisX9ESimulator::stop()
{
StopMainThread();
StopEepromThread();
}
void OpentxTaranisX9ESimulator::getValues(TxOutputs &outputs)
{
#define GETVALUES_IMPORT
#define g_chans512 channelOutputs
#include "simulatorimport.h"
}
void OpentxTaranisX9ESimulator::setValues(TxInputs &inputs)
{
#define SETVALUES_IMPORT
#include "simulatorimport.h"
}
void OpentxTaranisX9ESimulator::setTrim(unsigned int idx, int value)
{
idx = Open9xX9E::modn12x3[4*getStickMode() + idx];
uint8_t phase = getTrimFlightPhase(getFlightMode(), idx);
setTrimValue(phase, idx, value);
}
void OpentxTaranisX9ESimulator::getTrims(Trims & trims)
{
uint8_t phase = getFlightMode();
trims.extended = hasExtendedTrims();
for (uint8_t idx=0; idx<4; idx++) {
trims.values[idx] = getTrimValue(getTrimFlightPhase(phase, idx), idx);
}
for (int i=0; i<2; i++) {
uint8_t idx = Open9xX9E::modn12x3[4*getStickMode() + i];
int16_t tmp = trims.values[i];
trims.values[i] = trims.values[idx];
trims.values[idx] = tmp;
}
}
void OpentxTaranisX9ESimulator::wheelEvent(uint8_t steps)
{
if (steps == 255)
x9de_rotenc -= 2;
else
x9de_rotenc += 2;
}
unsigned int OpentxTaranisX9ESimulator::getPhase()
{
return getFlightMode();
}
const char * OpentxTaranisX9ESimulator::getPhaseName(unsigned int phase)
{
static char buff[sizeof(g_model.flightModeData[0].name)+1];
zchar2str(buff, g_model.flightModeData[phase].name, sizeof(g_model.flightModeData[0].name));
return buff;
}
const char * OpentxTaranisX9ESimulator::getError()
{
#define GETERROR_IMPORT
#include "simulatorimport.h"
}

View file

@ -0,0 +1,61 @@
/*
* Author - Bertrand Songis <bsongis@gmail.com>
*
* Based on 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.
*
*/
#ifndef opentx_taranis_x9e_simulator_h
#define opentx_taranis_x9e_simulator_h
#include "simulatorinterface.h"
class RadioData;
class OpenTxEepromInterface;
class OpentxTaranisX9ESimulator : public SimulatorInterface {
public:
OpentxTaranisX9ESimulator();
virtual void start(QByteArray & eeprom, bool tests=true);
virtual void start(const char * filename, bool tests=true);
virtual void stop();
virtual bool timer10ms();
virtual uint8_t * getLcd();
virtual bool lcdChanged(bool & lightEnable);
virtual void setValues(TxInputs &inputs);
virtual void getValues(TxOutputs &outputs);
virtual void setTrim(unsigned int idx, int value);
virtual void getTrims(Trims & trims);
virtual unsigned int getPhase();
virtual const char * getPhaseName(unsigned int phase);
virtual void wheelEvent(uint8_t steps);
virtual const char * getError();
};
#endif

View file

@ -25,6 +25,7 @@
#include "opentxGruvin9xsimulator.h" #include "opentxGruvin9xsimulator.h"
#include "opentxSky9xsimulator.h" #include "opentxSky9xsimulator.h"
#include "opentxTaranisSimulator.h" #include "opentxTaranisSimulator.h"
#include "opentxTaranisX9ESimulator.h"
#include "file.h" #include "file.h"
#include "appdata.h" #include "appdata.h"
@ -67,6 +68,8 @@ const char * OpenTxEepromInterface::getName()
return "OpenTX for FrSky Taranis"; return "OpenTX for FrSky Taranis";
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
return "OpenTX for FrSky Taranis Plus"; return "OpenTX for FrSky Taranis Plus";
case BOARD_TARANIS_X9E:
return "OpenTX for FrSky Taranis X9E";
case BOARD_SKY9X: case BOARD_SKY9X:
return "OpenTX for Sky9x board / 9X"; return "OpenTX for Sky9x board / 9X";
case BOARD_9XRPRO: case BOARD_9XRPRO:
@ -91,6 +94,7 @@ const int OpenTxEepromInterface::getEEpromSize()
return EESIZE_9XRPRO; return EESIZE_9XRPRO;
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
return EESIZE_TARANIS; return EESIZE_TARANIS;
default: default:
return 0; return 0;
@ -375,6 +379,7 @@ int OpenTxEepromInterface::save(uint8_t *eeprom, RadioData &radioData, uint32_t
switch(board) { switch(board) {
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
case BOARD_SKY9X: case BOARD_SKY9X:
case BOARD_9XRPRO: case BOARD_9XRPRO:
version = 217; version = 217;
@ -617,7 +622,7 @@ int OpenTxFirmware::getCapability(const Capability capability)
case SoundPitch: case SoundPitch:
return 1; return 1;
case Haptic: case Haptic:
return (board == BOARD_GRUVIN9X || IS_SKY9X(board) || board == BOARD_TARANIS_PLUS || id.contains("haptic")); return (board == BOARD_GRUVIN9X || IS_SKY9X(board) || IS_TARANIS_PLUS(board) || id.contains("haptic"));
case ModelTrainerEnable: case ModelTrainerEnable:
if (IS_ARM(board)) if (IS_ARM(board))
return 1; return 1;
@ -1013,6 +1018,7 @@ QString OpenTxFirmware::getFirmwareUrl()
case BOARD_9XRPRO: case BOARD_9XRPRO:
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
case BOARD_TARANIS_X9E:
url.append(QString("/getfw.php?fw=%1.bin").arg(id)); url.append(QString("/getfw.php?fw=%1.bin").arg(id));
break; break;
default: default:
@ -1051,6 +1057,8 @@ SimulatorInterface * OpenTxFirmware::getSimulator()
case BOARD_TARANIS: case BOARD_TARANIS:
case BOARD_TARANIS_PLUS: case BOARD_TARANIS_PLUS:
return new OpentxTaranisSimulator(); return new OpentxTaranisSimulator();
case BOARD_TARANIS_X9E:
return new OpentxTaranisX9ESimulator();
default: default:
return NULL; return NULL;
} }
@ -1281,11 +1289,19 @@ void registerOpenTxFirmwares()
openTx->addOption("nogvars", QObject::tr("Disable Global variables")); openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("lua", QObject::tr("Support for Lua model scripts")); openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)")); openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
openTx->addOption("SWR", QObject::tr("SWR value will be available for display/audio/alarms - Only available on latest Taranis+ production"));
addOpenTxCommonOptions(openTx); addOpenTxCommonOptions(openTx);
firmwares.push_back(openTx); firmwares.push_back(openTx);
default_firmware_variant = GetFirmware("opentx-taranis-en"); /* Taranis X9E board */
openTx = new OpenTxFirmware("opentx-taranisx9e", QObject::tr("OpenTX for FrSky Taranis X9E"), BOARD_TARANIS_X9E);
openTx->addOption("noheli", QObject::tr("Disable HELI menu and cyclic mix support"));
openTx->addOption("nogvars", QObject::tr("Disable Global variables"));
openTx->addOption("lua", QObject::tr("Support for Lua model scripts"));
openTx->addOption("nojoystick", QObject::tr("No Joystick emulation inside the FW (only Mass Storage as in the Bootloader)"));
addOpenTxCommonOptions(openTx);
firmwares.push_back(openTx);
default_firmware_variant = GetFirmware("opentx-taranisplus-en");
current_firmware_variant = default_firmware_variant; current_firmware_variant = default_firmware_variant;
} }

View file

@ -47,6 +47,10 @@ if (inputs.rotenc) pind |= 0x20;
#ifdef PCBSKY9X #ifdef PCBSKY9X
if (inputs.rotenc) PIOB->PIO_PDSR &= ~0x40; else PIOB->PIO_PDSR |= 0x40; if (inputs.rotenc) PIOB->PIO_PDSR &= ~0x40; else PIOB->PIO_PDSR |= 0x40;
#endif #endif
#if defined(PCBTARANIS) && defined(REV9E)
if (inputs.rotenc) simuSetKey(KEY_ENTER, true);
#endif
#endif #endif
#ifdef GETVALUES_IMPORT #ifdef GETVALUES_IMPORT

View file

@ -5,7 +5,7 @@
#ifndef _DISKIO_DEFINED #ifndef _DISKIO_DEFINED
#define _DISKIO_DEFINED #define _DISKIO_DEFINED
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -73,7 +73,7 @@ DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
#define ATA_GET_MODEL 21 /* Get model name */ #define ATA_GET_MODEL 21 /* Get model name */
#define ATA_GET_SN 22 /* Get serial number */ #define ATA_GET_SN 22 /* Get serial number */
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -17,7 +17,7 @@
#ifndef _FATFS #ifndef _FATFS
#define _FATFS 80376 /* Revision ID */ #define _FATFS 80376 /* Revision ID */
#ifdef __cplusplus #if defined(__cplusplus)
extern "C" { extern "C" {
#endif #endif
@ -334,7 +334,7 @@ int ff_del_syncobj (_SYNC_t sobj); /* Delete a sync object */
#define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24) #define ST_DWORD(ptr,val) *(BYTE*)(ptr)=(BYTE)(val); *((BYTE*)(ptr)+1)=(BYTE)((WORD)(val)>>8); *((BYTE*)(ptr)+2)=(BYTE)((DWORD)(val)>>16); *((BYTE*)(ptr)+3)=(BYTE)((DWORD)(val)>>24)
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus)
} }
#endif #endif

View file

@ -61,13 +61,13 @@ extern uint8_t g_ms100; // global to allow time set function to reset to zero
void rtcInit(); void rtcInit();
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
void rtcSetTime(struct gtm * tm); void rtcSetTime(struct gtm * tm);
void gettime(struct gtm * tm); void gettime(struct gtm * tm);
gtime_t gmktime (struct gtm *tm); gtime_t gmktime (struct gtm *tm);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -290,16 +290,16 @@ long Open9xSim::onTimeout(FXObject*, FXSelector, void*)
SWITCH_KEY(F, 5, 3); SWITCH_KEY(F, 5, 3);
SWITCH_KEY(G, 6, 3); SWITCH_KEY(G, 6, 3);
SWITCH_KEY(H, 7, 3); SWITCH_KEY(H, 7, 3);
SWITCH_KEY(I, 8, 3); // SWITCH_KEY(I, 8, 3);
SWITCH_KEY(J, 9, 3); // SWITCH_KEY(J, 9, 3);
SWITCH_KEY(K, 10, 3); // SWITCH_KEY(K, 10, 3);
SWITCH_KEY(L, 11, 3); // SWITCH_KEY(L, 11, 3);
SWITCH_KEY(M, 12, 3); // SWITCH_KEY(M, 12, 3);
SWITCH_KEY(N, 13, 3); // SWITCH_KEY(N, 13, 3);
SWITCH_KEY(O, 14, 3); // SWITCH_KEY(O, 14, 3);
SWITCH_KEY(P, 15, 3); // SWITCH_KEY(P, 15, 3);
SWITCH_KEY(Q, 16, 3); // SWITCH_KEY(Q, 16, 3);
SWITCH_KEY(R, 17, 3); // SWITCH_KEY(R, 17, 3);
#elif defined(PCBTARANIS) #elif defined(PCBTARANIS)
SWITCH_KEY(A, 0, 3); SWITCH_KEY(A, 0, 3);
SWITCH_KEY(B, 1, 3); SWITCH_KEY(B, 1, 3);

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_GPIO_H #ifndef __STM32F2xx_GPIO_H
#define __STM32F2xx_GPIO_H #define __STM32F2xx_GPIO_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -394,7 +394,7 @@ void GPIO_ToggleBits(GPIO_TypeDef* GPIOx, uint16_t GPIO_Pin);
/* GPIO Alternate functions configuration function ****************************/ /* GPIO Alternate functions configuration function ****************************/
void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF); void GPIO_PinAFConfig(GPIO_TypeDef* GPIOx, uint16_t GPIO_PinSource, uint8_t GPIO_AF);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_I2C_H #ifndef __STM32F2xx_I2C_H
#define __STM32F2xx_I2C_H #define __STM32F2xx_I2C_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -681,7 +681,7 @@ void I2C_ClearFlag(I2C_TypeDef* I2Cx, uint32_t I2C_FLAG);
ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, uint32_t I2C_IT); ITStatus I2C_GetITStatus(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, uint32_t I2C_IT); void I2C_ClearITPendingBit(I2C_TypeDef* I2Cx, uint32_t I2C_IT);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_PWR_H #ifndef __STM32F2xx_PWR_H
#define __STM32F2xx_PWR_H #define __STM32F2xx_PWR_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -149,7 +149,7 @@ void PWR_EnterSTANDBYMode(void);
FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
void PWR_ClearFlag(uint32_t PWR_FLAG); void PWR_ClearFlag(uint32_t PWR_FLAG);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -29,7 +29,7 @@
#ifndef __STM32F2xx_RCC_H #ifndef __STM32F2xx_RCC_H
#define __STM32F2xx_RCC_H #define __STM32F2xx_RCC_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -498,7 +498,7 @@ void RCC_ClearFlag(void);
ITStatus RCC_GetITStatus(uint8_t RCC_IT); ITStatus RCC_GetITStatus(uint8_t RCC_IT);
void RCC_ClearITPendingBit(uint8_t RCC_IT); void RCC_ClearITPendingBit(uint8_t RCC_IT);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_RTC_H #ifndef __STM32F2xx_RTC_H
#define __STM32F2xx_RTC_H #define __STM32F2xx_RTC_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -633,7 +633,7 @@ void RTC_ClearFlag(uint32_t RTC_FLAG);
ITStatus RTC_GetITStatus(uint32_t RTC_IT); ITStatus RTC_GetITStatus(uint32_t RTC_IT);
void RTC_ClearITPendingBit(uint32_t RTC_IT); void RTC_ClearITPendingBit(uint32_t RTC_IT);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_SPI_H #ifndef __STM32F2xx_SPI_H
#define __STM32F2xx_SPI_H #define __STM32F2xx_SPI_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -509,7 +509,7 @@ void SPI_I2S_ClearFlag(SPI_TypeDef* SPIx, uint16_t SPI_I2S_FLAG);
ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); ITStatus SPI_I2S_GetITStatus(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT); void SPI_I2S_ClearITPendingBit(SPI_TypeDef* SPIx, uint8_t SPI_I2S_IT);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -30,7 +30,7 @@
#ifndef __STM32F2xx_USART_H #ifndef __STM32F2xx_USART_H
#define __STM32F2xx_USART_H #define __STM32F2xx_USART_H
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -412,7 +412,7 @@ void USART_ClearFlag(USART_TypeDef* USARTx, uint16_t USART_FLAG);
ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT); ITStatus USART_GetITStatus(USART_TypeDef* USARTx, uint16_t USART_IT);
void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT); void USART_ClearITPendingBit(USART_TypeDef* USARTx, uint16_t USART_IT);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -11,7 +11,7 @@
#ifndef _ASPI_H_ #ifndef _ASPI_H_
#define _ASPI_H_ #define _ASPI_H_
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -37,7 +37,7 @@ extern "C" {
void AspiCmd(u8 Command_Byte); void AspiCmd(u8 Command_Byte);
void AspiData(u8 Para_data); void AspiData(u8 Para_data);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -139,7 +139,7 @@ void audioEnd()
NVIC_DisableIRQ(DMA1_Stream5_IRQn) ; NVIC_DisableIRQ(DMA1_Stream5_IRQn) ;
} }
#ifndef SIMU #if !defined(SIMU)
extern "C" void TIM6_DAC_IRQHandler() extern "C" void TIM6_DAC_IRQHandler()
{ {
DAC->CR &= ~DAC_CR_DMAEN1 ; // Stop DMA requests DAC->CR &= ~DAC_CR_DMAEN1 ; // Stop DMA requests

View file

@ -36,11 +36,15 @@
#include "../../opentx.h" #include "../../opentx.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h" #include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h" #include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h" #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h"
#if defined(__cplusplus) && !defined(SIMU)
} }
#endif
volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define volatile uint32_t Tenms ; // TODO to remove everywhere / use a #define
@ -111,13 +115,13 @@ void interrupt5ms()
#endif #endif
} }
#if !defined(SIMU)
extern "C" void TIM8_TRG_COM_TIM14_IRQHandler() extern "C" void TIM8_TRG_COM_TIM14_IRQHandler()
{ {
TIM14->SR &= ~TIM_SR_UIF ; TIM14->SR &= ~TIM_SR_UIF ;
interrupt5ms() ; interrupt5ms() ;
} }
#if !defined(SIMU)
void boardInit() void boardInit()
{ {
pwrInit(); pwrInit();

View file

@ -39,7 +39,7 @@
#include "stddef.h" #include "stddef.h"
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -65,7 +65,7 @@ extern "C" {
#include "aspi.h" #include "aspi.h"
#include "i2c.h" #include "i2c.h"
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif
@ -197,7 +197,7 @@ extern volatile uint16_t Analog_values[];
#define BATT_SCALE 150 #define BATT_SCALE 150
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -234,7 +234,7 @@ void usbStart(void);
void usbStop(void); void usbStop(void);
#endif #endif
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -36,11 +36,15 @@
#include "../../opentx.h" #include "../../opentx.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h" #include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h"
#include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h" #include "STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h"
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h" #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/stm32f2xx_dbgmcu.h"
#if defined(__cplusplus) && !defined(SIMU)
} }
#endif
void configure_pins( uint32_t pins, uint16_t config ) void configure_pins( uint32_t pins, uint16_t config )
{ {

View file

@ -33,7 +33,7 @@
#define WP_H do{I2C_EE_WP_GPIO->BSRRL = I2C_EE_WP;}while(0) #define WP_H do{I2C_EE_WP_GPIO->BSRRL = I2C_EE_WP;}while(0)
#define WP_L do{I2C_EE_WP_GPIO->BSRRH = I2C_EE_WP;}while(0) #define WP_L do{I2C_EE_WP_GPIO->BSRRH = I2C_EE_WP;}while(0)
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif #endif
@ -48,7 +48,7 @@ void I2C_EE_WaitEepromStandbyState(void);
void I2C_set_volume(register uint8_t volume); void I2C_set_volume(register uint8_t volume);
uint8_t I2C_read_volume(void); uint8_t I2C_read_volume(void);
#ifdef __cplusplus #if defined(__cplusplus) && !defined(SIMU)
} }
#endif #endif

View file

@ -335,6 +335,7 @@ static void disable_pa10_ppm()
INTERNAL_RF_OFF(); INTERNAL_RF_OFF();
} }
#if !defined(SIMU)
extern "C" void TIM1_CC_IRQHandler() extern "C" void TIM1_CC_IRQHandler()
{ {
TIM1->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt TIM1->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
@ -372,8 +373,9 @@ extern "C" void TIM1_UP_TIM10_IRQHandler()
TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt TIM1->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
} }
} }
#endif
static void init_pa7_pxx() void init_pa7_pxx()
{ {
EXTERNAL_MODULE_ON(); EXTERNAL_MODULE_ON();
@ -584,6 +586,7 @@ static void disable_pa7_ppm()
} }
} }
#if !defined(SIMU)
extern "C" void TIM8_CC_IRQHandler() extern "C" void TIM8_CC_IRQHandler()
{ {
TIM8->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt TIM8->DIER &= ~TIM_DIER_CC2IE ; // stop this interrupt
@ -630,4 +633,4 @@ extern "C" void TIM8_UP_TIM13_IRQHandler()
TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt TIM8->DIER |= TIM_DIER_CC2IE ; // Enable this interrupt
} }
} }
#endif

View file

@ -34,7 +34,7 @@
* *
*/ */
#include "../opentx.h" #include "../../opentx.h"
void rotencInit() void rotencInit()
{ {

View file

@ -109,6 +109,7 @@ void stop_trainer_capture()
NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt NVIC_DisableIRQ(TIM3_IRQn) ; // Stop Interrupt
} }
#if !defined(SIMU)
extern "C" void TIM3_IRQHandler() extern "C" void TIM3_IRQHandler()
{ {
uint16_t capture = 0; uint16_t capture = 0;
@ -176,6 +177,7 @@ extern "C" void TIM3_IRQHandler()
} }
} }
} }
#endif
void init_cppm_on_heartbeat_capture(void) void init_cppm_on_heartbeat_capture(void)
{ {
@ -253,6 +255,7 @@ void stop_sbus_on_heartbeat_capture(void)
} }
} }
#if !defined(SIMU)
extern "C" void USART6_IRQHandler() extern "C" void USART6_IRQHandler()
{ {
uint32_t status; uint32_t status;
@ -269,3 +272,4 @@ extern "C" void USART6_IRQHandler()
status = USART6->SR; status = USART6->SR;
} }
} }
#endif

View file

@ -128,6 +128,7 @@ void uart3Stop()
USART_DeInit(USART3); USART_DeInit(USART3);
} }
#if !defined(SIMU)
extern "C" void USART3_IRQHandler(void) extern "C" void USART3_IRQHandler(void)
{ {
// Send // Send
@ -161,4 +162,5 @@ extern "C" void USART3_IRQHandler(void)
status = USART3->SR; status = USART3->SR;
} }
} }
#endif

View file

@ -30,7 +30,9 @@
#include "../../FatFs/diskio.h" #include "../../FatFs/diskio.h"
#include "board_taranis.h" #include "board_taranis.h"
#if defined(__cplusplus) && !defined(SIMU)
extern "C" { extern "C" {
#endif
#include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h" #include "STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc/misc.h"
#include "usbd_msc_mem.h" #include "usbd_msc_mem.h"
#include "usb_conf.h" #include "usb_conf.h"
@ -118,7 +120,10 @@ USBD_STORAGE_cb_TypeDef USBD_MICRO_SDIO_fops =
USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops; USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops = &USBD_MICRO_SDIO_fops;
__IO uint32_t count = 0; __IO uint32_t count = 0;
#if defined(__cplusplus) && !defined(SIMU)
} }
#endif
int8_t STORAGE_Init (uint8_t lun) int8_t STORAGE_Init (uint8_t lun)
{ {

View file

@ -427,7 +427,10 @@
#define LEN_VSWITCHES "\003" #define LEN_VSWITCHES "\003"
#define LEN_VSRCRAW "\004" #define LEN_VSRCRAW "\004"
#if defined(PCBTARANIS) #if defined(PCBTARANIS) && defined(REV9E)
#define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""S3\0 ""LS\0 ""RS\0 "
#define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 ""SI\0 ""SJ\0 ""SK\0 ""SL\0 ""SM\0 ""SN\0 ""SO\0 ""SP\0 ""SQ\0 ""SR\0 "
#elif defined(PCBTARANIS)
#define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""S3\0 ""LS\0 ""RS\0 " #define TR_POTS_VSRCRAW "S1\0 ""S2\0 ""S3\0 ""LS\0 ""RS\0 "
#define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 ""SI\0 ""SJ\0 ""SK\0 ""SL\0 ""SM\0 ""SN\0 " #define TR_SW_VSRCRAW "SA\0 ""SB\0 ""SC\0 ""SD\0 ""SE\0 ""SF\0 ""SG\0 ""SH\0 ""SI\0 ""SJ\0 ""SK\0 ""SL\0 ""SM\0 ""SN\0 "
#elif defined(EXTRA_3POS) #elif defined(EXTRA_3POS)