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:
Michał Wróbel
2015-04-25 14:25:34 +02:00
parent 41f78440db
commit 485edb579d
11 changed files with 351 additions and 196 deletions
+13 -5
View File
@@ -415,7 +415,7 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
INCDIRS += targets/stock
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM64 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
EXTRABOARDSRC = targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/common_avr/telemetry_driver.cpp
ifeq ($(GUI), YES)
EXTRABOARDSRC += targets/stock/lcd_driver.cpp
endif
@@ -437,6 +437,10 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
CPPDEFS += -DTELEMETRY_MOD_14051
endif
ifeq ($(TELEMETRY_MOD), 14051_SWAPPED)
CPPDEFS += -DTELEMETRY_MOD_14051_SWAPPED
endif
ifeq ($(AUDIO), YES)
CPPDEFS += -DAUDIO
CPPSRC += audio_avr.cpp
@@ -488,7 +492,7 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
INCDIRS += targets/stock
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
EXTRABOARDSRC = targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
@@ -507,6 +511,10 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
CPPDEFS += -DTELEMETRY_MOD_14051
endif
ifeq ($(TELEMETRY_MOD), 14051_SWAPPED)
CPPDEFS += -DTELEMETRY_MOD_14051_SWAPPED
endif
ifeq ($(AUDIO), YES)
CPPDEFS += -DAUDIO
CPPSRC += audio_avr.cpp
@@ -554,7 +562,7 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM2561 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
INCDIRS += targets/stock
BOARDSRC = main_avr.cpp targets/stock/board_stock.cpp
EXTRABOARDSRC = targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += debug.cpp
@@ -622,7 +630,7 @@ ifeq ($(PCB), GRUVIN9X)
THR_TRACE = YES
INCDIRS += targets/gruvin9x targets/stock $(FATFSDIR) $(FATFSDIR)/option
BOARDSRC = main_avr.cpp targets/gruvin9x/board_gruvin9x.cpp
EXTRABOARDSRC = targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
PULSESSRC = pulses/pulses_avr.cpp
CPPSRC += audio_avr.cpp haptic.cpp debug.cpp
@@ -680,7 +688,7 @@ ifeq ($(PCB), MEGA2560)
ifeq ($(LCD), ST7565R)
CPPDEFS += -DLCD_ST7565R
endif
EXTRABOARDSRC = targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
EXTRABOARDSRC = targets/common_avr/adc_driver.cpp targets/stock/lcd_driver.cpp targets/common_avr/telemetry_driver.cpp
ifeq ($(SDCARD), YES)
EXTRABOARDSRC += $(FATFSDIR)/ff.c $(FATFSDIR)/fattime.c $(FATFSDIR)/option/ccsbcs.c targets/gruvin9x/diskio.cpp