Files movement.
Issue 26 fixed (JETI)
This commit is contained in:
+124
-150
@@ -170,6 +170,10 @@ PXX = NO
|
||||
# Values = NO, SERIAL, PPM
|
||||
DSM2 = NO
|
||||
|
||||
# HUBSAN protocol
|
||||
# Values = NO, YES
|
||||
HUBSAN = NO
|
||||
|
||||
# DSM/PPM TX caddy PCB (Gruvin)
|
||||
# For auto-switching switching between DSM2/X and Fr-Sky transmitter modules
|
||||
# Values = YES, NO
|
||||
@@ -252,12 +256,12 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
XCURVES = NO
|
||||
SDCARD = NO
|
||||
THR_TRACE = NO
|
||||
EXTRAINCDIRS = stock
|
||||
EXTRAINCDIRS = targets/stock
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM64 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
BOARDSRC = targets/stock/board_stock.cpp
|
||||
EXTRABOARDSRC = targets/stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
PULSESSRC = protocols/pulses_avr.cpp
|
||||
|
||||
ifeq ($(PCB), 9XR)
|
||||
CPPDEFS += -DPCB9XR
|
||||
@@ -275,7 +279,7 @@ ifeq ($(PCB), $(filter $(PCB), STD 9X 9XR))
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
CPPSRC += stock/voice.cpp
|
||||
CPPSRC += targets/stock/voice.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
@@ -308,11 +312,11 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
THR_TRACE = NO
|
||||
EEPROM_VARIANT += ${M128_VARIANT}
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM128 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
EXTRAINCDIRS = stock
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
EXTRAINCDIRS = targets/stock
|
||||
BOARDSRC = targets/stock/board_stock.cpp
|
||||
EXTRABOARDSRC = targets/stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
PULSESSRC = protocols/pulses_avr.cpp
|
||||
|
||||
ifeq ($(PCB), 9XR128)
|
||||
CPPDEFS += -DPCB9XR128
|
||||
@@ -330,7 +334,7 @@ ifeq ($(PCB), $(filter $(PCB), STD128 9X128 9XR128))
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
CPPSRC += stock/voice.cpp
|
||||
CPPSRC += targets/stock/voice.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
@@ -363,11 +367,11 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
|
||||
THR_TRACE = YES
|
||||
EEPROM_VARIANT += ${M2561_VARIANT}
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBSTD -DCPUM2561 -DEEPROM_VARIANT=$(shell echo ${EEPROM_VARIANT} | bc)
|
||||
EXTRAINCDIRS = stock
|
||||
BOARDSRC = stock/board_stock.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
EXTRAINCDIRS = targets/stock
|
||||
BOARDSRC = targets/stock/board_stock.cpp
|
||||
EXTRABOARDSRC = targets/stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
PULSESSRC = protocols/pulses_avr.cpp
|
||||
|
||||
ifeq ($(PCB), 9XR2561)
|
||||
CPPDEFS += -DPCB9XR2561
|
||||
@@ -385,7 +389,7 @@ ifeq ($(PCB), $(filter $(PCB), 9X2561))
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
CPPSRC += stock/voice.cpp
|
||||
CPPSRC += targets/stock/voice.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(PWM_BACKLIGHT), YES)
|
||||
@@ -423,17 +427,17 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
SDCARD = NO
|
||||
BUZZER = NO
|
||||
THR_TRACE = YES
|
||||
EXTRAINCDIRS = gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC = gruvin9x/board_gruvin9x.cpp
|
||||
EXTRABOARDSRC = stock/lcd_driver.cpp
|
||||
EXTRAINCDIRS = targets/gruvin9x targets/stock FatFs FatFs/option
|
||||
BOARDSRC = targets/gruvin9x/board_gruvin9x.cpp
|
||||
EXTRABOARDSRC = targets/stock/lcd_driver.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
PULSESSRC = protocols/pulses_avr.cpp
|
||||
CPPSRC += audio_avr.cpp haptic.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp gruvin9x/rtc_driver.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c gruvin9x/diskio.cpp
|
||||
CPPSRC += rtc.cpp targets/gruvin9x/rtc_driver.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/gruvin9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
@@ -443,7 +447,7 @@ ifeq ($(PCB), GRUVIN9X)
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
CPPSRC += gruvin9x/somo14d.cpp
|
||||
CPPSRC += targets/gruvin9x/somo14d.cpp
|
||||
endif
|
||||
|
||||
# Enable extra rotary encoders (Gruvin9x board only)
|
||||
@@ -461,21 +465,21 @@ ifeq ($(PCB), MEGA2560)
|
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL -DPCBGRUVIN9X -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC
|
||||
SDCARD = NO
|
||||
THR_TRACE = YES
|
||||
EXTRAINCDIRS = gruvin9x stock FatFs FatFs/option
|
||||
BOARDSRC = mega2560/board_mega2560.cpp
|
||||
EXTRABOARDSRC = mega2560/lcd_driver_ST7565R.cpp
|
||||
EXTRAINCDIRS = targets/gruvin9x targets/stock FatFs FatFs/option
|
||||
BOARDSRC = targets/mega2560/board_mega2560.cpp
|
||||
EXTRABOARDSRC = targets/mega2560/lcd_driver_ST7565R.cpp
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp
|
||||
PULSESSRC = pulses_avr.cpp
|
||||
PULSESSRC = protocols/pulses_avr.cpp
|
||||
CPPSRC += audio_avr.cpp haptic.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp gruvin9x/rtc_driver.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c gruvin9x/diskio.cpp
|
||||
CPPSRC += rtc.cpp targets/gruvin9x/rtc_driver.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/gruvin9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(VOICE), YES)
|
||||
CPPSRC += gruvin9x/somo14d.cpp
|
||||
CPPSRC += targets/gruvin9x/somo14d.cpp
|
||||
CPPDEFS += -DVOICE
|
||||
endif
|
||||
|
||||
@@ -491,13 +495,13 @@ ifeq ($(PCB), SKY9X)
|
||||
CPPDEFS = -Dat91sam3s4
|
||||
ifeq ($(PCBREV), REVA)
|
||||
CPPDEFS += -DREVA
|
||||
LDSCRIPT = sky9x/sam3s2c_flash.ld
|
||||
LDSCRIPT = targets/sky9x/sam3s2c_flash.ld
|
||||
else ifeq ($(PCBREV), REVB)
|
||||
CPPDEFS += -DREVB
|
||||
LDSCRIPT = sky9x/sam3s4c_flash.ld
|
||||
LDSCRIPT = targets/sky9x/sam3s4c_flash.ld
|
||||
else
|
||||
CPPDEFS += -DREVC
|
||||
LDSCRIPT = sky9x/sam3s4c_flash.ld
|
||||
LDSCRIPT = targets/sky9x/sam3s4c_flash.ld
|
||||
endif
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m3
|
||||
@@ -506,24 +510,24 @@ ifeq ($(PCB), SKY9X)
|
||||
BUZZER = NO
|
||||
THR_TRACE = YES
|
||||
CPPDEFS += -DPCBSKY9X -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DHAPTIC -DPXX -DDSM2 -DDSM2_PPM -DROTARY_ENCODERS=1
|
||||
EXTRAINCDIRS = sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = sky9x/board_sky9x.cpp
|
||||
EXTRABOARDSRC = sky9x/lcd_driver.cpp
|
||||
SRC += sky9x/core_cm3.c sky9x/board_lowlevel.c sky9x/crt.c sky9x/vectors_sam3s.c
|
||||
EXTRAINCDIRS = targets/sky9x CoOS/kernel CoOS/portable
|
||||
BOARDSRC = targets/sky9x/board_sky9x.cpp
|
||||
EXTRABOARDSRC = targets/sky9x/lcd_driver.cpp
|
||||
SRC += targets/sky9x/core_cm3.c targets/sky9x/board_lowlevel.c targets/sky9x/crt.c targets/sky9x/vectors_sam3s.c
|
||||
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
|
||||
SRC += sky9x/usb/device/core/USBD_UDP.c sky9x/usb/device/core/USBDDriver.c
|
||||
SRC += sky9x/usb/device/massstorage/MSDDriver.c sky9x/usb/device/massstorage/MSDDStateMachine.c sky9x/usb/device/massstorage/MSDLun.c sky9x/usb/device/massstorage/MSDDriverDescriptors.c sky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += sky9x/usb/common/core/USBEndpointDescriptor.c sky9x/usb/common/core/USBGenericRequest.c sky9x/usb/common/core/USBFeatureRequest.c sky9x/usb/common/core/USBInterfaceRequest.c sky9x/usb/common/core/USBGetDescriptorRequest.c sky9x/usb/common/core/USBSetAddressRequest.c sky9x/usb/common/core/USBSetConfigurationRequest.c sky9x/usb/common/core/USBConfigurationDescriptor.c sky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += sky9x/MEDSdcard.c
|
||||
SRC += targets/sky9x/usb/device/core/USBD_UDP.c targets/sky9x/usb/device/core/USBDDriver.c
|
||||
SRC += targets/sky9x/usb/device/massstorage/MSDDriver.c targets/sky9x/usb/device/massstorage/MSDDStateMachine.c targets/sky9x/usb/device/massstorage/MSDLun.c targets/sky9x/usb/device/massstorage/MSDDriverDescriptors.c targets/sky9x/usb/device/massstorage/SBCMethods.c
|
||||
SRC += targets/sky9x/usb/common/core/USBEndpointDescriptor.c targets/sky9x/usb/common/core/USBGenericRequest.c targets/sky9x/usb/common/core/USBFeatureRequest.c targets/sky9x/usb/common/core/USBInterfaceRequest.c targets/sky9x/usb/common/core/USBGetDescriptorRequest.c targets/sky9x/usb/common/core/USBSetAddressRequest.c targets/sky9x/usb/common/core/USBSetConfigurationRequest.c targets/sky9x/usb/common/core/USBConfigurationDescriptor.c targets/sky9x/usb/common/core/USBGenericDescriptor.c
|
||||
SRC += targets/sky9x/MEDSdcard.c
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_raw.cpp eeprom_conversions.cpp
|
||||
PULSESSRC = pulses_arm.cpp
|
||||
PULSESSRC = protocols/pulses_arm.cpp protocols/ppm_arm.cpp protocols/pxx_arm.cpp protocols/dsm2_arm.cpp
|
||||
CPPSRC += audio_arm.cpp haptic.cpp
|
||||
CPPSRC += sky9x/pwr_driver.cpp sky9x/adc_driver.cpp sky9x/coproc_driver.cpp sky9x/rotenc_driver.cpp sky9x/eeprom_driver.cpp sky9x/pulses_driver.cpp sky9x/keys_driver.cpp sky9x/audio_driver.cpp sky9x/buzzer_driver.cpp sky9x/haptic_driver.cpp sky9x/sdcard_driver.cpp sky9x/massstorage.cpp
|
||||
CPPSRC += targets/sky9x/pwr_driver.cpp targets/sky9x/adc_driver.cpp targets/sky9x/coproc_driver.cpp targets/sky9x/rotenc_driver.cpp targets/sky9x/eeprom_driver.cpp targets/sky9x/pulses_driver.cpp targets/sky9x/keys_driver.cpp targets/sky9x/audio_driver.cpp targets/sky9x/buzzer_driver.cpp targets/sky9x/haptic_driver.cpp targets/sky9x/sdcard_driver.cpp targets/sky9x/massstorage.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
CPPDEFS += -DVOICE
|
||||
EXTRAINCDIRS += FatFs FatFs/option
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c sky9x/diskio.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/sky9x/diskio.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BUZZER), YES)
|
||||
@@ -533,18 +537,18 @@ ifeq ($(PCB), SKY9X)
|
||||
|
||||
ifeq ($(RTCLOCK), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp sky9x/rtc_driver.cpp
|
||||
CPPSRC += rtc.cpp targets/sky9x/rtc_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(BLUETOOTH), YES)
|
||||
CPPDEFS += -DBLUETOOTH
|
||||
CPPSRC += sky9x/bluetooth.cpp
|
||||
CPPSRC += targets/sky9x/bluetooth.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += debug.cpp
|
||||
CPPSRC += sky9x/debug_driver.cpp
|
||||
SRC += sky9x/syscalls.c
|
||||
CPPSRC += targets/sky9x/debug_driver.cpp
|
||||
SRC += targets/sky9x/syscalls.c
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -556,7 +560,7 @@ ifeq ($(PCB), TARANIS)
|
||||
else
|
||||
CPPDEFS = -DREV4
|
||||
endif
|
||||
LDSCRIPT = taranis/stm32_flash.ld
|
||||
LDSCRIPT = targets/taranis/stm32_flash.ld
|
||||
TRGT = arm-none-eabi-
|
||||
MCU = cortex-m3
|
||||
OPT = 2
|
||||
@@ -565,57 +569,63 @@ ifeq ($(PCB), TARANIS)
|
||||
THR_TRACE = YES
|
||||
EXT = FRSKY
|
||||
CPPDEFS += -DPCBTARANIS -DCPUARM -DEEPROM_VARIANT=0 -DAUDIO -DPXX
|
||||
EXTRAINCDIRS = taranis CoOS/kernel CoOS/portable
|
||||
EXTRAINCDIRS += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/include
|
||||
EXTRAINCDIRS += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc
|
||||
EXTRAINCDIRS += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc
|
||||
BOARDSRC = taranis/board_taranis.cpp
|
||||
EXTRABOARDSRC += taranis/lcd_driver.cpp taranis/aspi.cpp taranis/i2c.c
|
||||
EXTRAINCDIRS = targets/taranis CoOS/kernel CoOS/portable
|
||||
EXTRAINCDIRS += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/inc targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Include targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/include
|
||||
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/inc
|
||||
EXTRAINCDIRS += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/inc targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/inc
|
||||
BOARDSRC = targets/taranis/board_taranis.cpp
|
||||
EXTRABOARDSRC += targets/taranis/lcd_driver.cpp targets/taranis/aspi.cpp targets/taranis/i2c.c
|
||||
SRC += CoOS/kernel/core.c CoOS/kernel/hook.c CoOS/kernel/task.c CoOS/kernel/event.c CoOS/kernel/time.c CoOS/kernel/timer.c CoOS/kernel/flag.c CoOS/kernel/mutex.c CoOS/kernel/serviceReq.c CoOS/portable/GCC/port.c CoOS/portable/arch.c
|
||||
EEPROMSRC = eeprom_common.cpp eeprom_rlc.cpp # TODO later eeprom_conversions.cpp
|
||||
PULSESSRC = pulses_arm.cpp
|
||||
PULSESSRC = protocols/pulses_arm.cpp protocols/ppm_arm.cpp protocols/pxx_arm.cpp
|
||||
CPPSRC += audio_arm.cpp
|
||||
CPPSRC += taranis/pwr_driver.cpp taranis/pulses_driver.cpp taranis/keys_driver.cpp taranis/adc_driver.cpp taranis/trainer_driver.cpp taranis/audio_driver.cpp taranis/delays.cpp taranis/uart_driver.cpp taranis/sport_driver.cpp
|
||||
CPPSRC += bmp.cpp view_channels.cpp
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rcc.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_spi.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_dma.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rtc.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c
|
||||
SRC += taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
|
||||
SRC += taranis/usb_bsp.c taranis/usbd_desc.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
|
||||
SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
|
||||
# SRC += taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/src/usbd_hid_core.c
|
||||
EXTRABOARDSRC += taranis/usbd_usr.cpp taranis/usbd_storage_msd.cpp
|
||||
CPPSRC += targets/taranis/pwr_driver.cpp targets/taranis/pulses_driver.cpp targets/taranis/keys_driver.cpp targets/taranis/adc_driver.cpp targets/taranis/trainer_driver.cpp targets/taranis/audio_driver.cpp targets/taranis/delays.cpp targets/taranis/uart_driver.cpp targets/taranis/sport_driver.cpp
|
||||
CPPSRC += bmp.cpp gui/view_channels.cpp
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/system_stm32f2xx.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/misc.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_gpio.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rcc.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_spi.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_dma.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_rtc.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_pwr.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/STM32F2xx_StdPeriph_Driver/src/stm32f2xx_usart.c
|
||||
SRC += targets/taranis/STM32F2xx_StdPeriph_Lib_V1.1.0/Libraries/CMSIS/Device/ST/STM32F2xx/Source/Templates/gcc_ride7/startup_stm32f2xx.s
|
||||
SRC += targets/taranis/usb_bsp.c targets/taranis/usbd_desc.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_core.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_OTG_Driver/src/usb_dcd_int.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_core.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Core/src/usbd_req.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_data.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_bot.c
|
||||
SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/msc/src/usbd_msc_core.c
|
||||
# SRC += targets/taranis/STM32_USB-Host-Device_Lib_V2.1.0/Libraries/STM32_USB_Device_Library/Class/hid/src/usbd_hid_core.c
|
||||
EXTRABOARDSRC += targets/taranis/usbd_usr.cpp targets/taranis/usbd_storage_msd.cpp
|
||||
|
||||
ifeq ($(SDCARD), YES)
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c taranis/diskio.cpp
|
||||
EXTRABOARDSRC += FatFs/ff.c FatFs/fattime.c FatFs/option/ccsbcs.c targets/taranis/diskio.cpp
|
||||
CPPDEFS += -DVOICE
|
||||
EXTRAINCDIRS += FatFs FatFs/option
|
||||
endif
|
||||
|
||||
ifeq ($(RTCLOCK), YES)
|
||||
CPPDEFS += -DRTCLOCK
|
||||
CPPSRC += rtc.cpp taranis/rtc_driver.cpp
|
||||
CPPSRC += rtc.cpp targets/taranis/rtc_driver.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(DEBUG), YES)
|
||||
CPPSRC += debug.cpp
|
||||
SRC += sky9x/syscalls.c
|
||||
endif
|
||||
SRC += targets/sky9x/syscalls.c
|
||||
endif
|
||||
|
||||
ifeq ($(HUBSAN), YES)
|
||||
CPPDEFS += -DHUBSAN
|
||||
CPPSRC += protocols/hubsan.cpp
|
||||
# SRC += targets/sky9x/syscalls.c
|
||||
endif
|
||||
endif
|
||||
|
||||
CC = $(TRGT)gcc
|
||||
@@ -643,7 +653,7 @@ TARGET = opentx
|
||||
STD_TTS_SRC = translations/tts_$(shell sh -c "echo $(TTS) | tr '[:upper:]' '[:lower:]'").cpp
|
||||
TTS_SRC = $(shell sh -c "if test -f $(STD_TTS_SRC); then echo $(STD_TTS_SRC); else echo translations/tts_en.cpp; fi")
|
||||
|
||||
CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp menus.cpp menu_model.cpp menu_general.cpp view_main.cpp view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp $(TTS_SRC)
|
||||
CPPSRC += opentx.cpp $(PULSESSRC) stamp.cpp gui/menus.cpp gui/menu_model.cpp gui/menu_general.cpp gui/view_main.cpp gui/view_statistics.cpp $(EEPROMSRC) lcd.cpp keys.cpp maths.cpp translations.cpp $(TTS_SRC)
|
||||
|
||||
# Debugging format.
|
||||
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
|
||||
@@ -762,22 +772,22 @@ endif
|
||||
|
||||
ifeq ($(EXT), ARDUPILOT)
|
||||
CPPDEFS += -DARDUPILOT
|
||||
CPPSRC += telemetry_ardupilot.cpp
|
||||
CPPSRC += telemetry/ardupilot.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), NMEA)
|
||||
CPPDEFS += -DNMEA
|
||||
CPPSRC += telemetry_nmea.cpp
|
||||
CPPSRC += telemetry/nmea.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), JETI)
|
||||
CPPDEFS += -DJETI
|
||||
CPPSRC += telemetry_jeti.cpp
|
||||
CPPSRC += telemetry/jeti.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), MAVLINK)
|
||||
CPPDEFS += -DMAVLINK
|
||||
CPPSRC += telemetry_mavlink.cpp rotarysw.cpp serial.cpp
|
||||
CPPSRC += telemetry/mavlink.cpp rotarysw.cpp serial.cpp
|
||||
endif
|
||||
|
||||
ifeq ($(EXT), TELEMETREZ)
|
||||
@@ -787,17 +797,17 @@ endif
|
||||
ifeq ($(EXT), $(filter $(EXT), FRSKY TELEMETREZ))
|
||||
CPPDEFS += -DFRSKY
|
||||
ifeq ($(PCB), TARANIS)
|
||||
TELEMETRY_PROTO = $(shell sh -c "if test -f telemetry_sport.cpp; then echo SPORT; else echo FRSKY; fi")
|
||||
TELEMETRY_PROTO = $(shell sh -c "if test -f telemetry/frsky_sport.cpp; then echo SPORT; else echo FRSKY; fi")
|
||||
ifeq ($(TELEMETRY_PROTO), SPORT)
|
||||
CPPSRC += telemetry_sport.cpp
|
||||
CPPSRC += telemetry/frsky_sport.cpp
|
||||
CPPDEFS += -DFRSKY_SPORT
|
||||
else
|
||||
CPPSRC += telemetry_frsky.cpp
|
||||
CPPSRC += telemetry/frsky.cpp
|
||||
endif
|
||||
else
|
||||
CPPSRC += telemetry_frsky.cpp
|
||||
CPPSRC += telemetry/frsky.cpp
|
||||
endif
|
||||
CPPSRC += view_telemetry.cpp
|
||||
CPPSRC += gui/view_telemetry.cpp
|
||||
# If FRSKY-Hub is enabled
|
||||
ifeq ($(FRSKY_HUB), YES)
|
||||
CPPDEFS += -DFRSKY_HUB
|
||||
@@ -977,6 +987,8 @@ else
|
||||
build: stamp_header lbm allsrc.cpp elf remallsrc bin lss
|
||||
endif
|
||||
|
||||
lbm: bitmaps/font.lbm bitmaps/sticks.lbm
|
||||
|
||||
elf: $(TARGET).elf
|
||||
bin: $(TARGET).bin
|
||||
hex: $(TARGET).hex
|
||||
@@ -984,8 +996,6 @@ eep: $(TARGET).eep
|
||||
lss: $(TARGET).lss
|
||||
sym: $(TARGET).sym
|
||||
|
||||
lbm: font.lbm font_tiny.lbm font_small.lbm font_midsize.lbm font_dblsize.lbm sticks.lbm splash_9x.lbm splash_taranis.lbm logo_taranis.lbm icons.lbm asterisk.lbm
|
||||
|
||||
# Build stamp-file
|
||||
stamp_header:
|
||||
@echo
|
||||
@@ -1026,73 +1036,37 @@ arm-stamp:
|
||||
@echo "#define SVN_VERS \"opentx-r$(SVNREV)\"" >> stamp-opentx-arm.txt
|
||||
@cat stamp-opentx-arm.txt
|
||||
|
||||
font.lbm: font.xbm font_extra.xbm translations/font_se.xbm translations/font_de.xbm translations/font_it.xbm translations/font_cz.xbm translations/font_fr.xbm translations/font_es.xbm
|
||||
bitmaps/font.lbm: bitmaps/font.xbm bitmaps/font_extra.xbm bitmaps/font_tiny.xbm bitmaps/font_small.xbm bitmaps/font_midsize.xbm bitmaps/font_dblsize.xbm bitmaps/font_dblsize_extra.xbm translations/font_se.xbm translations/font_de.xbm translations/font_it.xbm translations/font_cz.xbm translations/font_fr.xbm translations/font_es.xbm translations/font_dblsize_se.xbm translations/font_dblsize_de.xbm translations/font_dblsize_it.xbm translations/font_dblsize_fr.xbm translations/font_dblsize_es.xbm
|
||||
@echo
|
||||
@echo "Convert font from xbm to lbm:"
|
||||
$(IMG2LBM) font.xbm font.lbm 5x7
|
||||
$(IMG2LBM) font_extra.xbm font_extra.lbm 5x7
|
||||
@echo "Convert fonts from xbm to lbm:"
|
||||
$(IMG2LBM) bitmaps/font.xbm bitmaps/font.lbm 5x7
|
||||
$(IMG2LBM) bitmaps/font_extra.xbm bitmaps/font_extra.lbm 5x7
|
||||
$(IMG2LBM) bitmaps/font_tiny.xbm bitmaps/font_tiny.lbm 3x5
|
||||
$(IMG2LBM) bitmaps/font_small.xbm bitmaps/font_small.lbm 4x6
|
||||
$(IMG2LBM) bitmaps/font_midsize.xbm bitmaps/font_midsize.lbm 8x10
|
||||
$(IMG2LBM) bitmaps/font_dblsize.xbm bitmaps/font_dblsize.lbm 10x14
|
||||
$(IMG2LBM) bitmaps/font_dblsize_extra.xbm bitmaps/font_dblsize_extra.lbm 10x14
|
||||
$(IMG2LBM) translations/font_se.xbm translations/font_se.lbm 5x7
|
||||
$(IMG2LBM) translations/font_de.xbm translations/font_de.lbm 5x7
|
||||
$(IMG2LBM) translations/font_it.xbm translations/font_it.lbm 5x7
|
||||
$(IMG2LBM) translations/font_cz.xbm translations/font_cz.lbm 5x7
|
||||
$(IMG2LBM) translations/font_fr.xbm translations/font_fr.lbm 5x7
|
||||
$(IMG2LBM) translations/font_es.xbm translations/font_es.lbm 5x7
|
||||
|
||||
font_tiny.lbm: font_tiny.xbm
|
||||
@echo
|
||||
@echo "Convert font from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ 3x5
|
||||
|
||||
font_small.lbm: font_small.xbm
|
||||
@echo
|
||||
@echo "Convert font from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ 4x6
|
||||
|
||||
font_midsize.lbm: font_midsize.xbm
|
||||
@echo
|
||||
@echo "Convert font from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ 8x10
|
||||
|
||||
font_dblsize.lbm: font_dblsize.xbm font_dblsize_extra.xbm translations/font_dblsize_se.xbm translations/font_dblsize_de.xbm translations/font_dblsize_it.xbm translations/font_dblsize_fr.xbm translations/font_dblsize_es.xbm
|
||||
@echo
|
||||
@echo "Convert font from xbm to lbm:"
|
||||
$(IMG2LBM) font_dblsize.xbm font_dblsize.lbm 10x14
|
||||
$(IMG2LBM) font_dblsize_extra.xbm font_dblsize_extra.lbm 10x14
|
||||
$(IMG2LBM) translations/font_dblsize_se.xbm translations/font_dblsize_se.lbm 10x14
|
||||
$(IMG2LBM) translations/font_dblsize_de.xbm translations/font_dblsize_de.lbm 10x14
|
||||
$(IMG2LBM) translations/font_dblsize_it.xbm translations/font_dblsize_it.lbm 10x14
|
||||
$(IMG2LBM) translations/font_dblsize_fr.xbm translations/font_dblsize_fr.lbm 10x14
|
||||
$(IMG2LBM) translations/font_dblsize_es.xbm translations/font_dblsize_es.lbm 10x14
|
||||
|
||||
sticks.lbm: sticks_4x1.xbm
|
||||
bitmaps/sticks.lbm: bitmaps/sticks_4x1.xbm bitmaps/splash_9x.xbm bitmaps/splash_taranis.png bitmaps/logo_taranis.bmp bitmaps/icons.png bitmaps/asterisk.xbm
|
||||
@echo
|
||||
@echo "Convert sticks from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ img 4
|
||||
|
||||
splash_9x.lbm: splash_9x.xbm
|
||||
@echo
|
||||
@echo "Convert 9x splash from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ img
|
||||
|
||||
splash_taranis.lbm: splash_taranis.png
|
||||
@echo
|
||||
@echo "Convert Taranis splash from png to lbm:"
|
||||
$(IMG2LBM) $< $@ bmp
|
||||
|
||||
logo_taranis.lbm: logo_taranis.bmp
|
||||
@echo
|
||||
@echo "Convert Taranis logo from bmp to lbm:"
|
||||
$(IMG2LBM) $< $@ bmp
|
||||
|
||||
icons.lbm: icons.png
|
||||
@echo
|
||||
@echo "Convert icons from png to lbm:"
|
||||
$(IMG2LBM) $< $@ bmp
|
||||
|
||||
asterisk.lbm: asterisk.xbm
|
||||
@echo
|
||||
@echo "Convert asterisk from xbm to lbm:"
|
||||
$(IMG2LBM) $< $@ img
|
||||
@echo "Convert bitmaps from xbm to lbm:"
|
||||
$(IMG2LBM) bitmaps/sticks_4x1.xbm bitmaps/sticks.lbm img 4
|
||||
$(IMG2LBM) bitmaps/splash_9x.xbm bitmaps/splash_9x.lbm img
|
||||
$(IMG2LBM) bitmaps/splash_taranis.png bitmaps/splash_taranis.lbm bmp
|
||||
$(IMG2LBM) bitmaps/logo_taranis.bmp bitmaps/logo_taranis.lbm bmp
|
||||
$(IMG2LBM) bitmaps/icons.png bitmaps/icons.lbm bmp
|
||||
$(IMG2LBM) bitmaps/asterisk.xbm bitmaps/asterisk.lbm img
|
||||
|
||||
# Eye candy.
|
||||
# AVR Studio 3.x does not check make's exit code but relies on
|
||||
@@ -1135,7 +1109,7 @@ FOXLIB=-L/usr/local/lib \
|
||||
-lFOX-1.6 \
|
||||
-Wl,-rpath,$(FOXPATH)/src/.libs
|
||||
|
||||
simu: stamp_header $(BOARDSRC) $(CPPSRC) Makefile simu.cpp simpgmspace.cpp *.h *.lbm eeprom.bin
|
||||
simu: stamp_header $(BOARDSRC) $(CPPSRC) Makefile simu.cpp simpgmspace.cpp *.h lbm eeprom.bin
|
||||
g++ $(CPPFLAGS) simu.cpp $(BOARDSRC) $(CPPSRC) simpgmspace.cpp -MD -DSIMU -O0 -o simu $(FOXINC) $(FOXLIB) -pthread
|
||||
|
||||
eeprom.bin:
|
||||
|
||||
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -37,7 +37,7 @@
|
||||
#include "opentx.h"
|
||||
|
||||
const pm_uchar sticks[] PROGMEM = {
|
||||
#include "sticks.lbm"
|
||||
#include "bitmaps/sticks.lbm"
|
||||
};
|
||||
|
||||
enum EnumTabDiag {
|
||||
@@ -853,18 +853,22 @@ enum menuModelSetupItems {
|
||||
ITEM_MODEL_TRAINER_MODE,
|
||||
ITEM_MODEL_TRAINER_CHANNELS,
|
||||
ITEM_MODEL_TRAINER_SETTINGS,
|
||||
#elif defined(PCBSKY9X)
|
||||
ITEM_MODEL_PPM1_PROTOCOL,
|
||||
ITEM_MODEL_PPM1_PARAMS,
|
||||
ITEM_MODEL_PPM2_PROTOCOL,
|
||||
ITEM_MODEL_PPM2_PARAMS,
|
||||
#else
|
||||
ITEM_MODEL_PROTOCOL,
|
||||
IF_PCBSKY9X(ITEM_MODEL_PPM2_PROTOCOL)
|
||||
ITEM_MODEL_PROTOCOL_PARAMS,
|
||||
ITEM_MODEL_PPM1_PROTOCOL,
|
||||
ITEM_MODEL_PPM1_PARAMS,
|
||||
#endif
|
||||
ITEM_MODEL_SETUP_MAX
|
||||
};
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
#define FIELD_PROTOCOL_MAX 2
|
||||
#define FIELD_PROTOCOL_MAX 2
|
||||
#else
|
||||
#define FIELD_PROTOCOL_MAX 1
|
||||
#define FIELD_PROTOCOL_MAX 1
|
||||
#endif
|
||||
|
||||
#if LCD_W >= 212
|
||||
@@ -923,11 +927,11 @@ void menuModelSetup(uint8_t event)
|
||||
#elif defined(CPUM64)
|
||||
#define CURSOR_ON_CELL (true)
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, IF_PCBSKY9X(1) 2 });
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2 });
|
||||
#else
|
||||
#define CURSOR_ON_CELL (true)
|
||||
uint8_t protocol = g_model.protocol;
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, IF_PCBSKY9X(1) 2 });
|
||||
MENU(STR_MENUSETUP, menuTabModel, e_ModelSetup, ((IS_PPM_PROTOCOL(protocol)||IS_DSM2_PROTOCOL(protocol)||IS_PXX_PROTOCOL(protocol)) ? 1+ITEM_MODEL_SETUP_MAX : ITEM_MODEL_SETUP_MAX), { 0, 0, CASE_PCBTARANIS(0) 2, IF_PERSISTENT_TIMERS(0) 0, 0, 2, IF_PERSISTENT_TIMERS(0) 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, NUM_STICKS+NUM_POTS+NUM_ROTARY_ENCODERS-1, FIELD_PROTOCOL_MAX, 2, IF_PCBSKY9X(1) IF_PCBSKY9X(2) });
|
||||
#endif
|
||||
|
||||
uint8_t sub = m_posVert - 1;
|
||||
@@ -1326,7 +1330,7 @@ void menuModelSetup(uint8_t event)
|
||||
|
||||
#else
|
||||
|
||||
case ITEM_MODEL_PROTOCOL:
|
||||
case ITEM_MODEL_PPM1_PROTOCOL:
|
||||
#if defined(PCBSKY9X)
|
||||
lcd_putsLeft(y, PSTR("Port1"));
|
||||
#else
|
||||
@@ -1361,7 +1365,7 @@ void menuModelSetup(uint8_t event)
|
||||
case 1:
|
||||
#if defined(PCBSKY9X)
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[0].channelsStart, 32-8-g_model.moduleData[0].channelsCount);
|
||||
g_model.moduleData[0].ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8);
|
||||
g_model.moduleData[0].ppmFrameLength = 4*(NUM_PORT1_CHANNELS()-8);
|
||||
#else
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.ppmNCH, -2, 4);
|
||||
g_model.ppmFrameLength = g_model.ppmNCH * 8;
|
||||
@@ -1371,7 +1375,7 @@ void menuModelSetup(uint8_t event)
|
||||
case 2:
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[0].channelsCount, -4, min<int8_t>(8, 32-8-g_model.moduleData[0].channelsStart));
|
||||
g_model.moduleData[0].ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8);
|
||||
g_model.moduleData[0].ppmFrameLength = 4*(NUM_PORT1_CHANNELS()-8);
|
||||
}
|
||||
else
|
||||
REPEAT_LAST_CURSOR_MOVE();
|
||||
@@ -1393,19 +1397,41 @@ void menuModelSetup(uint8_t event)
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[1].channelsStart, 32-8-g_model.moduleData[1].channelsCount);
|
||||
g_model.moduleData[1].ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8);
|
||||
g_model.moduleData[1].ppmFrameLength = 4*(NUM_PORT2_CHANNELS()-8);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].channelsCount, -4, min<int8_t>(8, 32-g_model.moduleData[1].channelsStart)-8);
|
||||
g_model.moduleData[1].ppmFrameLength = NUM_PORT1_CHANNELS()>NUM_PORT2_CHANNELS() ? 4*(NUM_PORT1_CHANNELS()-8) : 4*(NUM_PORT2_CHANNELS()-8);
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].channelsCount, -4, min<int8_t>(8, 32-8-g_model.moduleData[1].channelsStart));
|
||||
g_model.moduleData[1].ppmFrameLength = 4*(NUM_PORT2_CHANNELS()-8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case ITEM_MODEL_PPM2_PARAMS:
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN, y, (int16_t)g_model.moduleData[1].ppmFrameLength*5 + 225, (m_posHorz<=0 ? attr : 0) | PREC1|LEFT);
|
||||
lcd_putc(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, 'u');
|
||||
lcd_outdezAtt(MODEL_SETUP_2ND_COLUMN+8*FW+2, y, (g_model.moduleData[1].ppmDelay*50)+300, (m_posHorz < 0 || m_posHorz==1) ? attr : 0);
|
||||
lcd_putcAtt(MODEL_SETUP_2ND_COLUMN+10*FW, y, g_model.moduleData[1].ppmPulsePol ? '+' : '-', (m_posHorz < 0 || m_posHorz==2) ? attr : 0);
|
||||
if (attr && (editMode>0 || p1valdiff)) {
|
||||
switch (m_posHorz) {
|
||||
case 0:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].ppmFrameLength, -20, 35);
|
||||
break;
|
||||
case 1:
|
||||
CHECK_INCDEC_MODELVAR(event, g_model.moduleData[1].ppmDelay, -4, 10);
|
||||
break;
|
||||
case 2:
|
||||
CHECK_INCDEC_MODELVAR_ZERO(event, g_model.moduleData[1].ppmPulsePol, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
|
||||
case ITEM_MODEL_PPM1_PARAMS:
|
||||
#if defined(PCBSKY9X)
|
||||
case ITEM_MODEL_PROTOCOL_PARAMS:
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
@@ -1428,7 +1454,6 @@ void menuModelSetup(uint8_t event)
|
||||
}
|
||||
}
|
||||
#else
|
||||
case ITEM_MODEL_PROTOCOL_PARAMS:
|
||||
if (IS_PPM_PROTOCOL(protocol)) {
|
||||
lcd_putsLeft(y, STR_PPMFRAME);
|
||||
lcd_puts(MODEL_SETUP_2ND_COLUMN+3*FW, y, STR_MS);
|
||||
@@ -39,15 +39,6 @@
|
||||
|
||||
#define NO_HI_LEN 25
|
||||
|
||||
// RESX range is used for internal calculation; The menu says -100.0 to 100.0; internally it is -1024 to 1024 to allow some optimizations
|
||||
#define RESX_SHIFT 10
|
||||
#define RESX 1024
|
||||
#define RESXu 1024u
|
||||
#define RESXul 1024ul
|
||||
#define RESXl 1024l
|
||||
#define RESKul 100ul
|
||||
#define RESX_PLUS_TRIM (RESX+128)
|
||||
|
||||
typedef void (*MenuFuncP)(uint8_t event);
|
||||
|
||||
void displayScreenIndex(uint8_t index, uint8_t count, uint8_t attr);
|
||||
@@ -98,11 +98,11 @@
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
const pm_uchar logo_taranis[] PROGMEM = {
|
||||
#include "logo_taranis.lbm"
|
||||
#include "bitmaps/logo_taranis.lbm"
|
||||
};
|
||||
|
||||
const pm_uchar icons[] PROGMEM = {
|
||||
#include "icons.lbm"
|
||||
#include "bitmaps/icons.lbm"
|
||||
};
|
||||
|
||||
#define ICON_RSSI 0, 9
|
||||
@@ -35,7 +35,6 @@
|
||||
*/
|
||||
|
||||
#include "opentx.h"
|
||||
#include "menus.h"
|
||||
|
||||
#if defined(FRSKY_HUB)
|
||||
uint8_t barsThresholds[THLD_MAX];
|
||||
+6
-6
@@ -73,9 +73,9 @@ OS_MutexID mixerMutex;
|
||||
#if defined(SPLASH)
|
||||
const pm_uchar splashdata[] PROGMEM = { 'S','P','S',0,
|
||||
#if defined(PCBTARANIS)
|
||||
#include "splash_taranis.lbm"
|
||||
#include "bitmaps/splash_taranis.lbm"
|
||||
#else
|
||||
#include "splash_9x.lbm"
|
||||
#include "bitmaps/splash_9x.lbm"
|
||||
#endif
|
||||
'S','P','E',0};
|
||||
const pm_uchar * splash_lbm = splashdata+4;
|
||||
@@ -83,11 +83,11 @@ const pm_uchar * splash_lbm = splashdata+4;
|
||||
|
||||
#if !defined(CPUM64) || defined(EXTSTD)
|
||||
const pm_uchar asterisk_lbm[] PROGMEM = {
|
||||
#include "asterisk.lbm"
|
||||
#include "bitmaps/asterisk.lbm"
|
||||
};
|
||||
#endif
|
||||
|
||||
#include "menus.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
EEGeneral g_eeGeneral;
|
||||
ModelData g_model;
|
||||
@@ -279,7 +279,7 @@ void per10ms()
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY) || defined(JETI)
|
||||
if (!IS_DSM2_SERIAL_PROTOCOL(s_current_protocol))
|
||||
telemetryInterrupt10ms();
|
||||
#endif
|
||||
@@ -3586,7 +3586,7 @@ void perMain()
|
||||
|
||||
checkBacklight();
|
||||
|
||||
#if defined(FRSKY)
|
||||
#if defined(FRSKY) || defined(MAVLINK)
|
||||
telemetryWakeup();
|
||||
#endif
|
||||
|
||||
|
||||
+22
-15
@@ -207,14 +207,21 @@
|
||||
#define CONVERT_PTR(x) ((uint32_t)(x))
|
||||
#endif
|
||||
|
||||
// RESX range is used for internal calculation; The menu says -100.0 to 100.0; internally it is -1024 to 1024 to allow some optimizations
|
||||
#define RESX_SHIFT 10
|
||||
#define RESX 1024
|
||||
#define RESXu 1024u
|
||||
#define RESXul 1024ul
|
||||
#define RESXl 1024l
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
#include "taranis/board_taranis.h"
|
||||
#include "targets/taranis/board_taranis.h"
|
||||
#elif defined(PCBSKY9X)
|
||||
#include "sky9x/board_sky9x.h"
|
||||
#include "targets/sky9x/board_sky9x.h"
|
||||
#elif defined(PCBGRUVIN9X)
|
||||
#include "gruvin9x/board_gruvin9x.h"
|
||||
#include "targets/gruvin9x/board_gruvin9x.h"
|
||||
#else
|
||||
#include "stock/board_stock.h"
|
||||
#include "targets/stock/board_stock.h"
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
@@ -409,9 +416,9 @@ enum EnumKeys {
|
||||
#endif
|
||||
|
||||
#if defined(CPUARM)
|
||||
#include "pulses_arm.h"
|
||||
#include "protocols/pulses_arm.h"
|
||||
#else
|
||||
#include "pulses_avr.h"
|
||||
#include "protocols/pulses_avr.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
@@ -471,7 +478,7 @@ enum EnumKeys {
|
||||
#endif
|
||||
|
||||
#include "lcd.h"
|
||||
#include "menus.h"
|
||||
#include "gui/menus.h"
|
||||
|
||||
#if defined(TEMPLATES)
|
||||
#include "templates.h"
|
||||
@@ -1155,23 +1162,23 @@ inline bool isFunctionActive(uint8_t func)
|
||||
|
||||
#if defined(FRSKY_SPORT)
|
||||
// FrSky SPORT Telemetry
|
||||
#include "telemetry_sport.h"
|
||||
#include "telemetry/frsky_sport.h"
|
||||
#elif defined (FRSKY)
|
||||
// FrSky Telemetry
|
||||
#include "telemetry_frsky.h"
|
||||
#include "telemetry/frsky.h"
|
||||
#elif defined(JETI)
|
||||
// Jeti-DUPLEX Telemetry
|
||||
#include "telemetry_jeti.h"
|
||||
#include "telemetry/jeti.h"
|
||||
#elif defined(ARDUPILOT)
|
||||
// ArduPilot Telemetry
|
||||
#include "telemetry_ardupilot.h"
|
||||
#include "telemetry/ardupilot.h"
|
||||
#elif defined(NMEA)
|
||||
// NMEA Telemetry
|
||||
#include "telemetry_nmea.h"
|
||||
#include "telemetry/nmea.h"
|
||||
#elif defined(MAVLINK)
|
||||
// Mavlink Telemetry
|
||||
#include "rotarysw.h"
|
||||
#include "telemetry_mavlink.h"
|
||||
#include "telemetry/mavlink.h"
|
||||
#endif
|
||||
|
||||
#define PLAY_REPEAT(x) (x) /* Range 0 to 15 */
|
||||
@@ -1249,11 +1256,11 @@ enum AUDIO_SOUNDS {
|
||||
#endif
|
||||
|
||||
#if defined(PCBSTD) && defined(VOICE)
|
||||
#include "stock/voice.h"
|
||||
#include "targets/stock/voice.h"
|
||||
#endif
|
||||
|
||||
#if defined(PCBGRUVIN9X) && defined(VOICE)
|
||||
#include "gruvin9x/somo14d.h"
|
||||
#include "targets/gruvin9x/somo14d.h"
|
||||
#endif
|
||||
|
||||
#include "translations.h"
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, 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 "opentx.h"
|
||||
|
||||
uint8_t Bit_pulses[64] ; // Likely more than we need
|
||||
uint8_t *Pulses2MHzptr ;
|
||||
uint8_t Serial_byte ;
|
||||
uint8_t Serial_bit_count;
|
||||
uint8_t Serial_byte_count ;
|
||||
|
||||
// DSM2 control bits
|
||||
#define DSM2_CHANS 6
|
||||
#define BIND_BIT 0x80
|
||||
#define RANGECHECK_BIT 0x20
|
||||
#define FRANCE_BIT 0x10
|
||||
#define DSMX_BIT 0x08
|
||||
#define BAD_DATA 0x47
|
||||
|
||||
#define BITLEN_DSM2 (8*2) //125000 Baud => 8uS per bit
|
||||
|
||||
void put_serial_bit(uint8_t bit)
|
||||
{
|
||||
Serial_byte >>= 1 ;
|
||||
if (bit & 1)
|
||||
{
|
||||
Serial_byte |= 0x80 ;
|
||||
}
|
||||
if (++Serial_bit_count >= 8)
|
||||
{
|
||||
*Pulses2MHzptr++ = Serial_byte ;
|
||||
Serial_bit_count = 0 ;
|
||||
Serial_byte_count += 1 ;
|
||||
}
|
||||
}
|
||||
|
||||
void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1
|
||||
{
|
||||
put_serial_bit(0) ; // Start bit
|
||||
for(uint8_t i=0; i<8; i++) // 8 data Bits
|
||||
{
|
||||
put_serial_bit(b & 1) ;
|
||||
b >>= 1 ;
|
||||
}
|
||||
|
||||
put_serial_bit(1) ; // Stop bit
|
||||
put_serial_bit(1) ; // Stop bit
|
||||
}
|
||||
|
||||
// This is the data stream to send, prepare after 19.5 mS
|
||||
// Send after 22.5 mS
|
||||
|
||||
//static uint8_t *Dsm2_pulsePtr = pulses2MHz.pbyte ;
|
||||
void setupPulsesDsm2(uint8_t chns)
|
||||
{
|
||||
static uint8_t dsmDat[2+6*2]={0xFF,0x00, 0x00,0xAA, 0x05,0xFF, 0x09,0xFF, 0x0D,0xFF, 0x13,0x54, 0x14,0xAA};
|
||||
uint8_t counter ;
|
||||
// CSwData &cs = g_model.customSw[NUM_CSW-1];
|
||||
|
||||
Serial_byte = 0 ;
|
||||
Serial_bit_count = 0 ;
|
||||
Serial_byte_count = 0 ;
|
||||
Pulses2MHzptr = Bit_pulses ;
|
||||
|
||||
// If more channels needed make sure the pulses union/array is large enough
|
||||
if (dsmDat[0]&BAD_DATA) //first time through, setup header
|
||||
{
|
||||
switch(s_current_protocol[0])
|
||||
{
|
||||
case PROTO_DSM2_LP45:
|
||||
dsmDat[0]= 0x80;
|
||||
break;
|
||||
case PROTO_DSM2_DSM2:
|
||||
dsmDat[0]=0x90;
|
||||
break;
|
||||
default:
|
||||
dsmDat[0]=0x98; //dsmx, bind mode
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((dsmDat[0] & BIND_BIT) && (!switchState(SW_TRN))) dsmDat[0] &= ~BIND_BIT; // clear bind bit if trainer not pulled
|
||||
|
||||
// TODO find a way to do that, FUNC SWITCH: if ((!(dsmDat[0] & BIND_BIT)) && getSwitch(MAX_DRSWITCH-1, 0, 0)) dsmDat[0] |= RANGECHECK_BIT; // range check function
|
||||
// else dsmDat[0] &= ~RANGECHECK_BIT;
|
||||
dsmDat[1]=g_eeGeneral.currModel+1; //DSM2 Header second byte for model match
|
||||
for(uint8_t i=0; i<chns; i++)
|
||||
{
|
||||
uint16_t pulse = limit(0, ((channelOutputs[i]*13)>>5)+512,1023);
|
||||
dsmDat[2+2*i] = (i<<2) | ((pulse>>8)&0x03);
|
||||
dsmDat[3+2*i] = pulse & 0xff;
|
||||
}
|
||||
|
||||
for (counter = 0 ; counter < 14 ; counter += 1)
|
||||
{
|
||||
sendByteDsm2(dsmDat[counter]);
|
||||
}
|
||||
for (counter = 0 ; counter < 16 ; counter += 1)
|
||||
{
|
||||
put_serial_bit(1) ; // 16 extra stop bits
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, 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 "opentx.h"
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
// TODO internal module doesn't send PPM
|
||||
uint16_t ppmStream[NUM_MODULES+1][20] = { { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||
#else
|
||||
uint16_t ppmStream[NUM_MODULES][20] = { MODULES_INIT({ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }) };
|
||||
#endif
|
||||
|
||||
void setupPulsesPPM(unsigned int port) // Don't enable interrupts through here
|
||||
{
|
||||
int16_t PPM_range = g_model.extendedLimits ? 640 * 2 : 512 * 2; //range of 0.7..1.7msec
|
||||
|
||||
// Total frame length = 22.5msec
|
||||
// each pulse is 0.7..1.7ms long with a 0.3ms stop tail
|
||||
// The pulse ISR is 2mhz that's why everything is multiplied by 2
|
||||
|
||||
uint32_t firstCh = g_model.moduleData[port].channelsStart;
|
||||
uint32_t lastCh = min<unsigned int>(NUM_CHNOUT, firstCh + 8 + g_model.moduleData[port].channelsCount);
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
register Pwm *pwmptr = PWM;
|
||||
uint32_t pwmCh = (port == 0 ? 3 : 1);
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CDTYUPD = (g_model.moduleData[port].ppmDelay * 50 + 300) * 2; //Stoplen *2
|
||||
if (g_model.moduleData[port].ppmPulsePol)
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CMR |= 0x00000200 ; // CPOL
|
||||
else
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CMR &= ~0x00000200 ; // CPOL
|
||||
#endif
|
||||
|
||||
uint16_t * ptr = ppmStream[port];
|
||||
uint32_t rest = 22500u * 2; //Minimum Framelen=22.5 ms
|
||||
rest += (int32_t(g_model.moduleData[port].ppmFrameLength)) * 1000;
|
||||
for (uint32_t i=firstCh; i<lastCh; i++) {
|
||||
int16_t v = limit((int16_t)-PPM_range, channelOutputs[i], (int16_t)PPM_range) + 2*PPM_CH_CENTER(i);
|
||||
rest -= v;
|
||||
*ptr++ = v; /* as Pat MacKenzie suggests */
|
||||
}
|
||||
rest = (rest > 65535) ? 65535 : rest;
|
||||
*ptr = rest;
|
||||
*(ptr + 1) = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (port == TRAINER_MODULE) {
|
||||
TIM3->CCR2 = rest - 1000 ; // Update time
|
||||
TIM3->CCR4 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
}
|
||||
else if (port == EXTERNAL_MODULE) {
|
||||
TIM8->CCR2 = rest - 1000; // Update time
|
||||
TIM8->CCR1 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
}
|
||||
else {
|
||||
TIM1->CCR2 = rest - 1000; // Update time
|
||||
TIM1->CCR3 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, 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 "opentx.h"
|
||||
|
||||
uint8_t s_pulses_paused = 0;
|
||||
uint8_t s_current_protocol[NUM_MODULES] = { MODULES_INIT(255) };
|
||||
uint32_t failsafeCounter[NUM_MODULES] = { MODULES_INIT(100) };
|
||||
|
||||
void setupPulses(unsigned int port)
|
||||
{
|
||||
heartbeat |= (HEART_TIMER_PULSES << port);
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (port) port = 1; // Ensure is 0 or 1 only
|
||||
uint8_t required_protocol;
|
||||
|
||||
if (port == INTERNAL_MODULE) {
|
||||
required_protocol = g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX;
|
||||
}
|
||||
else {
|
||||
switch (g_model.externalModule) {
|
||||
case MODULE_TYPE_PPM:
|
||||
required_protocol = PROTO_PPM;
|
||||
break;
|
||||
case MODULE_TYPE_XJT:
|
||||
case MODULE_TYPE_DJT:
|
||||
required_protocol = PROTO_PXX;
|
||||
break;
|
||||
default:
|
||||
required_protocol = PROTO_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint8_t required_protocol = g_model.protocol;
|
||||
#endif
|
||||
|
||||
if (s_pulses_paused)
|
||||
required_protocol = PROTO_NONE;
|
||||
|
||||
if (s_current_protocol[port] != required_protocol) {
|
||||
|
||||
switch (s_current_protocol[port]) { // stop existing protocol hardware
|
||||
case PROTO_PXX:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_pxx(port);
|
||||
#else
|
||||
disable_pxx();
|
||||
#endif
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
disable_ssc();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_ppm(port);
|
||||
#else
|
||||
disable_main_ppm();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
s_current_protocol[port] = required_protocol;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
init_pxx(port);
|
||||
break;
|
||||
case PROTO_PPM:
|
||||
init_ppm(port);
|
||||
break;
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
switch (required_protocol) { // Start new protocol hardware here
|
||||
case PROTO_PXX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
break;
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
break;
|
||||
case PROTO_NONE:
|
||||
init_main_ppm(3000, 0); // Initial period 1.5 mS, output off
|
||||
break;
|
||||
default:
|
||||
init_main_ppm(3000, 1); // Initial period 1.5 mS, output on
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set up output data here
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
setupPulsesPXX(port);
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
setupPulsesDsm2(6);
|
||||
break;
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
case PROTO_PPM:
|
||||
#else
|
||||
default:
|
||||
#endif
|
||||
setupPulsesPPM(port); // Don't enable interrupts through here
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,12 @@
|
||||
#ifndef pulses_arm_h
|
||||
#define pulses_arm_h
|
||||
|
||||
#if NUM_MODULES == 2
|
||||
#define MODULES_INIT(...) __VA_ARGS__, __VA_ARGS__
|
||||
#else
|
||||
#define MODULES_INIT(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
extern uint8_t s_current_protocol[NUM_MODULES];
|
||||
extern uint8_t s_pulses_paused;
|
||||
extern uint32_t failsafeCounter[NUM_MODULES];
|
||||
@@ -0,0 +1,233 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, 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 "opentx.h"
|
||||
|
||||
uint8_t pxxFlag[NUM_MODULES] = { MODULES_INIT(0) };
|
||||
uint16_t pxxStream[NUM_MODULES][400]; // Transitions
|
||||
uint16_t *pxxStreamPtr[NUM_MODULES];
|
||||
uint16_t PxxValue[NUM_MODULES];
|
||||
uint16_t PcmCrc[NUM_MODULES];
|
||||
uint8_t PcmOnesCount[NUM_MODULES];
|
||||
|
||||
const uint16_t CRCTable[]=
|
||||
{
|
||||
0x0000,0x1189,0x2312,0x329b,0x4624,0x57ad,0x6536,0x74bf,
|
||||
0x8c48,0x9dc1,0xaf5a,0xbed3,0xca6c,0xdbe5,0xe97e,0xf8f7,
|
||||
0x1081,0x0108,0x3393,0x221a,0x56a5,0x472c,0x75b7,0x643e,
|
||||
0x9cc9,0x8d40,0xbfdb,0xae52,0xdaed,0xcb64,0xf9ff,0xe876,
|
||||
0x2102,0x308b,0x0210,0x1399,0x6726,0x76af,0x4434,0x55bd,
|
||||
0xad4a,0xbcc3,0x8e58,0x9fd1,0xeb6e,0xfae7,0xc87c,0xd9f5,
|
||||
0x3183,0x200a,0x1291,0x0318,0x77a7,0x662e,0x54b5,0x453c,
|
||||
0xbdcb,0xac42,0x9ed9,0x8f50,0xfbef,0xea66,0xd8fd,0xc974,
|
||||
0x4204,0x538d,0x6116,0x709f,0x0420,0x15a9,0x2732,0x36bb,
|
||||
0xce4c,0xdfc5,0xed5e,0xfcd7,0x8868,0x99e1,0xab7a,0xbaf3,
|
||||
0x5285,0x430c,0x7197,0x601e,0x14a1,0x0528,0x37b3,0x263a,
|
||||
0xdecd,0xcf44,0xfddf,0xec56,0x98e9,0x8960,0xbbfb,0xaa72,
|
||||
0x6306,0x728f,0x4014,0x519d,0x2522,0x34ab,0x0630,0x17b9,
|
||||
0xef4e,0xfec7,0xcc5c,0xddd5,0xa96a,0xb8e3,0x8a78,0x9bf1,
|
||||
0x7387,0x620e,0x5095,0x411c,0x35a3,0x242a,0x16b1,0x0738,
|
||||
0xffcf,0xee46,0xdcdd,0xcd54,0xb9eb,0xa862,0x9af9,0x8b70,
|
||||
0x8408,0x9581,0xa71a,0xb693,0xc22c,0xd3a5,0xe13e,0xf0b7,
|
||||
0x0840,0x19c9,0x2b52,0x3adb,0x4e64,0x5fed,0x6d76,0x7cff,
|
||||
0x9489,0x8500,0xb79b,0xa612,0xd2ad,0xc324,0xf1bf,0xe036,
|
||||
0x18c1,0x0948,0x3bd3,0x2a5a,0x5ee5,0x4f6c,0x7df7,0x6c7e,
|
||||
0xa50a,0xb483,0x8618,0x9791,0xe32e,0xf2a7,0xc03c,0xd1b5,
|
||||
0x2942,0x38cb,0x0a50,0x1bd9,0x6f66,0x7eef,0x4c74,0x5dfd,
|
||||
0xb58b,0xa402,0x9699,0x8710,0xf3af,0xe226,0xd0bd,0xc134,
|
||||
0x39c3,0x284a,0x1ad1,0x0b58,0x7fe7,0x6e6e,0x5cf5,0x4d7c,
|
||||
0xc60c,0xd785,0xe51e,0xf497,0x8028,0x91a1,0xa33a,0xb2b3,
|
||||
0x4a44,0x5bcd,0x6956,0x78df,0x0c60,0x1de9,0x2f72,0x3efb,
|
||||
0xd68d,0xc704,0xf59f,0xe416,0x90a9,0x8120,0xb3bb,0xa232,
|
||||
0x5ac5,0x4b4c,0x79d7,0x685e,0x1ce1,0x0d68,0x3ff3,0x2e7a,
|
||||
0xe70e,0xf687,0xc41c,0xd595,0xa12a,0xb0a3,0x8238,0x93b1,
|
||||
0x6b46,0x7acf,0x4854,0x59dd,0x2d62,0x3ceb,0x0e70,0x1ff9,
|
||||
0xf78f,0xe606,0xd49d,0xc514,0xb1ab,0xa022,0x92b9,0x8330,
|
||||
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
|
||||
};
|
||||
|
||||
void crc(uint8_t data, unsigned int port)
|
||||
{
|
||||
PcmCrc[port]=(PcmCrc[port]<<8)^(CRCTable[((PcmCrc[port]>>8)^data) & 0xFF]);
|
||||
}
|
||||
|
||||
void putPcmPart(uint8_t value, unsigned int port)
|
||||
{
|
||||
PxxValue[port] += 18 ; // Output 1 for this time
|
||||
*pxxStreamPtr[port]++ = PxxValue[port] ;
|
||||
PxxValue[port] += 14 ;
|
||||
if (value) {
|
||||
PxxValue[port] += 16 ;
|
||||
}
|
||||
*pxxStreamPtr[port]++ = PxxValue[port] ; // Output 0 for this time
|
||||
}
|
||||
|
||||
void putPcmFlush(unsigned int port)
|
||||
{
|
||||
*pxxStreamPtr[port]++ = 18010 ; // Past the 18000 of the ARR
|
||||
}
|
||||
|
||||
void putPcmBit(uint8_t bit, unsigned int port)
|
||||
{
|
||||
if (bit) {
|
||||
PcmOnesCount[port] += 1;
|
||||
putPcmPart(1, port);
|
||||
}
|
||||
else {
|
||||
PcmOnesCount[port] = 0;
|
||||
putPcmPart(0, port);
|
||||
}
|
||||
if (PcmOnesCount[port] >= 5) {
|
||||
putPcmBit(0, port); // Stuff a 0 bit in
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmByte(uint8_t byte, unsigned int port)
|
||||
{
|
||||
crc(byte, port);
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
putPcmBit(byte & 0x80, port);
|
||||
byte <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmHead(unsigned int port)
|
||||
{
|
||||
// send 7E, do not CRC
|
||||
// 01111110
|
||||
putPcmPart(0, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(0, port);
|
||||
}
|
||||
|
||||
void setupPulsesPXX(unsigned int port)
|
||||
{
|
||||
uint16_t chan=0, chan_low=0;
|
||||
|
||||
pxxStreamPtr[port] = pxxStream[port];
|
||||
PxxValue[port] = 0 ;
|
||||
PcmCrc[port] = 0;
|
||||
PcmOnesCount[port] = 0;
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(port);
|
||||
|
||||
/* Rx Number */
|
||||
putPcmByte(g_model.header.modelId, port);
|
||||
|
||||
/* FLAG1 */
|
||||
uint8_t flag1;
|
||||
if (pxxFlag[port] & PXX_SEND_RXNUM) {
|
||||
flag1 = (g_model.moduleData[port].rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag[port];
|
||||
}
|
||||
else {
|
||||
flag1 = (g_model.moduleData[port].rfProtocol << 6) | pxxFlag[port];
|
||||
|
||||
if (g_model.moduleData[port].failsafeMode != FAILSAFE_HOLD) {
|
||||
if (failsafeCounter[port]-- == 0) {
|
||||
failsafeCounter[port] = 1000;
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
if (failsafeCounter[port] == 0 && g_model.moduleData[port].channelsCount > 0) {
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
putPcmByte(flag1, port);
|
||||
|
||||
/* FLAG2 */
|
||||
putPcmByte(0, port);
|
||||
|
||||
/* PPM */
|
||||
static uint32_t pass[NUM_MODULES] = { MODULES_INIT(0) };
|
||||
uint32_t sendUpperChannels = 0;
|
||||
if (pass[port]++ & 0x01) {
|
||||
sendUpperChannels = g_model.moduleData[port].channelsCount;
|
||||
}
|
||||
for (uint32_t i=0; i<8; i++) {
|
||||
if (flag1 & PXX_SEND_FAILSAFE) {
|
||||
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) {
|
||||
if (i < sendUpperChannels)
|
||||
chan = 3072;
|
||||
else
|
||||
chan = 1024;
|
||||
}
|
||||
else {
|
||||
if (i < sendUpperChannels) {
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
if (chan == 3072) chan = 3073;
|
||||
}
|
||||
else {
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
if (chan == 1024) chan = 1025;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (i < sendUpperChannels)
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
else
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
}
|
||||
|
||||
if (i & 1) {
|
||||
putPcmByte(chan_low, port); // Low byte of channel
|
||||
putPcmByte(((chan_low >> 8) & 0x0F) | (chan << 4), port); // 4 bits each from 2 channels
|
||||
putPcmByte(chan >> 4, port); // High byte of channel
|
||||
}
|
||||
else {
|
||||
chan_low = chan;
|
||||
}
|
||||
}
|
||||
|
||||
/* CRC16 */
|
||||
putPcmByte(0, port);
|
||||
chan = PcmCrc[port];
|
||||
putPcmByte(chan>>8, port);
|
||||
putPcmByte(chan, port);
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(port);
|
||||
|
||||
putPcmFlush(port);
|
||||
}
|
||||
@@ -1,610 +0,0 @@
|
||||
/*
|
||||
* Authors (alphabetical order)
|
||||
* - Andre Bernet <bernet.andre@gmail.com>
|
||||
* - Andreas Weitl
|
||||
* - Bertrand Songis <bsongis@gmail.com>
|
||||
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
|
||||
* - Cameron Weeks <th9xer@gmail.com>
|
||||
* - Erez Raviv
|
||||
* - Gabriel Birkus
|
||||
* - Jean-Pierre Parisy
|
||||
* - Karl Szmutny
|
||||
* - Michael Blandford
|
||||
* - Michal Hlavinka
|
||||
* - Pat Mackenzie
|
||||
* - Philip Moss
|
||||
* - Rob Thomson
|
||||
* - Romolo Manfredini <romolo.manfredini@gmail.com>
|
||||
* - Thomas Husterer
|
||||
*
|
||||
* opentx is based on code named
|
||||
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
|
||||
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
|
||||
* and the original (and ongoing) project by
|
||||
* Thomas Husterer, 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 "opentx.h"
|
||||
|
||||
#if NUM_MODULES == 2
|
||||
#define MODULES_INIT(x) x, x
|
||||
#else
|
||||
#define MODULES_INIT(x) x
|
||||
#endif
|
||||
|
||||
uint8_t s_pulses_paused = 0;
|
||||
uint8_t s_current_protocol[NUM_MODULES] = { MODULES_INIT(255) };
|
||||
uint32_t failsafeCounter[NUM_MODULES] = { MODULES_INIT(100) };
|
||||
|
||||
uint8_t pxxFlag[NUM_MODULES] = { MODULES_INIT(0) };
|
||||
uint16_t pxxStream[NUM_MODULES][400] ; // Transitions
|
||||
uint16_t *pxxStreamPtr[NUM_MODULES] ;
|
||||
uint16_t PxxValue[NUM_MODULES] ;
|
||||
uint16_t PcmCrc[NUM_MODULES] ;
|
||||
uint8_t PcmOnesCount[NUM_MODULES] ;
|
||||
|
||||
#if NUM_MODULES == 2
|
||||
uint16_t ppmStream[NUM_MODULES][20] = { { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
||||
{ 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||
#else
|
||||
uint16_t ppmStream[NUM_MODULES][20] = { { 2000, 2200, 2400, 2600, 2800, 3000, 3200, 3400, 9000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
volatile uint32_t ppmStreamIndex[NUM_MODULES] = { MODULES_INIT(0) }; // Modified in interrupt routine
|
||||
uint8_t Bit_pulses[64] ; // Likely more than we need
|
||||
uint8_t *Pulses2MHzptr ;
|
||||
#endif
|
||||
|
||||
// DSM2 control bits
|
||||
#define DSM2_CHANS 6
|
||||
#define BIND_BIT 0x80
|
||||
#define RANGECHECK_BIT 0x20
|
||||
#define FRANCE_BIT 0x10
|
||||
#define DSMX_BIT 0x08
|
||||
#define BAD_DATA 0x47
|
||||
|
||||
uint8_t Serial_byte ;
|
||||
uint8_t Serial_bit_count;
|
||||
uint8_t Serial_byte_count ;
|
||||
|
||||
void setupPulsesPPM(unsigned int port) // Don't enable interrupts through here
|
||||
{
|
||||
#if defined(PCBSKY9X)
|
||||
register Pwm *pwmptr = PWM;
|
||||
#endif
|
||||
|
||||
int16_t PPM_range = g_model.extendedLimits ? 640 * 2 : 512 * 2; //range of 0.7..1.7msec
|
||||
|
||||
// Total frame length = 22.5msec
|
||||
// each pulse is 0.7..1.7ms long with a 0.3ms stop tail
|
||||
// The pulse ISR is 2mhz that's why everything is multiplied by 2
|
||||
|
||||
uint32_t firstCh = g_model.moduleData[port].channelsStart;
|
||||
uint32_t lastCh = min<unsigned int>(NUM_CHNOUT, firstCh + 8 + g_model.moduleData[port].channelsCount);
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
uint32_t pwmCh;
|
||||
if (port == 0) {
|
||||
pwmCh = 3;
|
||||
}
|
||||
else {
|
||||
pwmCh = 1;
|
||||
}
|
||||
#endif
|
||||
uint16_t * ptr = ppmStream[port];
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CDTYUPD = (g_model.moduleData[port].ppmDelay * 50 + 300) * 2; //Stoplen *2
|
||||
if (g_model.moduleData[port].ppmPulsePol)
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CMR |= 0x00000200 ; // CPOL
|
||||
else
|
||||
pwmptr->PWM_CH_NUM[pwmCh].PWM_CMR &= ~0x00000200 ; // CPOL
|
||||
#endif
|
||||
|
||||
uint32_t rest = 22500u * 2; //Minimum Framelen=22.5 ms
|
||||
rest += (int32_t(g_model.moduleData[port].ppmFrameLength)) * 1000;
|
||||
for (uint32_t i=firstCh; i<lastCh; i++) {
|
||||
int16_t v = limit((int16_t)-PPM_range, channelOutputs[i], (int16_t)PPM_range) + 2*PPM_CH_CENTER(i);
|
||||
rest -= v;
|
||||
*ptr++ = v; /* as Pat MacKenzie suggests */
|
||||
}
|
||||
rest = (rest > 65535) ? 65535 : rest;
|
||||
*ptr = rest;
|
||||
*(ptr + 1) = 0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (port == EXTERNAL_MODULE) {
|
||||
TIM8->CCR2 = rest - 1000; // Update time
|
||||
TIM8->CCR1 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
}
|
||||
else {
|
||||
TIM1->CCR2 = rest - 1000; // Update time
|
||||
TIM1->CCR3 = (g_model.moduleData[port].ppmDelay*50+300)*2;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
const uint16_t CRCTable[]=
|
||||
{
|
||||
0x0000,0x1189,0x2312,0x329b,0x4624,0x57ad,0x6536,0x74bf,
|
||||
0x8c48,0x9dc1,0xaf5a,0xbed3,0xca6c,0xdbe5,0xe97e,0xf8f7,
|
||||
0x1081,0x0108,0x3393,0x221a,0x56a5,0x472c,0x75b7,0x643e,
|
||||
0x9cc9,0x8d40,0xbfdb,0xae52,0xdaed,0xcb64,0xf9ff,0xe876,
|
||||
0x2102,0x308b,0x0210,0x1399,0x6726,0x76af,0x4434,0x55bd,
|
||||
0xad4a,0xbcc3,0x8e58,0x9fd1,0xeb6e,0xfae7,0xc87c,0xd9f5,
|
||||
0x3183,0x200a,0x1291,0x0318,0x77a7,0x662e,0x54b5,0x453c,
|
||||
0xbdcb,0xac42,0x9ed9,0x8f50,0xfbef,0xea66,0xd8fd,0xc974,
|
||||
0x4204,0x538d,0x6116,0x709f,0x0420,0x15a9,0x2732,0x36bb,
|
||||
0xce4c,0xdfc5,0xed5e,0xfcd7,0x8868,0x99e1,0xab7a,0xbaf3,
|
||||
0x5285,0x430c,0x7197,0x601e,0x14a1,0x0528,0x37b3,0x263a,
|
||||
0xdecd,0xcf44,0xfddf,0xec56,0x98e9,0x8960,0xbbfb,0xaa72,
|
||||
0x6306,0x728f,0x4014,0x519d,0x2522,0x34ab,0x0630,0x17b9,
|
||||
0xef4e,0xfec7,0xcc5c,0xddd5,0xa96a,0xb8e3,0x8a78,0x9bf1,
|
||||
0x7387,0x620e,0x5095,0x411c,0x35a3,0x242a,0x16b1,0x0738,
|
||||
0xffcf,0xee46,0xdcdd,0xcd54,0xb9eb,0xa862,0x9af9,0x8b70,
|
||||
0x8408,0x9581,0xa71a,0xb693,0xc22c,0xd3a5,0xe13e,0xf0b7,
|
||||
0x0840,0x19c9,0x2b52,0x3adb,0x4e64,0x5fed,0x6d76,0x7cff,
|
||||
0x9489,0x8500,0xb79b,0xa612,0xd2ad,0xc324,0xf1bf,0xe036,
|
||||
0x18c1,0x0948,0x3bd3,0x2a5a,0x5ee5,0x4f6c,0x7df7,0x6c7e,
|
||||
0xa50a,0xb483,0x8618,0x9791,0xe32e,0xf2a7,0xc03c,0xd1b5,
|
||||
0x2942,0x38cb,0x0a50,0x1bd9,0x6f66,0x7eef,0x4c74,0x5dfd,
|
||||
0xb58b,0xa402,0x9699,0x8710,0xf3af,0xe226,0xd0bd,0xc134,
|
||||
0x39c3,0x284a,0x1ad1,0x0b58,0x7fe7,0x6e6e,0x5cf5,0x4d7c,
|
||||
0xc60c,0xd785,0xe51e,0xf497,0x8028,0x91a1,0xa33a,0xb2b3,
|
||||
0x4a44,0x5bcd,0x6956,0x78df,0x0c60,0x1de9,0x2f72,0x3efb,
|
||||
0xd68d,0xc704,0xf59f,0xe416,0x90a9,0x8120,0xb3bb,0xa232,
|
||||
0x5ac5,0x4b4c,0x79d7,0x685e,0x1ce1,0x0d68,0x3ff3,0x2e7a,
|
||||
0xe70e,0xf687,0xc41c,0xd595,0xa12a,0xb0a3,0x8238,0x93b1,
|
||||
0x6b46,0x7acf,0x4854,0x59dd,0x2d62,0x3ceb,0x0e70,0x1ff9,
|
||||
0xf78f,0xe606,0xd49d,0xc514,0xb1ab,0xa022,0x92b9,0x8330,
|
||||
0x7bc7,0x6a4e,0x58d5,0x495c,0x3de3,0x2c6a,0x1ef1,0x0f78
|
||||
};
|
||||
|
||||
void crc(uint8_t data, unsigned int port)
|
||||
{
|
||||
PcmCrc[port]=(PcmCrc[port]<<8)^(CRCTable[((PcmCrc[port]>>8)^data) & 0xFF]);
|
||||
}
|
||||
|
||||
void putPcmPart(uint8_t value, unsigned int port)
|
||||
{
|
||||
PxxValue[port] += 18 ; // Output 1 for this time
|
||||
*pxxStreamPtr[port]++ = PxxValue[port] ;
|
||||
PxxValue[port] += 14 ;
|
||||
if (value) {
|
||||
PxxValue[port] += 16 ;
|
||||
}
|
||||
*pxxStreamPtr[port]++ = PxxValue[port] ; // Output 0 for this time
|
||||
}
|
||||
|
||||
void putPcmFlush(unsigned int port)
|
||||
{
|
||||
*pxxStreamPtr[port]++ = 18010 ; // Past the 18000 of the ARR
|
||||
}
|
||||
|
||||
void putPcmBit(uint8_t bit, unsigned int port)
|
||||
{
|
||||
if (bit)
|
||||
{
|
||||
PcmOnesCount[port] += 1 ;
|
||||
putPcmPart(1, port);
|
||||
}
|
||||
else
|
||||
{
|
||||
PcmOnesCount[port] = 0 ;
|
||||
putPcmPart(0, port);
|
||||
}
|
||||
if (PcmOnesCount[port] >= 5)
|
||||
{
|
||||
putPcmBit(0, port); // Stuff a 0 bit in
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmByte(uint8_t byte, unsigned int port)
|
||||
{
|
||||
crc(byte, port);
|
||||
|
||||
for (uint8_t i=0; i<8; i++) {
|
||||
putPcmBit(byte & 0x80, port);
|
||||
byte <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
void putPcmHead(unsigned int port)
|
||||
{
|
||||
// send 7E, do not CRC
|
||||
// 01111110
|
||||
putPcmPart(0, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(1, port);
|
||||
putPcmPart(0, port);
|
||||
}
|
||||
|
||||
#if defined(PCBSKY9X)
|
||||
void put_serial_bit(uint8_t bit)
|
||||
{
|
||||
Serial_byte >>= 1 ;
|
||||
if (bit & 1)
|
||||
{
|
||||
Serial_byte |= 0x80 ;
|
||||
}
|
||||
if (++Serial_bit_count >= 8)
|
||||
{
|
||||
*Pulses2MHzptr++ = Serial_byte ;
|
||||
Serial_bit_count = 0 ;
|
||||
Serial_byte_count += 1 ;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void setupPulsesPXX(unsigned int port)
|
||||
{
|
||||
uint16_t chan=0, chan_low=0;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
pxxStreamPtr[port] = pxxStream[port];
|
||||
PxxValue[port] = 0 ;
|
||||
#endif
|
||||
|
||||
PcmCrc[port] = 0;
|
||||
PcmOnesCount[port] = 0;
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(port);
|
||||
|
||||
/* Rx Number */
|
||||
putPcmByte(g_model.header.modelId, port);
|
||||
|
||||
/* FLAG1 */
|
||||
uint8_t flag1;
|
||||
if (pxxFlag[port] & PXX_SEND_RXNUM) {
|
||||
flag1 = (g_model.moduleData[port].rfProtocol << 6) | (g_eeGeneral.countryCode << 1) | pxxFlag[port];
|
||||
}
|
||||
else {
|
||||
flag1 = (g_model.moduleData[port].rfProtocol << 6) | pxxFlag[port];
|
||||
|
||||
if (g_model.moduleData[port].failsafeMode != FAILSAFE_HOLD) {
|
||||
if (failsafeCounter[port]-- == 0) {
|
||||
failsafeCounter[port] = 1000;
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
if (failsafeCounter[port] == 0 && g_model.moduleData[port].channelsCount > 0) {
|
||||
flag1 |= PXX_SEND_FAILSAFE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
putPcmByte(flag1, port);
|
||||
|
||||
/* FLAG2 */
|
||||
putPcmByte(0, port);
|
||||
|
||||
/* PPM */
|
||||
static uint32_t pass[NUM_MODULES] = {0};
|
||||
uint32_t sendUpperChannels = 0;
|
||||
if (pass[port]++ & 0x01) {
|
||||
sendUpperChannels = g_model.moduleData[port].channelsCount;
|
||||
}
|
||||
for (uint32_t i=0; i<8; i++) {
|
||||
if (flag1 & PXX_SEND_FAILSAFE) {
|
||||
if (g_model.moduleData[port].failsafeMode == FAILSAFE_NOPULSES) {
|
||||
if (i < sendUpperChannels)
|
||||
chan = 3072;
|
||||
else
|
||||
chan = 1024;
|
||||
}
|
||||
else {
|
||||
if (i < sendUpperChannels) {
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
if (chan == 3072) chan = 3073;
|
||||
}
|
||||
else {
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (g_model.moduleData[port].failsafeChannels[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
if (chan == 1024) chan = 1025;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (i < sendUpperChannels)
|
||||
chan = limit(2048, PPM_CH_CENTER(8+g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[8+g_model.moduleData[port].channelsStart+i] * 512 / 682) + 3072, 4095);
|
||||
else
|
||||
chan = limit(0, PPM_CH_CENTER(g_model.moduleData[port].channelsStart+i) - PPM_CENTER + (channelOutputs[g_model.moduleData[port].channelsStart+i] * 512 / 682) + 1024, 2047);
|
||||
}
|
||||
|
||||
if (i & 1) {
|
||||
putPcmByte(chan_low, port); // Low byte of channel
|
||||
putPcmByte(((chan_low >> 8) & 0x0F) | (chan << 4), port); // 4 bits each from 2 channels
|
||||
putPcmByte(chan >> 4, port); // High byte of channel
|
||||
}
|
||||
else {
|
||||
chan_low = chan;
|
||||
}
|
||||
}
|
||||
|
||||
/* CRC16 */
|
||||
putPcmByte(0, port);
|
||||
chan = PcmCrc[port];
|
||||
putPcmByte(chan>>8, port);
|
||||
putPcmByte(chan, port);
|
||||
|
||||
/* Sync */
|
||||
putPcmHead(port);
|
||||
|
||||
putPcmFlush(port);
|
||||
}
|
||||
|
||||
#if defined(DSM2)
|
||||
#define BITLEN_DSM2 (8*2) //125000 Baud => 8uS per bit
|
||||
void sendByteDsm2(uint8_t b) //max 10changes 0 10 10 10 10 1
|
||||
{
|
||||
put_serial_bit(0) ; // Start bit
|
||||
for(uint8_t i=0; i<8; i++) // 8 data Bits
|
||||
{
|
||||
put_serial_bit(b & 1) ;
|
||||
b >>= 1 ;
|
||||
}
|
||||
|
||||
put_serial_bit(1) ; // Stop bit
|
||||
put_serial_bit(1) ; // Stop bit
|
||||
}
|
||||
|
||||
// This is the data stream to send, prepare after 19.5 mS
|
||||
// Send after 22.5 mS
|
||||
|
||||
//static uint8_t *Dsm2_pulsePtr = pulses2MHz.pbyte ;
|
||||
void setupPulsesDsm2(uint8_t chns)
|
||||
{
|
||||
static uint8_t dsmDat[2+6*2]={0xFF,0x00, 0x00,0xAA, 0x05,0xFF, 0x09,0xFF, 0x0D,0xFF, 0x13,0x54, 0x14,0xAA};
|
||||
uint8_t counter ;
|
||||
// CSwData &cs = g_model.customSw[NUM_CSW-1];
|
||||
|
||||
Serial_byte = 0 ;
|
||||
Serial_bit_count = 0 ;
|
||||
Serial_byte_count = 0 ;
|
||||
Pulses2MHzptr = Bit_pulses ;
|
||||
|
||||
// If more channels needed make sure the pulses union/array is large enough
|
||||
if (dsmDat[0]&BAD_DATA) //first time through, setup header
|
||||
{
|
||||
switch(s_current_protocol[0])
|
||||
{
|
||||
case PROTO_DSM2_LP45:
|
||||
dsmDat[0]= 0x80;
|
||||
break;
|
||||
case PROTO_DSM2_DSM2:
|
||||
dsmDat[0]=0x90;
|
||||
break;
|
||||
default:
|
||||
dsmDat[0]=0x98; //dsmx, bind mode
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((dsmDat[0] & BIND_BIT) && (!switchState(SW_TRN))) dsmDat[0] &= ~BIND_BIT; // clear bind bit if trainer not pulled
|
||||
|
||||
// TODO find a way to do that, FUNC SWITCH: if ((!(dsmDat[0] & BIND_BIT)) && getSwitch(MAX_DRSWITCH-1, 0, 0)) dsmDat[0] |= RANGECHECK_BIT; // range check function
|
||||
// else dsmDat[0] &= ~RANGECHECK_BIT;
|
||||
dsmDat[1]=g_eeGeneral.currModel+1; //DSM2 Header second byte for model match
|
||||
for(uint8_t i=0; i<chns; i++)
|
||||
{
|
||||
uint16_t pulse = limit(0, ((channelOutputs[i]*13)>>5)+512,1023);
|
||||
dsmDat[2+2*i] = (i<<2) | ((pulse>>8)&0x03);
|
||||
dsmDat[3+2*i] = pulse & 0xff;
|
||||
}
|
||||
|
||||
for (counter = 0 ; counter < 14 ; counter += 1)
|
||||
{
|
||||
sendByteDsm2(dsmDat[counter]);
|
||||
}
|
||||
for (counter = 0 ; counter < 16 ; counter += 1)
|
||||
{
|
||||
put_serial_bit(1) ; // 16 extra stop bits
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PCBSKY9X) && !defined(SIMU)
|
||||
extern "C" void PWM_IRQHandler(void)
|
||||
{
|
||||
register Pwm *pwmptr;
|
||||
register Ssc *sscptr;
|
||||
uint32_t period;
|
||||
uint32_t reason;
|
||||
|
||||
pwmptr = PWM;
|
||||
reason = pwmptr->PWM_ISR1 ;
|
||||
if (reason & PWM_ISR1_CHID3) {
|
||||
switch (s_current_protocol[0]) // Use the current, don't switch until set_up_pulses
|
||||
{
|
||||
case PROTO_PXX:
|
||||
// Alternate periods of 15.5mS and 2.5 mS
|
||||
period = pwmptr->PWM_CH_NUM[3].PWM_CPDR;
|
||||
if (period == 5000) { // 2.5 mS
|
||||
period = 15500 * 2;
|
||||
}
|
||||
else {
|
||||
period = 5000;
|
||||
}
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = period; // Period in half uS
|
||||
if (period != 5000) { // 2.5 mS
|
||||
setupPulses(0);
|
||||
}
|
||||
else {
|
||||
// Kick off serial output here
|
||||
sscptr = SSC;
|
||||
sscptr->SSC_TPR = (uint32_t) Bit_pulses;
|
||||
sscptr->SSC_TCR = Serial_byte_count;
|
||||
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
|
||||
}
|
||||
break;
|
||||
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
// Alternate periods of 19.5mS and 2.5 mS
|
||||
period = pwmptr->PWM_CH_NUM[3].PWM_CPDR;
|
||||
if (period == 5000) // 2.5 mS
|
||||
{
|
||||
period = 19500 * 2;
|
||||
}
|
||||
else {
|
||||
period = 5000;
|
||||
}
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = period; // Period in half uS
|
||||
if (period != 5000) // 2.5 mS
|
||||
{
|
||||
setupPulses(0);
|
||||
}
|
||||
else {
|
||||
// Kick off serial output here
|
||||
sscptr = SSC;
|
||||
sscptr->SSC_TPR = (uint32_t) Bit_pulses;
|
||||
sscptr->SSC_TCR = Serial_byte_count;
|
||||
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = ppmStream[0][ppmStreamIndex[0]++]; // Period in half uS
|
||||
if (ppmStream[0][ppmStreamIndex[0]] == 0) {
|
||||
ppmStreamIndex[0] = 0;
|
||||
setupPulses(0);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (reason & PWM_ISR1_CHID1) {
|
||||
pwmptr->PWM_CH_NUM[1].PWM_CPDRUPD = ppmStream[1][ppmStreamIndex[1]++] ; // Period in half uS
|
||||
if (ppmStream[1][ppmStreamIndex[1]] == 0) {
|
||||
ppmStreamIndex[1] = 0 ;
|
||||
setupPulsesPPM(1) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void setupPulses(unsigned int port)
|
||||
{
|
||||
heartbeat |= (HEART_TIMER_PULSES << port);
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
if (port) port = 1; // Ensure is 0 or 1 only
|
||||
uint8_t required_protocol;
|
||||
|
||||
if (port == INTERNAL_MODULE)
|
||||
required_protocol = g_model.moduleData[INTERNAL_MODULE].rfProtocol == RF_PROTO_OFF ? PROTO_NONE : PROTO_PXX;
|
||||
else {
|
||||
switch (g_model.externalModule) {
|
||||
case MODULE_TYPE_PPM:
|
||||
required_protocol = PROTO_PPM;
|
||||
break;
|
||||
case MODULE_TYPE_XJT:
|
||||
case MODULE_TYPE_DJT:
|
||||
required_protocol = PROTO_PXX;
|
||||
break;
|
||||
default:
|
||||
required_protocol = PROTO_NONE;
|
||||
}
|
||||
}
|
||||
#else
|
||||
uint8_t required_protocol = g_model.protocol;
|
||||
#endif
|
||||
|
||||
if (s_pulses_paused)
|
||||
required_protocol = PROTO_NONE;
|
||||
|
||||
if (s_current_protocol[port] != required_protocol) {
|
||||
|
||||
switch (s_current_protocol[port]) { // stop existing protocol hardware
|
||||
case PROTO_PXX:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_pxx(port);
|
||||
#else
|
||||
disable_pxx();
|
||||
#endif
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
disable_ssc();
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
#if defined(PCBTARANIS)
|
||||
disable_ppm(port);
|
||||
#else
|
||||
disable_main_ppm();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
s_current_protocol[port] = required_protocol;
|
||||
|
||||
#if defined(PCBTARANIS)
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
init_pxx(port);
|
||||
break;
|
||||
case PROTO_PPM:
|
||||
init_ppm(port);
|
||||
break;
|
||||
}
|
||||
#elif defined(PCBSKY9X)
|
||||
switch (required_protocol) { // Start new protocol hardware here
|
||||
case PROTO_PXX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
break;
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
init_main_ppm(5000, 0); // Initial period 2.5 mS, output off
|
||||
init_ssc();
|
||||
break;
|
||||
case PROTO_NONE:
|
||||
init_main_ppm(3000, 0); // Initial period 1.5 mS, output off
|
||||
break;
|
||||
default:
|
||||
init_main_ppm(3000, 1); // Initial period 1.5 mS, output on
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set up output data here
|
||||
switch (required_protocol) {
|
||||
case PROTO_PXX:
|
||||
setupPulsesPXX(port);
|
||||
break;
|
||||
#if defined(DSM2)
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
setupPulsesDsm2(6);
|
||||
break;
|
||||
#endif
|
||||
#if defined(PCBTARANIS)
|
||||
case PROTO_PPM:
|
||||
#else
|
||||
default:
|
||||
#endif
|
||||
setupPulsesPPM(port); // Don't enable interrupts through here
|
||||
break ;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,6 @@
|
||||
*
|
||||
*/
|
||||
#include "opentx.h"
|
||||
#include "menus.h"
|
||||
|
||||
#define CTIME_ROTARY_ANIM 500
|
||||
uint16_t rotarySwChanged = 0;
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
#include <unistd.h>
|
||||
#include "fxkeys.h"
|
||||
#include "opentx.h"
|
||||
#include "menus.h"
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
|
||||
#include "../opentx.h"
|
||||
|
||||
volatile uint32_t ppmStreamIndex[NUM_MODULES] = { MODULES_INIT(0) }; // Modified in interrupt routine
|
||||
|
||||
void init_main_ppm( uint32_t period, uint32_t out_enable )
|
||||
{
|
||||
register Pio *pioptr ;
|
||||
@@ -133,3 +135,83 @@ void disable_ssc()
|
||||
sscptr = SSC ;
|
||||
sscptr->SSC_CR = SSC_CR_TXDIS ;
|
||||
}
|
||||
|
||||
#if !defined(SIMU)
|
||||
extern "C" void PWM_IRQHandler(void)
|
||||
{
|
||||
register Pwm *pwmptr;
|
||||
register Ssc *sscptr;
|
||||
uint32_t period;
|
||||
uint32_t reason;
|
||||
|
||||
pwmptr = PWM;
|
||||
reason = pwmptr->PWM_ISR1 ;
|
||||
if (reason & PWM_ISR1_CHID3) {
|
||||
switch (s_current_protocol[0]) // Use the current, don't switch until set_up_pulses
|
||||
{
|
||||
case PROTO_PXX:
|
||||
// Alternate periods of 15.5mS and 2.5 mS
|
||||
period = pwmptr->PWM_CH_NUM[3].PWM_CPDR;
|
||||
if (period == 5000) { // 2.5 mS
|
||||
period = 15500 * 2;
|
||||
}
|
||||
else {
|
||||
period = 5000;
|
||||
}
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = period; // Period in half uS
|
||||
if (period != 5000) { // 2.5 mS
|
||||
setupPulses(0);
|
||||
}
|
||||
else {
|
||||
// Kick off serial output here
|
||||
sscptr = SSC;
|
||||
sscptr->SSC_TPR = CONVERT_PTR(pxxStream[0]);
|
||||
sscptr->SSC_TCR = (uint8_t *)pxxStreamPtr[0] - (uint8_t *)pxxStream[0];
|
||||
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
|
||||
}
|
||||
break;
|
||||
|
||||
case PROTO_DSM2_LP45:
|
||||
case PROTO_DSM2_DSM2:
|
||||
case PROTO_DSM2_DSMX:
|
||||
// Alternate periods of 19.5mS and 2.5 mS
|
||||
period = pwmptr->PWM_CH_NUM[3].PWM_CPDR;
|
||||
if (period == 5000) { // 2.5 mS
|
||||
period = 19500 * 2;
|
||||
}
|
||||
else {
|
||||
period = 5000;
|
||||
}
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = period; // Period in half uS
|
||||
if (period != 5000) { // 2.5 mS
|
||||
setupPulses(0);
|
||||
}
|
||||
else {
|
||||
// Kick off serial output here
|
||||
sscptr = SSC;
|
||||
sscptr->SSC_TPR = (uint32_t) Bit_pulses;
|
||||
sscptr->SSC_TCR = Serial_byte_count;
|
||||
sscptr->SSC_PTCR = SSC_PTCR_TXTEN; // Start transfers
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
pwmptr->PWM_CH_NUM[3].PWM_CPDRUPD = ppmStream[0][ppmStreamIndex[0]++]; // Period in half uS
|
||||
if (ppmStream[0][ppmStreamIndex[0]] == 0) {
|
||||
ppmStreamIndex[0] = 0;
|
||||
setupPulses(0);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (reason & PWM_ISR1_CHID1) {
|
||||
pwmptr->PWM_CH_NUM[1].PWM_CPDRUPD = ppmStream[1][ppmStreamIndex[1]++] ; // Period in half uS
|
||||
if (ppmStream[1][ppmStreamIndex[1]] == 0) {
|
||||
ppmStreamIndex[1] = 0;
|
||||
setupPulsesPPM(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user