Update to stick position driver to use ADC system

This commit is contained in:
rob@marotori.com
2013-09-20 14:34:09 +00:00
parent bbb2b25ac8
commit c163e2513b
3 changed files with 40 additions and 29 deletions
-27
View File
@@ -2265,35 +2265,8 @@ BeepANACenter evalSticks(uint8_t mode)
v = -v;
#endif
#if defined(STICK_THR_REV)
v = -v;
if (g_model.throttleReversed && ch==THR_STICK)
v = +v;
#else
//normal stick operation but reveresed in model config
if (g_model.throttleReversed && ch==THR_STICK)
v = -v;
#endif
#if defined(STICK_AIL_REV)
if (ch==AIL_STICK)
v = -v;
#endif
#if defined(STICK_ELE_REV)
if (ch==ELE_STICK)
v = -v;
#endif
#if defined(STICK_RUD_REV)
if (ch==RUD_STICK)
v = -v;
#endif
/* end rob hack */
#if defined(EXTRA_3POS)
+13 -1
View File
@@ -36,7 +36,10 @@
#include "../opentx.h"
uint16_t Analog_values[NUMBER_ANALOG];
volatile uint16_t Analog_values[NUMBER_ANALOG];
const char ana_direction[NUMBER_ANALOG] = {'STICK_AIL_DIR', 'STICK_RUD_DIR', 0, 'STICK_ELE_DIR' ,0 , 'STICK_THR_DIR',0};
// Settings for mode register ADC_MR
// USEQ off - silicon problem, doesn't work
@@ -111,4 +114,13 @@ void adcRead()
if (get_tmr10ms() >= 100 && temperature > maxTemperature) {
maxTemperature = temperature;
}
// adc direction correct
uint32_t i ;
for (i=0; i<NUMBER_ANALOG; i++) {
if (ana_direction[i]) {
Analog_values[i] = 4096-Analog_values[i];
}
}
}
+27 -1
View File
@@ -174,6 +174,32 @@ void disable_ssc();
#define init_dsm2(port) init_main_ppm(5000, 0); init_ssc()
#define disable_dsm2(port) disable_ssc()
// Stick Directions
#if defined(STICK_AIL_REV)
#define STICK_AIL_DIR = 1;
#else
#define STICK_AIL_DIR = 0;
#endif
#if defined(STICK_ELE_REV)
#define STICK_ELE_DIR = 1;
#else
#define STICK_ELE_DIR = 0;
#endif
#if defined(STICK_RUD_REV)
#define STICK_RUD_DIR = 1;
#else
#define STICK_RUD_DIR = 0;
#endif
#if defined(STICK_THR_REV)
#define STICK_THR_DIR = 1;
#else
#define STICK_THR_DIR = 0;
#endif
// SD driver
#if defined(SIMU)
#define sdInit()
@@ -206,7 +232,7 @@ void disable_ssc();
// ADC driver
void adcInit();
void adcRead(void);
extern uint16_t Analog_values[];
//extern uint16_t Analog_values[];
// Buzzer driver
void buzzerSound(uint8_t duration);