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

Bsongis/frsky xlite (#5574)

FrSky X-Lite support added
This commit is contained in:
Bertrand Songis 2018-01-02 14:36:48 +01:00 committed by GitHub
parent 269831e0c4
commit c4001c8507
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
85 changed files with 1555 additions and 976 deletions

View file

@ -26,22 +26,22 @@
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, 1,-1, 1, 1,1};
#elif defined(PCBX9E)
#if defined(HORUS_STICKS)
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,1,1, -1};
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,-1,1, -1,1,-1,-1, -1};
#else
const int8_t ana_direction[NUM_ANALOGS] = {1,1,-1,-1, -1,-1,-1,1, -1,1,1,1, -1};
const int8_t ana_direction[NUM_ANALOGS] = {1,1,-1,-1, -1,-1,-1,1, -1,1,-1,-1, -1};
#endif
const uint8_t ana_mapping[NUM_ANALOGS] = { 0 /*STICK1*/, 1 /*STICK2*/, 2 /*STICK3*/, 3 /*STICK4*/,
10 /*POT1*/, 4 /*POT2*/, 5 /*POT3*/, 6 /*POT4*/,
11 /*SLIDER1*/, 12 /*SLIDER2*/, 7 /*SLIDER3*/, 8 /*SLIDER4*/,
9 /*TX_VOLTAGE*/ };
#elif defined(PCBX9DP)
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,1,-1, -1,1, 1};
#elif defined(PCBX7)
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, 1,1,-1, 1,1, 1};
#elif defined(PCBX7) || defined(PCBXLITE)
const int8_t ana_direction[NUM_ANALOGS] = {-1,1,-1,1, 1,1, 1};
#elif defined(REV4a)
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,-1,0, -1,1, 1};
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, 1,-1,0, 1,1, 1};
#else
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, -1,1,0, -1,1, 1};
const int8_t ana_direction[NUM_ANALOGS] = {1,-1,1,-1, 1,1,0, 1,1, 1};
#endif
#if NUM_PWMANALOGS > 0
@ -102,6 +102,9 @@ void adcInit()
#elif defined(PCBX9E)
ADC_MAIN->SQR2 = (ADC_CHANNEL_POT4<<0) + (ADC_CHANNEL_SLIDER3<<5) + (ADC_CHANNEL_SLIDER4<<10) + (ADC_CHANNEL_BATT<<15); // conversions 7 and more
ADC_MAIN->SQR3 = (ADC_CHANNEL_STICK_LH<<0) + (ADC_CHANNEL_STICK_LV<<5) + (ADC_CHANNEL_STICK_RV<<10) + (ADC_CHANNEL_STICK_RH<<15) + (ADC_CHANNEL_POT2<<20) + (ADC_CHANNEL_POT3<<25); // conversions 1 to 6
#elif defined(PCBXLITE)
ADC_MAIN->SQR2 = (ADC_CHANNEL_BATT<<0); // conversions 7 and more
ADC_MAIN->SQR3 = (ADC_CHANNEL_STICK_LH<<0) + (ADC_CHANNEL_STICK_LV<<5) + (ADC_CHANNEL_STICK_RV<<10) + (ADC_CHANNEL_STICK_RH<<15) + (ADC_CHANNEL_POT1<<25) + (ADC_CHANNEL_POT2<<20); // conversions 1 to 6
#elif defined(PCBX7)
ADC_MAIN->SQR2 = (ADC_CHANNEL_BATT<<0); // conversions 7 and more
ADC_MAIN->SQR3 = (ADC_CHANNEL_STICK_LH<<0) + (ADC_CHANNEL_STICK_LV<<5) + (ADC_CHANNEL_STICK_RV<<10) + (ADC_CHANNEL_STICK_RH<<15) + (ADC_CHANNEL_POT1<<25) + (ADC_CHANNEL_POT2<<20); // conversions 1 to 6