TELEMETRY_MOD=14051_SWAPPED
TELEMETRY_MOD=14051 (by gerardv @ forum.turnigy9xr.com) makes USART0 available by reallocating AIL and THR onto pins 14 and 15 of the 14051 multiplexer. TELEMETRY_MOD=14051_SWAPPED is based on TELEMETRY_MOD=14051, but uses USART1 instead of USART0, freeing USART0 for other purposes (debugging, interfacing via AVRISP port). USART1 is freed up by reallocating LVert Trim Dn/Up onto 14051's 12 and 1 pins respectively. Additionally, this commit cleans a few things up: * moves AVR ADC-related code to adc_driver.cpp, * provides #defines to have a convenient way to access either USART0 or USART1 registers depending on static (build-time) configuration * moves code related to this telemetry mod to board_stock * replaces a few magic numbers with enums. Thanks to Bernard Songis for review and suggestions!
This commit is contained in:
+13
-2
@@ -941,8 +941,6 @@ void checkSwitches();
|
||||
void checkAlarm();
|
||||
void checkAll();
|
||||
|
||||
#define ADC_VREF_TYPE 0x40 // AVCC with external capacitor at AREF pin
|
||||
|
||||
#if !defined(SIMU)
|
||||
void getADC();
|
||||
#endif
|
||||
@@ -979,6 +977,15 @@ enum Analogs {
|
||||
POT2,
|
||||
POT3,
|
||||
POT_LAST = POT3,
|
||||
#endif
|
||||
#if defined(TELEMETRY_MOD_14051) || defined(TELEMETRY_MOD_14051_SWAPPED)
|
||||
// When the mod is applied, ADC7 is connected to 14051's X pin and TX_VOLTAGE
|
||||
// is connected to 14051's X0 pin (one of the multiplexed inputs). TX_VOLTAGE
|
||||
// value is filled in by processMultiplexAna().
|
||||
|
||||
// This shifts TX_VOLTAGE from 7 to 8 and makes X14051 take the 7th position
|
||||
// corresponding to ADC7.
|
||||
X14051,
|
||||
#endif
|
||||
TX_VOLTAGE,
|
||||
#if defined(PCBSKY9X) && !defined(REVA)
|
||||
@@ -1727,4 +1734,8 @@ struct Clipboard {
|
||||
extern Clipboard clipboard;
|
||||
#endif
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern uint16_t s_anaFilt[NUMBER_ANALOG];
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user