/* * Author - Bertrand Songis * * 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 "firmwares/th9x/th9xsimulator.h" #include "firmwares/th9x/th9xinterface.h" #define SIM #define SIMU #define SIMU_EXCEPTIONS #undef min #undef max #define NUM_POTS 3 #define NUM_CSW 12 #define SWSRC_SW1 10 #include #include namespace Th9x { #include "simpgmspace.h" #include "th9x.cpp" #include "stamp.cpp" #include "menus.cpp" #include "pers.cpp" #include "file.cpp" #include "lcd.cpp" #include "drivers.cpp" #include "foldedlist.cpp" #include "simpgmspace.cpp" #include "pulses.cpp" int16_t g_anas[7]; char g_title[80] = ""; uint16_t anaIn(uint8_t chan) { if (chan == 7) return 750; else return 512 + g_anas[chan]; } bool hasExtendedTrims() { return false; } void setTrim(uint8_t idx, int8_t value) { g_model.trimData[idx].itrim = trimRevertM(value, g_model.trimData[idx].tmode); } void getTrims(int16_t values[4]) { for (int i=0; i<4; i++) { values[i] = trimVal(i); } } void eeprom_RESV_mismatch(void) { assert(!"Should never been called. Only needed by VC++ (debug mode)"); } #define GPIO_TRIM_LH_L pind #define GPIO_TRIM_LV_DN pind #define GPIO_TRIM_RV_UP pind #define GPIO_TRIM_RH_L pind #define GPIO_TRIM_LH_R pind #define GPIO_TRIM_LV_UP pind #define GPIO_TRIM_RV_DN pind #define GPIO_TRIM_RH_R pind #define PIN_TRIM_LH_L (1<= 0) pin1 &= ~(mask1); else pin1 |= (mask1); \ if (state <= 0) pin2 &= ~(mask2); else pin2 |= (mask2); \ break; void simuSetSwitch(uint8_t swtch, int8_t state) { switch (swtch) { SWITCH_CASE(0, pine, 1<save(&eeprom[0], radioData); StartMainThread(tests); } void Th9xSimulator::stop() { StopMainThread(); } void Th9xSimulator::getValues(TxOutputs &outputs) { #define GETVALUES_IMPORT #include "simulatorimport.h" for (int i=0; i<8; i++) outputs.chans[i] *= 2; } void Th9xSimulator::setValues(TxInputs &_inputs) { TxInputs inputs = _inputs; for (int i=0; i<4; i++) inputs.sticks[i] /= 2; for (int i=0; i<3; i++) inputs.pots[i] /= 2; #define SETVALUES_IMPORT #include "simulatorimport.h" } void Th9xSimulator::setTrim(unsigned int idx, int value) { Th9x::setTrim(idx, value); } void Th9xSimulator::getTrims(Trims & trims) { trims.extended = false; Th9x::getTrims(trims.values); } const char * Th9xSimulator::getError() { #define GETERROR_IMPORT #include "simulatorimport.h" }