mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-06-06 16:58:48 +08:00
Merge branch 'master' of github.com:paparazzi/paparazzi
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
*.[oa]
|
||||
*.out
|
||||
|
||||
*~
|
||||
|
||||
*.pyc
|
||||
|
||||
*.cmo
|
||||
|
||||
@@ -58,12 +58,12 @@ MESSAGES_XML = $(CONF)/messages.xml
|
||||
UBX_XML = $(CONF)/ubx.xml
|
||||
XSENS_XML = $(CONF)/xsens_MTi-G.xml
|
||||
TOOLS=$(PAPARAZZI_SRC)/sw/tools
|
||||
HAVE_ARM_NONE_EABI_GCC := $(wildcard /usr/bin/arm-none-eabi-gcc)
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
#ARMGCC=/opt/paparazzi/bin/arm-elf-gcc
|
||||
ARMGCC=/usr/bin/arm-elf-gcc
|
||||
else
|
||||
ARMGCC=/usr/bin/arm-none-eabi-gcc
|
||||
ARMGCC=$(HAVE_ARM_NONE_EABI_GCC)
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ SRC_ARCH = arch/lpc21
|
||||
# Define programs and commands.
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
$(info Using gcc-arm 3.4.4 packaged by paparazzi.)
|
||||
CC = arm-elf-gcc
|
||||
LD = $(CC)
|
||||
SHELL = sh
|
||||
@@ -42,6 +43,7 @@ OBJDUMP = arm-elf-objdump
|
||||
SIZE = arm-elf-size
|
||||
NM = arm-elf-nm
|
||||
else
|
||||
$(info Using arm-none-eabi-gcc.)
|
||||
CC = arm-none-eabi-gcc
|
||||
LD = $(CC)
|
||||
SHELL = sh
|
||||
@@ -91,6 +93,7 @@ CFLAGS += -Wredundant-decls -Wreturn-type -Wshadow -Wunused
|
||||
CFLAGS += -Wa,-adhlns=$(OBJDIR)/$(notdir $(subst $(suffix $<),.lst,$<))
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
CFLAGS += -ffunction-sections -fdata-sections
|
||||
CFLAGS += -finline-limit=1200 --param inline-unit-growth=100
|
||||
|
||||
# flags only for C
|
||||
CFLAGS + = -Wstrict-prototypes -Wmissing-declarations
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<!ELEMENT param EMPTY>
|
||||
<!ELEMENT flag EMPTY>
|
||||
<!ELEMENT firmware (target|subsystem|define)*>
|
||||
<!ELEMENT target (param|define)*>
|
||||
<!ELEMENT target (param|define|subsystem)*>
|
||||
<!ELEMENT subsystem (param)*>
|
||||
|
||||
<!ATTLIST include
|
||||
|
||||
@@ -245,12 +245,7 @@
|
||||
<define name="AUTO2" value="AP_MODE_HOVER_Z_HOLD" />
|
||||
</section>
|
||||
|
||||
|
||||
<makefile target="opening">
|
||||
#empty
|
||||
</makefile>
|
||||
|
||||
<makefile target="closure" location="after">
|
||||
<makefile location="after">
|
||||
ap.srcs += $(SRC_BOOZ_ARCH)/booz2_pwm_hw.c
|
||||
sim.srcs += $(SRC_BOOZ_SIM)/booz2_pwm_hw.c
|
||||
</makefile>
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<!DOCTYPE airframe SYSTEM "airframe.dtd">
|
||||
<!DOCTYPE airframe SYSTEM "../../airframe.dtd">
|
||||
|
||||
<!-- Funjet Multiplex (http://www.multiplex-rc.de/), Jeti ECO 25
|
||||
Tiny 2.11 board (http://paparazzi.enac.fr/wiki/index.php/Tiny_v2)
|
||||
PerkinElmer TPS334 IR Sensors
|
||||
Tilted infrared sensor (http://paparazzi.enac.fr/wiki/index.php/Image:Tiny_v2_1_Funjet.jpg)
|
||||
XBee modem
|
||||
Payload: Sensirion humidity/temp, VTI pressure/temp
|
||||
@@ -11,7 +10,46 @@
|
||||
|
||||
<airframe name="Funjet GFI 8 K68">
|
||||
|
||||
<!-- commands section -->
|
||||
<firmware name="fixedwing">
|
||||
<target name="ap" board="tiny_2.11"/>
|
||||
<target name="sim" board="pc"/>
|
||||
|
||||
<define name="AGR_CLIMB"/>
|
||||
<define name="LOITER_TRIM"/>
|
||||
<define name="ALT_KALMAN"/>
|
||||
<define name="WIND_INFO"/>
|
||||
<define name="WIND_INFO_RET"/>
|
||||
<define name="SENSOR_SYNC_SEND"/>
|
||||
|
||||
<!-- RC -->
|
||||
<subsystem name="radio_control" type="ppm"/>
|
||||
<!-- Communication -->
|
||||
<subsystem name="telemetry" type="xbee_api"/>
|
||||
<!-- Actuators are automatically chosen according to board-->
|
||||
<subsystem name="control"/>
|
||||
<!-- Sensors -->
|
||||
<subsystem name="attitude" type="infrared"/>
|
||||
<subsystem name="gps" type="ublox_lea5h"/>
|
||||
<!-- Nav -->
|
||||
<subsystem name="navigation"/>
|
||||
<!-- Interfaces -->
|
||||
<subsystem name="spi"/>
|
||||
</firmware>
|
||||
|
||||
<!-- modules -->
|
||||
<modules>
|
||||
<load name="baro_scp.xml"/>
|
||||
<load name="humid_sht.xml"/>
|
||||
</modules>
|
||||
|
||||
<firmware name="setup">
|
||||
<target name="tunnel" board="tiny_2.11"/>
|
||||
<target name="usb_tunnel_0" board="tiny_2.11"/>
|
||||
<target name="usb_tunnel_1" board="tiny_2.11"/>
|
||||
<target name="setup_actuators" board="tiny_2.11"/>
|
||||
</firmware>
|
||||
|
||||
<!-- commands section -->
|
||||
<servos>
|
||||
<servo name="MOTOR" no="0" min="1000" neutral="1000" max="2000"/>
|
||||
<servo name="AILEVON_LEFT" no="2" min="1900" neutral="1563" max="1100"/>
|
||||
@@ -38,7 +76,7 @@
|
||||
<command_laws>
|
||||
<let var="aileron" value="@ROLL * AILEVON_AILERON_RATE"/>
|
||||
<let var="elevator" value="@PITCH * AILEVON_ELEVATOR_RATE"/>
|
||||
<set servo="MOTOR" value="@THROTTLE"/>
|
||||
<set servo="MOTOR" value="@THROTTLE"/>
|
||||
<set servo="AILEVON_LEFT" value="$elevator + $aileron"/>
|
||||
<set servo="AILEVON_RIGHT" value="$elevator - $aileron"/>
|
||||
</command_laws>
|
||||
@@ -81,8 +119,6 @@
|
||||
<section name="BAT">
|
||||
<define name="MILLIAMP_AT_FULL_THROTTLE" value="10000."/>
|
||||
<define name="CATASTROPHIC_BAT_LEVEL" value="9.3" unit="V"/>
|
||||
<!-- 0.0247311828 -->
|
||||
<!-- 0.02432905 -->
|
||||
<define name="VoltageOfAdc(adc)" value="(0.02454*adc)"/>
|
||||
</section>
|
||||
|
||||
@@ -91,8 +127,6 @@
|
||||
<define name="CARROT" value="5." unit="s"/>
|
||||
<define name="KILL_MODE_DISTANCE" value="(1.5*MAX_DIST_FROM_HOME)"/>
|
||||
<define name="CONTROL_RATE" value="60" unit="Hz"/>
|
||||
<!-- <define name="XBEE_INIT" value="\"ATPL2\rATRN1\rATTT80\r\""/> -->
|
||||
<!-- <define name="NO_XBEE_API_INIT" value="TRUE"/> -->
|
||||
<define name="ALT_KALMAN_ENABLED" value="FALSE"/>
|
||||
|
||||
<define name="TRIGGER_DELAY" value="1."/>
|
||||
@@ -125,7 +159,6 @@
|
||||
<define name="AUTO_PITCH_MIN_PITCH" value="-0.35"/>
|
||||
|
||||
<define name="THROTTLE_SLEW" value="0.1"/>
|
||||
|
||||
</section>
|
||||
|
||||
<section name="HORIZONTAL CONTROL" prefix="H_CTL_">
|
||||
@@ -140,10 +173,6 @@
|
||||
<define name="PITCH_DGAIN" value="0.4"/>
|
||||
|
||||
<define name="ELEVATOR_OF_ROLL" value="2400"/>
|
||||
|
||||
<!--define name="ROLL_ATTITUDE_GAIN" value="-7500"/>
|
||||
<define name="ROLL_RATE_GAIN" value="-1500"/-->
|
||||
|
||||
</section>
|
||||
|
||||
<section name="NAV">
|
||||
@@ -160,87 +189,14 @@
|
||||
<define name="DESCENT_PITCH" value="-0.35"/><!-- Pitch for Aggressive Decent -->
|
||||
<define name="CLIMB_NAV_RATIO" value="0.8"/><!-- Percent Navigation for Altitude Error Equal to Start Altitude -->
|
||||
<define name="DESCENT_NAV_RATIO" value="1.0"/>
|
||||
</section>
|
||||
|
||||
<section name="FAILSAFE" prefix="FAILSAFE_">
|
||||
<define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
|
||||
<define name="DEFAULT_THROTTLE" value="0.3" unit="%"/>
|
||||
<define name="DEFAULT_ROLL" value="0.3" unit="rad"/>
|
||||
<define name="DEFAULT_PITCH" value="0.5" unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="100" unit="m"/>
|
||||
</section>
|
||||
|
||||
<section name="DATALINK" prefix="DATALINK_">
|
||||
<define name="DEVICE_TYPE" value="XBEE"/>
|
||||
<define name="DEVICE_ADDRESS" value="...."/>
|
||||
</section>
|
||||
|
||||
<section name="SIMU">
|
||||
<define name="YAW_RESPONSE_FACTOR" value="0.5"/>
|
||||
</section>
|
||||
<section name="FAILSAFE" prefix="FAILSAFE_">
|
||||
<define name="DELAY_WITHOUT_GPS" value="2" unit="s"/>
|
||||
<define name="DEFAULT_THROTTLE" value="0.3" unit="%"/>
|
||||
<define name="DEFAULT_ROLL" value="0.3" unit="rad"/>
|
||||
<define name="DEFAULT_PITCH" value="0.5" unit="rad"/>
|
||||
<define name="HOME_RADIUS" value="100" unit="m"/>
|
||||
</section>
|
||||
|
||||
<makefile>
|
||||
CONFIG = \"tiny_2_1.h\"
|
||||
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
|
||||
|
||||
FLASH_MODE=IAP
|
||||
|
||||
ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1
|
||||
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
|
||||
|
||||
ap.srcs += commands.c
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
|
||||
|
||||
ap.CFLAGS += -DRADIO_CONTROL
|
||||
ap.srcs += radio_control.c $(SRC_ARCH)/ppm_hw.c
|
||||
|
||||
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600
|
||||
ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c xbee.c
|
||||
|
||||
#TRANSPARENT
|
||||
#ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=PprzTransport -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1 -DPPRZ_UART=Uart1 -DDATALINK=PPRZ -DUART1_BAUD=B9600
|
||||
#ap.srcs += downlink.c $(SRC_ARCH)/uart_hw.c datalink.c pprz_transport.c
|
||||
|
||||
|
||||
ap.CFLAGS += -DINTER_MCU
|
||||
ap.srcs += inter_mcu.c
|
||||
|
||||
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2
|
||||
ap.srcs += $(SRC_ARCH)/adc_hw.c
|
||||
|
||||
ap.CFLAGS += -DUSE_GPS -DUBX -DUSE_UART0 -DGPS_LINK=Uart0 -DUART0_BAUD=B38400 -DGPS_USE_LATLONG
|
||||
# -DGPS_LED=2
|
||||
ap.srcs += gps_ubx.c gps.c latlong.c
|
||||
|
||||
ap.CFLAGS += -DUSE_INFRARED -DALT_KALMAN -DWIND_INFO -DWIND_INFO_RET
|
||||
ap.srcs += infrared.c estimator.c
|
||||
|
||||
ap.CFLAGS += -DNAV -DAGR_CLIMB -DLOITER_TRIM
|
||||
ap.srcs += nav.c fw_h_ctl.c fw_v_ctl.c
|
||||
|
||||
ap.srcs += nav_line.c
|
||||
ap.srcs += nav_survey_rectangle.c
|
||||
|
||||
ap.srcs += humid_sht.c
|
||||
ap.CFLAGS += -DUSE_HUMID_SHT -DDAT_PIN=3 -DSCK_PIN=2
|
||||
|
||||
ap.srcs += baro_scp.c
|
||||
ap.CFLAGS += -DUSE_BARO_SCP
|
||||
|
||||
ap.srcs += joystick.c
|
||||
ap.CFLAGS += -DUSE_JOYSTICK
|
||||
|
||||
# Config for SITL simulation
|
||||
include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
|
||||
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DLOITER_TRIM -DALT_KALMAN
|
||||
sim.srcs += nav_line.c nav_survey_rectangle.c
|
||||
|
||||
sim.srcs += joystick.c
|
||||
sim.CFLAGS += -DUSE_JOYSTICK
|
||||
|
||||
|
||||
</makefile>
|
||||
</airframe>
|
||||
|
||||
@@ -5,47 +5,51 @@
|
||||
#
|
||||
|
||||
|
||||
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
CFG_FIXEDWING=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/fixedwing
|
||||
|
||||
|
||||
SRC_FIXEDWING=.
|
||||
SRC_ARCH=$(SRC_FIXEDWING)/arch/$(ARCH)
|
||||
SRC_ARCH=arch/$(ARCH)
|
||||
SRC_FIXEDWING_TEST=$(SRC_FIXEDWING)/
|
||||
|
||||
SRC_FIRMWARE=firmwares/fixedwing
|
||||
SRC_SUBSYSTEMS=subsystems
|
||||
|
||||
FIXEDWING_INC = -I$(SRC_FIRMWARE) -I$(SRC_FIXEDWING) -I$(SRC_FIXEDWING_ARCH)
|
||||
FIXEDWING_INC = -I$(SRC_FIRMWARE) -I$(SRC_FIXEDWING)
|
||||
|
||||
|
||||
|
||||
# Standard Fixed Wing Code
|
||||
include $(CFG_FIXEDWING)/autopilot.makefile
|
||||
|
||||
# automatically include correct actuators for the ap target
|
||||
ifeq ($(TARGET),ap)
|
||||
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_FIXEDWING)/actuators_4015.makefile
|
||||
else
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_FIXEDWING)/actuators_4015.makefile
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_FIXEDWING)/actuators_4017.makefile
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_FIXEDWING)/actuators_4017.makefile
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_SHARED)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_FIXEDWING)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_FIXEDWING)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_FIXEDWING)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
# MODEM_BAUD
|
||||
#
|
||||
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
CFG_ROTORCRAFT=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/rotorcraft
|
||||
|
||||
SRC_BOOZ=booz
|
||||
|
||||
@@ -4,14 +4,13 @@
|
||||
#
|
||||
|
||||
|
||||
CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/SETUP
|
||||
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
|
||||
#CFG_SETUP=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/setup
|
||||
|
||||
SRC_ARCH=arch/$(ARCH)
|
||||
SRC_FIRMWARE=firmwares/setup
|
||||
|
||||
SRC_SETUP=.
|
||||
SRC_SETUP_ARCH=$(SRC_SETUP)/$(ARCH)
|
||||
SRC_SETUP_TEST=$(SRC_SETUP)/
|
||||
|
||||
SETUP_INC = -I$(SRC_SETUP) -I$(SRC_SETUP_ARCH)
|
||||
SETUP_INC = -I$(SRC_FIRMWARE)
|
||||
|
||||
|
||||
# for the usb_tunnel we need to set PCLK higher
|
||||
@@ -49,9 +48,36 @@ usb_tunnel_1.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c
|
||||
|
||||
|
||||
|
||||
|
||||
ifeq ($(ACTUATORS),)
|
||||
ifeq ($(BOARD),tiny)
|
||||
ifeq ($(BOARD_VERSION),1.1)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
ifeq ($(BOARD_VERSION),0.99)
|
||||
include $(CFG_SHARED)/actuators_4015.makefile
|
||||
else
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
ifeq ($(BOARD),twog)
|
||||
include $(CFG_SHARED)/actuators_4017.makefile
|
||||
endif
|
||||
|
||||
ifeq ($(BOARD),lisa_l)
|
||||
include $(CFG_SHARED)/actuators_direct.makefile
|
||||
endif
|
||||
|
||||
else
|
||||
include $(CFG_SHARED)/$(ACTUATORS).makefile
|
||||
endif
|
||||
|
||||
|
||||
# a test program to setup actuators
|
||||
setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1 -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
setup_actuators.CFLAGS += -DFBW -DLED -DTIME_LED=1
|
||||
setup_actuators.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B57600 -DDOWNLINK_DEVICE=Uart1 -DPPRZ_UART=Uart1
|
||||
setup_actuators.CFLAGS += -DDOWNLINK -DDOWNLINK_TRANSPORT=PprzTransport -DDATALINK=PPRZ
|
||||
setup_actuators.CFLAGS += -DDOWNLINK_FBW_DEVICE=Uart1 -DDOWNLINK_AP_DEVICE=Uart1
|
||||
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c actuators.c setup_actuators.c $(SRC_ARCH)/uart_hw.c $(SRC_ARCH)/servos_4017_hw.c main.c
|
||||
setup_actuators.CFLAGS += $(SETUP_INC) -Ifirmwares/fixedwing
|
||||
setup_actuators.srcs += sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c pprz_transport.c downlink.c $(SRC_FIRMWARE)/setup_actuators.c $(SRC_ARCH)/uart_hw.c firmwares/fixedwing/main.c
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
# for Tiny v1.1
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT
|
||||
ap.srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c
|
||||
ap.srcs += $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
# for Tiny v2 or Twog v1
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
ap.srcs += $(SRC_ARCH)/servos_4017_hw.c $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
# for lisa_l
|
||||
|
||||
ap.CFLAGS += -DACTUATORS=\"servos_direct_hw.h\" -DSERVOS_DIRECT
|
||||
ap.srcs += $(SRC_ARCH)/servos_direct_hw.c $(SRC_FIXEDWING)/actuators.c
|
||||
|
||||
|
||||
# TODO TODO UGLY HACK: We re-use the booz actuators: Should become universal actuator code!!
|
||||
# Carefull: paths might get broken with this silly rotorcraft/fixedwing mixup of directories
|
||||
|
||||
ifeq ($(ARCH), stm32)
|
||||
ap.srcs += firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c
|
||||
ap.CFLAGS += -Ifirmwares/rotorcraft/actuators/arch/stm32
|
||||
endif
|
||||
Executable → Regular
@@ -1,7 +0,0 @@
|
||||
# Payload: Sensirion humidity/temp, VTI pressure/temp
|
||||
|
||||
ap.srcs += humid_sht.c
|
||||
ap.CFLAGS += -DUSE_HUMID_SHT -DDAT_PIN=3 -DSCK_PIN=2
|
||||
|
||||
ap.srcs += baro_scp.c
|
||||
ap.CFLAGS += -DUSE_BARO_SCP
|
||||
@@ -21,7 +21,7 @@ test_adcs.CFLAGS += -DBOARD_CONFIG=$(CONFIG) -DLED -DTIME_LED=1 -DADC -DUSE_ADC_
|
||||
test_adcs.CFLAGS += -DDOWNLINK -DUSE_UART0 -DDOWNLINK_TRANSPORT=XBeeTransport -DDOWNLINK_FBW_DEVICE=Uart0 -DDOWNLINK_AP_DEVICE=Uart0 -DXBEE_UART=Uart0 -DDATALINK=XBEE -DUART0_BAUD=B9600
|
||||
test_adcs.srcs += downlink.c $(SRC_ARCH)/uart_hw.c xbee.c
|
||||
|
||||
test_adcs.srcs += sys_time.c $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test_adcs.c
|
||||
test_adcs.srcs += sys_time.c $(SRC_ARCH)/adc_hw.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c test/test_adcs.c
|
||||
# pprz_transport.c
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
#
|
||||
# Autopilot
|
||||
#
|
||||
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
|
||||
#
|
||||
# Simulator
|
||||
#
|
||||
sim.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_LED=1
|
||||
sim.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
sim.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
sim.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
|
||||
#
|
||||
# test_rc_ppm
|
||||
#
|
||||
# configuration
|
||||
# SYS_TIME_LED
|
||||
# MODEM_PORT
|
||||
# MODEM_BAUD
|
||||
# RADIO_CONTROL_LED
|
||||
#
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
#
|
||||
# Makefile for radio_control susbsytem in rotorcraft firmware
|
||||
#
|
||||
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
|
||||
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
|
||||
endif
|
||||
|
||||
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\"
|
||||
ifeq ($(BOARD), booz)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
|
||||
endif
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_PRIMARY_PORT=$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)
|
||||
ap.CFLAGS += -DOVERRIDE_$(RADIO_CONTROL_SPEKTRUM_PRIMARY_PORT)_IRQ_HANDLER -DUSE_TIM6_IRQ
|
||||
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/spektrum.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/spektrum_arch.c
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# for Tiny v1.1
|
||||
|
||||
$(TARGET).CFLAGS += -DACTUATORS=\"servos_4015_MAT_hw.h\" -DSERVOS_4015_MAT
|
||||
$(TARGET).srcs += $(SRC_ARCH)/servos_4015_MAT_hw.c actuators.c
|
||||
@@ -0,0 +1,4 @@
|
||||
# for Tiny v2 or Twog v1
|
||||
|
||||
$(TARGET).CFLAGS += -DACTUATORS=\"servos_4017_hw.h\" -DSERVOS_4017
|
||||
$(TARGET).srcs += $(SRC_ARCH)/servos_4017_hw.c actuators.c
|
||||
@@ -0,0 +1,13 @@
|
||||
# for lisa_l
|
||||
|
||||
$(TARGET).CFLAGS += -DACTUATORS=\"servos_direct_hw.h\" -DSERVOS_DIRECT
|
||||
$(TARGET).srcs += $(SRC_ARCH)/servos_direct_hw.c actuators.c
|
||||
|
||||
|
||||
# TODO TODO UGLY HACK: We re-use the booz actuators: Should become universal actuator code!!
|
||||
# Carefull: paths might get broken with this silly rotorcraft/fixedwing mixup of directories
|
||||
|
||||
ifeq ($(ARCH), stm32)
|
||||
$(TARGET).srcs += firmwares/rotorcraft/actuators/arch/stm32/actuators_pwm_arch.c
|
||||
$(TARGET).CFLAGS += -Ifirmwares/rotorcraft/actuators/arch/stm32
|
||||
endif
|
||||
+9
-17
@@ -1,3 +1,6 @@
|
||||
#
|
||||
# Makefile for shared radio_control ppm susbsytem
|
||||
#
|
||||
|
||||
NORADIO = False
|
||||
|
||||
@@ -7,25 +10,11 @@ ifeq ($(BOARD),classix)
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
||||
ifeq ($(ARCH),stm32)
|
||||
ap.CFLAGS += -DRADIO_CONTROL
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
ap.srcs += $(SRC_SUBSYSTEMS)/radio_control.c \
|
||||
$(SRC_SUBSYSTEMS)/radio_control/ppm.c \
|
||||
$(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
|
||||
NORADIO = True
|
||||
endif
|
||||
|
||||
ifeq ($(NORADIO), False)
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL
|
||||
ifdef RADIO_CONTROL_LED
|
||||
ap.CFLAGS += -DRADIO_CONTROL_LED=$(RADIO_CONTROL_LED)
|
||||
endif
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/ppm.h\"
|
||||
$(TARGET).CFLAGS += -DRADIO_CONTROL_TYPE_PPM
|
||||
$(TARGET).srcs += $(SRC_SUBSYSTEMS)/radio_control.c
|
||||
@@ -33,4 +22,7 @@ ifeq ($(NORADIO), False)
|
||||
ifneq ($(ARCH),jsbsim)
|
||||
$(TARGET).srcs += $(SRC_ARCH)/subsystems/radio_control/ppm_arch.c
|
||||
endif
|
||||
ifeq ($(ARCH),stm32)
|
||||
ap.CFLAGS += -DUSE_TIM2_IRQ
|
||||
endif
|
||||
endif
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
#
|
||||
# Makefile for radio_control susbsytem in fixedwing firmware
|
||||
# Makefile for shared radio_control spektrum susbsytem
|
||||
#
|
||||
ifndef RADIO_CONTROL_SPEKTRUM_MODEL
|
||||
RADIO_CONTROL_SPEKTRUM_MODEL=\"subsystems/radio_control/spektrum_dx7se.h\"
|
||||
@@ -7,7 +7,7 @@ endif
|
||||
|
||||
ap.CFLAGS += -DRADIO_CONTROL -DRADIO_CONTROL_BIND_IMPL_FUNC=radio_control_spektrum_try_bind
|
||||
ap.CFLAGS += -DRADIO_CONTROL_TYPE_H=\"subsystems/radio_control/spektrum.h\"
|
||||
ifeq ($(BOARD), booz)
|
||||
ifeq ($(ARCH), lpc21)
|
||||
ap.CFLAGS += -DRADIO_CONTROL_SPEKTRUM_MODEL_H=$(RADIO_CONTROL_SPEKTRUM_MODEL)
|
||||
endif
|
||||
ifdef RADIO_CONTROL_LED
|
||||
@@ -1,9 +1,6 @@
|
||||
<!DOCTYPE flight_plan SYSTEM "flight_plan.dtd">
|
||||
|
||||
<flight_plan alt="152" ground_alt="147" lat0="43 33 50.83" lon0="1 28 52.61" max_dist_from_home="400" name="Booz Test Enac" security_height="2">
|
||||
<header>
|
||||
#include "booz_fms.h"
|
||||
</header>
|
||||
<waypoints>
|
||||
<waypoint name="HOME" x="0.0" y="0.0"/>
|
||||
<waypoint name="CLIMB" x="0.0" y="5.0"/>
|
||||
@@ -63,15 +60,6 @@
|
||||
<block name="circle">
|
||||
<circle radius="nav_radius" wp="p1"/>
|
||||
</block>
|
||||
|
||||
<!--
|
||||
<block name="Joystick" pre_call="NavUpdateWPFromFms(WP_p1)" strip_button="Joystick" strip_icon="joystick.png">
|
||||
<set var="fms.enabled" value="TRUE"/>
|
||||
<call fun="NavSetWaypointHere(WP_p1)"/>
|
||||
<stay wp="p1"/>
|
||||
</block>
|
||||
-->
|
||||
|
||||
<block name="land here" strip_button="Land Here" strip_icon="land-right.png">
|
||||
<call fun="NavSetWaypointHere(WP_TD)"/>
|
||||
</block>
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
<event fun="baro_scp_event()"/>
|
||||
<makefile target="ap">
|
||||
<file name="baro_scp.c"/>
|
||||
<flag name="SPI_MASTER"/>
|
||||
<flag name="USE_SPI"/>
|
||||
</makefile>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -1,21 +1,42 @@
|
||||
<!DOCTYPE module SYSTEM "./module.dtd">
|
||||
|
||||
<module name="digital_cam">
|
||||
<header>
|
||||
<file name="dc.h"/>
|
||||
</header>
|
||||
<init fun="dc_init()"/>
|
||||
<periodic fun="dc_periodic()" freq="4" autorun="TRUE"/>
|
||||
<makefile>
|
||||
<raw>
|
||||
<!--
|
||||
|
||||
// Use (parts of) the following section in airframe file to change
|
||||
|
||||
<section name="DIGITAL_CAMERA" prefix="DC_">
|
||||
|
||||
<define name="PUSH" value"LED_ON" />
|
||||
<define name="RELEASE" value"LED_OFF" />
|
||||
|
||||
<define name="AUTOSHOOT_QUARTERSEC_PERIOD" value="6" unit="quarter_second"/>
|
||||
<define name="AUTOSHOOT_METER_GRID" value="50" unit="meter"/>
|
||||
</section>
|
||||
|
||||
# ap.CFLAGS += -DGPS_TRIGGERED_FUNCTION="dc_shoot_on_gps"
|
||||
# ap.CFLAGS += -DDC_GPS_TRIGGER_START=1
|
||||
# ap.CFLAGS += -DDC_GPS_TRIGGER_STOP=3
|
||||
|
||||
</raw>
|
||||
-->
|
||||
|
||||
<module name="digital_cam">
|
||||
<header>
|
||||
<file name="led_cam_ctrl.h"/>
|
||||
</header>
|
||||
|
||||
<init fun="led_cam_ctrl_init()"/>
|
||||
|
||||
<periodic fun="led_cam_ctrl_periodic()" freq="4" autorun="TRUE"/>
|
||||
|
||||
<makefile >
|
||||
|
||||
<flag name="DIGITAL_CAM" />
|
||||
<file name="led_cam_ctrl.c"/>
|
||||
<file name="dc.c"/>
|
||||
<flag name="SENSOR_SYNC_SEND" value="1" />
|
||||
|
||||
</makefile>
|
||||
|
||||
|
||||
</module>
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<!DOCTYPE module SYSTEM "module.dtd">
|
||||
|
||||
<module name="atmega_i2c_cam_ctrl" dir="digital_cam">
|
||||
<header>
|
||||
<file name="atmega_i2c_cam_ctrl.h"/>
|
||||
</header>
|
||||
|
||||
<init fun="atmega_i2c_cam_ctrl_init()"/>
|
||||
<periodic fun="atmega_i2c_cam_ctrl_periodic()" autorun="TRUE" freq="4" />
|
||||
<event fun="atmega_i2c_cam_ctrl_event()"/>
|
||||
|
||||
<datalink message="PAYLOAD_COMMAND" fun="ParseCameraCommand()" />
|
||||
|
||||
<makefile target="ap">
|
||||
<file name="atmega_i2c_cam_ctrl.c"/>
|
||||
<file name="dc.c"/>
|
||||
<flag name="ATMEGA_I2C_DEVICE" value="i2c0"/>
|
||||
<flag name="USE_I2C0" value="1"/>
|
||||
<flag name="SENSOR_SYNC_SEND" value="1" />
|
||||
</makefile>
|
||||
|
||||
<makefile target="sim">
|
||||
<file name="sim_i2c_cam_ctrl.c"/>
|
||||
<file name="dc.c"/>
|
||||
<flag name="SENSOR_SYNC_SEND" value="1" />
|
||||
</makefile>
|
||||
|
||||
</module>
|
||||
|
||||
+16
-13
@@ -1,21 +1,24 @@
|
||||
<!DOCTYPE settings SYSTEM "settings.dtd">
|
||||
|
||||
<settings>
|
||||
<dl_settings>
|
||||
<dl_settings NAME="DC">
|
||||
<dl_setting MAX="1" MIN="1" STEP="1" VAR="dc_timer" module="digital_cam/dc" handler="Shutter" shortname="Shutter">
|
||||
<strip_button name="Photo" icon="digital-camera.png" value="1"/>
|
||||
</dl_setting>
|
||||
<dl_setting MAX="1" MIN="1" STEP="1" VAR="dc_timer" handler="Zoom" shortname="Zoom">
|
||||
<strip_button name="Zoom" icon="zoom.png" value="1"/>
|
||||
</dl_setting>
|
||||
<dl_setting MAX="60" MIN="0" STEP="1" VAR="dc_periodic_shutter" handler="Periodic" shortname="Periodic"/>
|
||||
<dl_setting MAX="5" MIN="0" STEP="1" VAR="dc_utm_threshold" shortname="UTM%"/>
|
||||
<dl_settings name="control">
|
||||
<dl_settings name="dc">
|
||||
|
||||
<dl_setting MAX="1" MIN="0" STEP="1" VAR="dc_shoot" >
|
||||
<strip_button name="Start Autoshoot" icon="on.png" value="1"/>
|
||||
<strip_button name="Stop Autoshoot" icon="off.png" value="0"/>
|
||||
<dl_setting max="255" min="0" step="1" module="digital_cam/dc" var="0" handler="send_command" shortname="Shutter">
|
||||
<strip_button name="Photo" icon="digital-camera.png" value="32" group="maindc"/>
|
||||
<strip_button name="Power" icon="off.png" value="111" group="maindc"/>
|
||||
<strip_button name="ZoomIn" icon="zoom.png" value="116" group="dczoom"/>
|
||||
<strip_button name="ZoomOut" icon="zoom.png" value="119" group="dczoom"/>
|
||||
</dl_setting>
|
||||
|
||||
<dl_setting max="3" min="0" step="1" var="dc_autoshoot" >
|
||||
<strip_button name="Start Autoshoot" icon="on.png" value="1" group="dcauto"/>
|
||||
<strip_button name="Stop Autoshoot" icon="off.png" value="0" group="dcauto"/>
|
||||
</dl_setting>
|
||||
|
||||
<dl_setting max="255" min="1" step="1" var="dc_autoshoot_quartersec_period" handler="Periodic" shortname="Periodic" param="DC_AUTOSHOOT_QUARTERSEC_PERIOD" unit="quarter-sec"/>
|
||||
<dl_setting max="5" min="0" step="1" var="dc_autoshoot_meter_grid" shortname="UTM%" param="DC_AUTOSHOOT_METER_GRID" unit="meter"/>
|
||||
|
||||
</dl_settings>
|
||||
</dl_settings>
|
||||
</settings>
|
||||
|
||||
@@ -5,7 +5,7 @@ PKG_NAME = target
|
||||
DATE = $$(date +%Y%m%d)
|
||||
|
||||
# Tool definitions
|
||||
HAVE_ARM_NONE_EABI_GCC := $(wildcard /usr/bin/arm-none-eabi-gcc)
|
||||
HAVE_ARM_NONE_EABI_GCC := $(shell which arm-none-eabi-gcc)
|
||||
|
||||
ifeq ($(strip $(HAVE_ARM_NONE_EABI_GCC)),)
|
||||
CC = arm-elf-gcc
|
||||
|
||||
@@ -73,27 +73,27 @@ extern const int16_t rc_spk_throw[RADIO_CONTROL_NB_CHANNEL];
|
||||
rc_spk_parser_idx++; \
|
||||
if (rc_spk_parser_idx >= 2*RADIO_CONTROL_NB_CHANNEL) { \
|
||||
rc_spk_parser_status = RC_SPK_STA_UNINIT; \
|
||||
radio_control.frame_cpt++; \
|
||||
radio_control.time_since_last_frame = 0; \
|
||||
radio_control.status = RC_OK; \
|
||||
uint8_t i; \
|
||||
for (i=0;i<RADIO_CONTROL_NB_CHANNEL;i++) { \
|
||||
const int16_t tmp = (rc_spk_parser_buf[2*i]<<8) + \
|
||||
rc_spk_parser_buf[2*i+1]; \
|
||||
/*const int16_t chan = (tmp&0xFC00) >> 10;*/ \
|
||||
const int16_t val = (tmp&0x03FF) - 512; \
|
||||
radio_control.values[i] = val; \
|
||||
radio_control.values[i] *= rc_spk_throw[i]; \
|
||||
if (i==RADIO_CONTROL_THROTTLE) { \
|
||||
radio_control.values[i] += MAX_PPRZ; \
|
||||
radio_control.values[i] /= 2; \
|
||||
} \
|
||||
} \
|
||||
_received_frame_handler(); \
|
||||
radio_control.frame_cpt++; \
|
||||
radio_control.time_since_last_frame = 0; \
|
||||
radio_control.status = RC_OK; \
|
||||
uint8_t i; \
|
||||
for (i=0;i<RADIO_CONTROL_NB_CHANNEL;i++) { \
|
||||
const int16_t tmp = (rc_spk_parser_buf[2*i]<<8) + \
|
||||
rc_spk_parser_buf[2*i+1]; \
|
||||
/*const int16_t chan = (tmp&0xFC00) >> 10;*/ \
|
||||
const int16_t val = (tmp&0x03FF) - 512; \
|
||||
radio_control.values[i] = val; \
|
||||
radio_control.values[i] *= rc_spk_throw[i]; \
|
||||
if (i==RADIO_CONTROL_THROTTLE) { \
|
||||
radio_control.values[i] += MAX_PPRZ; \
|
||||
radio_control.values[i] /= 2; \
|
||||
} \
|
||||
} \
|
||||
_received_frame_handler(); \
|
||||
} \
|
||||
break; \
|
||||
default: \
|
||||
rc_spk_parser_status = RC_SPK_STA_UNINIT; \
|
||||
default: \
|
||||
rc_spk_parser_status = RC_SPK_STA_UNINIT; \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
@@ -39,6 +39,10 @@
|
||||
#include "traffic_info.h"
|
||||
#endif // TRAFFIC_INFO
|
||||
|
||||
#if defined NAV || defined WIND_INFO
|
||||
#include "estimator.h"
|
||||
#endif
|
||||
|
||||
#ifdef USE_JOYSTICK
|
||||
#include "joystick.h"
|
||||
#endif
|
||||
@@ -52,7 +56,7 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "common_nav.h"
|
||||
#include "nav.h"
|
||||
#include "generated/settings.h"
|
||||
#include "latlong.h"
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include "estimator.h"
|
||||
#include "nav.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "autopilot.h"
|
||||
#include "firmwares/fixedwing/autopilot.h"
|
||||
|
||||
/* mode */
|
||||
uint8_t v_ctl_mode;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include "gyro.h"
|
||||
#include "ap_downlink.h"
|
||||
#include "nav.h"
|
||||
#include "autopilot.h"
|
||||
#include "firmwares/fixedwing/autopilot.h"
|
||||
#include "estimator.h"
|
||||
#include "generated/settings.h"
|
||||
#include "link_mcu.h"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
#include "firmwares/fixedwing/actuators.h"
|
||||
#include "subsystems/radio_control.h"
|
||||
#include "fbw_downlink.h"
|
||||
#include "autopilot.h"
|
||||
#include "firmwares/fixedwing/autopilot.h"
|
||||
#include "paparazzi.h"
|
||||
#include "estimator.h"
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "nav.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "firmwares/fixedwing/guidance/guidance_v.h"
|
||||
#include "autopilot.h"
|
||||
#include "firmwares/fixedwing/autopilot.h"
|
||||
|
||||
|
||||
/* outer loop parameters */
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "std.h"
|
||||
#include "firmwares/fixedwing/stabilization/stabilization_attitude.h"
|
||||
#include "autopilot.h"
|
||||
|
||||
extern uint8_t joystick_block;
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
#include "max1167.h"
|
||||
|
||||
|
||||
volatile uint8_t max1167_status;
|
||||
uint16_t max1167_values[MAX1167_NB_CHAN];
|
||||
|
||||
extern void max1167_init( void ) {
|
||||
max1167_hw_init();
|
||||
|
||||
uint8_t i;
|
||||
for (i=0; i<MAX1167_NB_CHAN; i++)
|
||||
max1167_values[i] = 0;
|
||||
|
||||
max1167_status = STA_MAX1167_IDLE;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
#ifndef MAX1167_H
|
||||
#define MAX1167_H
|
||||
|
||||
#include "std.h"
|
||||
|
||||
#define MAX1167_NB_CHAN 4
|
||||
|
||||
extern void max1167_init( void );
|
||||
extern void max1167_read( void );
|
||||
|
||||
#define STA_MAX1167_IDLE 0
|
||||
#define STA_MAX1167_SENDING_REQ 1
|
||||
#define STA_MAX1167_READING_RES 2
|
||||
#define STA_MAX1167_DATA_AVAILABLE 3
|
||||
extern volatile uint8_t max1167_status;
|
||||
|
||||
extern uint16_t max1167_values[MAX1167_NB_CHAN];
|
||||
|
||||
|
||||
extern void max1167_hw_init( void );
|
||||
|
||||
#include "max1167_hw.h"
|
||||
|
||||
#endif /* MAX1167_H */
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/** \file atmega_i2c_cam_ctrl.c
|
||||
* \brief Interface with digital camera though AVR AtMega chip
|
||||
*
|
||||
* Send Commands over I2C
|
||||
*/
|
||||
|
||||
|
||||
#include "atmega_i2c_cam_ctrl.h"
|
||||
|
||||
#include "i2c.h"
|
||||
#include "led.h"
|
||||
|
||||
#ifndef DOWNLINK_DEVICE
|
||||
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
|
||||
#endif
|
||||
#include "uart.h"
|
||||
#include "messages.h"
|
||||
#include "downlink.h"
|
||||
#include "estimator.h"
|
||||
|
||||
|
||||
static struct i2c_transaction atmega_i2c_cam_ctrl_trans;
|
||||
|
||||
#ifndef ATMEGA_I2C_DEV
|
||||
#define ATMEGA_I2C_DEV i2c0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef ATMEGA_SLAVE_ADDR
|
||||
#define ATMEGA_SLAVE_ADDR 0x68
|
||||
#endif
|
||||
|
||||
uint8_t atmega_i2c_cam_ctrl_just_sent_command = 0;
|
||||
|
||||
void atmega_i2c_cam_ctrl_init(void)
|
||||
{
|
||||
atmega_i2c_cam_ctrl_trans.status = I2CTransDone;
|
||||
dc_init();
|
||||
}
|
||||
|
||||
void atmega_i2c_cam_ctrl_periodic (void)
|
||||
{
|
||||
atmega_i2c_cam_ctrl_just_sent_command = 0;
|
||||
dc_periodic_4Hz();
|
||||
|
||||
// Request Status
|
||||
if (atmega_i2c_cam_ctrl_just_sent_command == 0)
|
||||
{
|
||||
atmega_i2c_cam_ctrl_send(DC_GET_STATUS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void atmega_i2c_cam_ctrl_send(uint8_t cmd)
|
||||
{
|
||||
atmega_i2c_cam_ctrl_just_sent_command = 1;
|
||||
|
||||
// Send Command
|
||||
atmega_i2c_cam_ctrl_trans.buf[0] = cmd;
|
||||
I2CTransceive(ATMEGA_I2C_DEV, atmega_i2c_cam_ctrl_trans, ATMEGA_SLAVE_ADDR, 1, 1);
|
||||
|
||||
if (cmd == DC_SHOOT)
|
||||
{
|
||||
dc_send_shot_position();
|
||||
}
|
||||
}
|
||||
|
||||
void atmega_i2c_cam_ctrl_event( void )
|
||||
{
|
||||
if (atmega_i2c_cam_ctrl_trans.status == I2CTransSuccess)
|
||||
{
|
||||
unsigned char cam_ret[1];
|
||||
cam_ret[0] = atmega_i2c_cam_ctrl_trans.buf[0];
|
||||
RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, 1, cam_ret ));
|
||||
atmega_i2c_cam_ctrl_trans.status = I2CTransDone;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ATMEGA_I2C_CAM_CTRL_H
|
||||
#define ATMEGA_I2C_CAM_CTRL_H
|
||||
|
||||
// Include Standard Camera Control Interface
|
||||
#include "dc.h"
|
||||
|
||||
|
||||
void atmega_i2c_cam_ctrl_init(void);
|
||||
void atmega_i2c_cam_ctrl_periodic(void);
|
||||
void atmega_i2c_cam_ctrl_event(void);
|
||||
void atmega_i2c_cam_ctrl_send(uint8_t cmd);
|
||||
|
||||
// In I2C mode we can not inline this function:
|
||||
static inline void dc_send_command(uint8_t cmd)
|
||||
{
|
||||
atmega_i2c_cam_ctrl_send(cmd);
|
||||
}
|
||||
|
||||
// Allow commands to be set by datalink
|
||||
#define ParseCameraCommand() { \
|
||||
{ \
|
||||
if ( DL_PAYLOAD_COMMAND_command_length(dl_buffer) == 1){ \
|
||||
dc_send_command(DL_PAYLOAD_COMMAND_command(dl_buffer)[0]); \
|
||||
} \
|
||||
} \
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,37 +1,91 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "dc.h"
|
||||
|
||||
uint8_t dc_timer;
|
||||
uint8_t dc_periodic_shutter;
|
||||
uint8_t dc_shutter_timer;
|
||||
uint8_t dc_utm_threshold;
|
||||
// Variables with boot defaults
|
||||
uint8_t dc_autoshoot_meter_grid = 100;
|
||||
uint8_t dc_autoshoot_quartersec_period = 2;
|
||||
dc_autoshoot_type dc_autoshoot = DC_AUTOSHOOT_STOP;
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SENSOR_SYNC_SEND
|
||||
|
||||
uint16_t dc_photo_nr = 0;
|
||||
|
||||
uint8_t dc_shoot = 0;
|
||||
|
||||
|
||||
#ifndef DOWNLINK_DEVICE
|
||||
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
|
||||
#endif
|
||||
#include "uart.h"
|
||||
#include "messages.h"
|
||||
#include "downlink.h"
|
||||
#include "estimator.h"
|
||||
|
||||
void dc_send_shot_position(void)
|
||||
{
|
||||
int16_t phi = DegOfRad(estimator_phi*10.0f);
|
||||
int16_t theta = DegOfRad(estimator_theta*10.0f);
|
||||
float gps_z = ((float)gps_alt) / 100.0f;
|
||||
DOWNLINK_SEND_DC_SHOT(DefaultChannel, &dc_photo_nr, &gps_utm_east, &gps_utm_north, &gps_z, &gps_utm_zone, &phi, &theta, &gps_course, &gps_gspeed, &gps_itow);
|
||||
dc_photo_nr++;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
void dc_send_shot_position(void)
|
||||
{
|
||||
int16_t phi = DegOfRad(estimator_phi*10.0f);
|
||||
int16_t theta = DegOfRad(estimator_theta*10.0f);
|
||||
float gps_z = ((float)gps_alt) / 100.0f;
|
||||
DOWNLINK_SEND_DC_SHOT(DefaultChannel, &dc_photo_nr, &gps_utm_east, &gps_utm_north, &gps_z, &gps_utm_zone, &phi, &theta, &gps_course, &gps_gspeed, &gps_itow);
|
||||
dc_photo_nr++;
|
||||
}
|
||||
|
||||
uint8_t dc_shutter( void )
|
||||
{
|
||||
dc_timer = SHUTTER_DELAY;
|
||||
DC_PUSH(DC_SHUTTER_LED);
|
||||
dc_send_shot_position();
|
||||
|
||||
return 0;
|
||||
|
||||
/*
|
||||
#ifndef DC_GPS_TRIGGER_START
|
||||
#define DC_GPS_TRIGGER_START 1
|
||||
#endif
|
||||
#ifndef DC_GPS_TRIGGER_STOP
|
||||
#define DC_GPS_TRIGGER_STOP 3
|
||||
#endif
|
||||
|
||||
|
||||
static inline void dc_shoot_on_gps( void ) {
|
||||
static uint8_t gps_msg_counter = 0;
|
||||
|
||||
if (dc_shoot > 0)
|
||||
{
|
||||
|
||||
if (gps_msg_counter == 0)
|
||||
{
|
||||
DC_PUSH(DC_SHUTTER_LED);
|
||||
|
||||
dc_send_shot_position();
|
||||
}
|
||||
else if (gps_msg_counter == DC_GPS_TRIGGER_START)
|
||||
{
|
||||
DC_RELEASE(DC_SHUTTER_LED);
|
||||
}
|
||||
|
||||
gps_msg_counter++;
|
||||
if (gps_msg_counter >= DC_GPS_TRIGGER_STOP)
|
||||
gps_msg_counter = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
/*
|
||||
* Paparazzi $Id$
|
||||
*
|
||||
* Copyright (C) 2003-2008 Pascal Brisset, Antoine Drouin
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
@@ -22,29 +20,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/** \file dc.h
|
||||
* \brief Digital Camera Control
|
||||
* \brief Standard Digital Camera Control Interface
|
||||
*
|
||||
* Provides the control of the shutter and the zoom of a digital camera
|
||||
* through standard binary IOs of the board.
|
||||
* -Standard IO
|
||||
* -I2C Control
|
||||
*
|
||||
* Configuration:
|
||||
* Since the API of led.h is used, connected pins must be defined as led
|
||||
* numbers (usually in the airframe file):
|
||||
* <define name="DC_SHUTTER_LED" value="6"/>
|
||||
* <define name="DC_ZOOM_LED" value="7"/>
|
||||
* Related bank and pin must also be defined:
|
||||
* <define name="LED_6_BANK" value="0"/>
|
||||
* <define name="LED_6_PIN" value="2"/>
|
||||
* The required initialization (dc_init()) and periodic (4Hz) process
|
||||
* (dc_periodic()) are called if the DIGITAL_CAM flag is set:
|
||||
* ap.CFLAGS += -DDIGITAL_CAM
|
||||
*
|
||||
* Usage (from the flight plan, the settings or any airborne code):
|
||||
* - dc_Shutter(_) sets the DC_SHUTTER_LED pin output to 1 for 0.5s and sends
|
||||
* a DC_SHOT message
|
||||
* - dc_Zoom(_) sets the DC_ZOOM_LED pin output to 1 for 0.5s
|
||||
* - dc_Periodic(s) activates a periodic call to dc_Shutter() every s seconds
|
||||
* Usage: (from the flight plan, the settings or any airborne code):
|
||||
* - dc_send_command( )
|
||||
* - set the appropriate autoshoot mode (off/time/distance/trigger)
|
||||
* - use the module periodic function to set the autorepeat interval
|
||||
* - define SENSOR_SYNC_SEND to get the DC_SHOT_MESSAGE on every SHOOT command
|
||||
*/
|
||||
|
||||
#ifndef DC_H
|
||||
@@ -53,124 +40,111 @@
|
||||
#include "std.h"
|
||||
#include "led.h"
|
||||
#include "generated/airframe.h"
|
||||
#include "estimator.h"
|
||||
#include "gps.h"
|
||||
|
||||
|
||||
extern uint8_t dc_timer;
|
||||
/* Generic Set of Digital Camera Commands */
|
||||
typedef enum {
|
||||
DC_GET_STATUS = 0,
|
||||
|
||||
extern uint8_t dc_periodic_shutter;
|
||||
/* In s. If non zero, period of automatic calls to dc_shutter() */
|
||||
extern uint8_t dc_shutter_timer;
|
||||
/* In s. Related counter */
|
||||
DC_HOLD = 13,
|
||||
DC_SHOOT = 32,
|
||||
|
||||
extern uint8_t dc_utm_threshold;
|
||||
/* In m. If non zero, automatic shots when greater than utm_north % 100 */
|
||||
DC_WIDER = 'w',
|
||||
DC_TALLER = 't',
|
||||
|
||||
/* Picture Number starting from zero */
|
||||
extern uint16_t dc_photo_nr;
|
||||
extern uint8_t dc_shoot;
|
||||
DC_UP = 'u',
|
||||
DC_DOWN = 'd',
|
||||
DC_CENTER = 'c',
|
||||
DC_LEFT = 'l',
|
||||
DC_RIGHT = 'r',
|
||||
|
||||
#ifndef DC_PUSH
|
||||
#define DC_PUSH LED_ON
|
||||
#endif
|
||||
DC_MENU = 'm',
|
||||
DC_HOME = 'h',
|
||||
DC_PLAY = 'p',
|
||||
|
||||
#ifndef DC_RELEASE
|
||||
#define DC_RELEASE LED_OFF
|
||||
#endif
|
||||
DC_ON = 'O',
|
||||
DC_OFF = 'o',
|
||||
|
||||
#define SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
|
||||
} dc_command_type;
|
||||
|
||||
uint8_t dc_shutter( void );
|
||||
/* Send Command To Camera */
|
||||
static inline void dc_send_command(uint8_t cmd);
|
||||
|
||||
static inline uint8_t dc_zoom( void ) {
|
||||
dc_timer = SHUTTER_DELAY;
|
||||
#ifdef DC_ZOOM_LED
|
||||
DC_PUSH(DC_ZOOM_LED);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
/* Auotmatic Digital Camera Photo Triggering */
|
||||
typedef enum {
|
||||
DC_AUTOSHOOT_STOP = 0,
|
||||
DC_AUTOSHOOT_PERIODIC = 1,
|
||||
DC_AUTOSHOOT_DISTANCE = 2,
|
||||
DC_AUTOSHOOT_EXT_TRIG = 3
|
||||
} dc_autoshoot_type;
|
||||
extern dc_autoshoot_type dc_autoshoot;
|
||||
|
||||
#define dc_Shutter(_) ({ dc_shutter(); 0; })
|
||||
#define dc_Zoom(_) ({ dc_zoom(); 0; })
|
||||
#define dc_Periodic(s) ({ dc_periodic_shutter = s; dc_shutter_timer = s; 0; })
|
||||
/* AutoShoot photos every X quarter_second */
|
||||
extern uint8_t dc_autoshoot_quartersec_period;
|
||||
|
||||
#ifndef DC_PERIODIC_SHUTTER
|
||||
#define DC_PERIODIC_SHUTTER 0
|
||||
#endif
|
||||
|
||||
#define dc_init() { /* initialized as leds */ dc_periodic_shutter = DC_PERIODIC_SHUTTER; DC_PUSH(DC_SHUTTER_LED);} /* Output */
|
||||
|
||||
|
||||
#ifndef DC_GPS_TRIGGER_START
|
||||
#define DC_GPS_TRIGGER_START 1
|
||||
#endif
|
||||
#ifndef DC_GPS_TRIGGER_STOP
|
||||
#define DC_GPS_TRIGGER_STOP 3
|
||||
#endif
|
||||
/* AutoShoot photos on a X meter Local Tangent Plane Grid */
|
||||
extern uint8_t dc_autoshoot_meter_grid;
|
||||
|
||||
/* Send Down the coordinates of where the photo was taken */
|
||||
#ifdef SENSOR_SYNC_SEND
|
||||
void dc_send_shot_position(void);
|
||||
|
||||
static inline void dc_shoot_on_gps( void ) {
|
||||
static uint8_t gps_msg_counter = 0;
|
||||
|
||||
if (dc_shoot > 0)
|
||||
{
|
||||
|
||||
if (gps_msg_counter == 0)
|
||||
{
|
||||
DC_PUSH(DC_SHUTTER_LED);
|
||||
|
||||
dc_send_shot_position();
|
||||
}
|
||||
else if (gps_msg_counter == DC_GPS_TRIGGER_START)
|
||||
{
|
||||
DC_RELEASE(DC_SHUTTER_LED);
|
||||
}
|
||||
|
||||
gps_msg_counter++;
|
||||
if (gps_msg_counter >= DC_GPS_TRIGGER_STOP)
|
||||
gps_msg_counter = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* 4Hz */
|
||||
static inline void dc_periodic( void ) {
|
||||
if (dc_timer) {
|
||||
dc_timer--;
|
||||
} else {
|
||||
DC_RELEASE(DC_SHUTTER_LED);
|
||||
#ifdef DC_ZOOM_LED
|
||||
DC_RELEASE(DC_ZOOM_LED);
|
||||
#else
|
||||
#define dc_send_shot_position() {}
|
||||
#endif
|
||||
}
|
||||
|
||||
if (dc_shoot > 0)
|
||||
/******************************************************************
|
||||
* FUNCTIONS
|
||||
*****************************************************************/
|
||||
|
||||
/* get settings */
|
||||
static inline void dc_init(void)
|
||||
{
|
||||
#ifdef DC_AUTOSHOOT_QUARTERSEC_PERIOD
|
||||
dc_autoshoot_quartersec_period = DC_AUTOSHOOT_QUARTERSEC_PERIOD;
|
||||
#endif
|
||||
#ifdef DC_AUTOSHOOT_METER_GRID
|
||||
dc_autoshoot_meter_grid = DC_AUTOSHOOT_METER_GRID;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* shoot on grid */
|
||||
static inline void dc_shot_on_utm_north_close_to_100m_grid( void )
|
||||
{
|
||||
uint32_t dist_to_100m_grid = (gps_utm_north / 100) % 100;
|
||||
if (dist_to_100m_grid < dc_autoshoot_meter_grid || 100 - dist_to_100m_grid < dc_autoshoot_meter_grid)
|
||||
{
|
||||
if (dc_periodic_shutter) {
|
||||
RunOnceEvery(2,
|
||||
{
|
||||
if (dc_shutter_timer) {
|
||||
dc_shutter_timer--;
|
||||
} else {
|
||||
dc_shutter();
|
||||
dc_shutter_timer = dc_periodic_shutter;
|
||||
}
|
||||
});
|
||||
dc_send_command(DC_SHOOT);
|
||||
}
|
||||
}
|
||||
|
||||
/* periodic 4Hz function */
|
||||
static inline void dc_periodic_4Hz( void )
|
||||
{
|
||||
static uint8_t dc_shutter_timer = 0;
|
||||
|
||||
#ifdef DC_AUTOSHOOT_QUARTERSEC_PERIOD
|
||||
if (dc_autoshoot == DC_AUTOSHOOT_PERIODIC)
|
||||
{
|
||||
if (dc_shutter_timer)
|
||||
{
|
||||
dc_shutter_timer--;
|
||||
} else {
|
||||
dc_send_command(DC_SHOOT);
|
||||
dc_shutter_timer = dc_autoshoot_quartersec_period;
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#ifdef DC_AUTOSHOOT_METER_GRID
|
||||
if (dc_autoshoot == DC_AUTOSHOOT_DISTANCE)
|
||||
{
|
||||
dc_shutter_timer = 0;
|
||||
// Shoot
|
||||
dc_shot_on_utm_north_close_to_100m_grid();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void dc_shot_on_utm_north_close_to_100m_grid( void ) {
|
||||
if (dc_utm_threshold && !dc_timer) {
|
||||
uint32_t dist_to_100m_grid = (gps_utm_north / 100) % 100;
|
||||
if (dist_to_100m_grid < dc_utm_threshold || 100 - dist_to_100m_grid < dc_utm_threshold)
|
||||
dc_shutter();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif // DC_H
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "led_cam_ctrl.h"
|
||||
|
||||
// Include Digital IO
|
||||
#include "led.h"
|
||||
|
||||
// Button Timer
|
||||
uint8_t dc_timer;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/** \file led_cam_ctrl.h
|
||||
* \brief Digital Camera Control
|
||||
*
|
||||
* Provides the control of the shutter and the zoom of a digital camera
|
||||
* through standard binary IOs of the board.
|
||||
*
|
||||
* Configuration:
|
||||
* Since the API of led.h is used, connected pins must be defined as led
|
||||
* numbers (usually in the airframe file):
|
||||
* <define name="DC_SHUTTER_LED" value="6"/>
|
||||
* <define name="DC_ZOOM_IN_LED" value="7"/>
|
||||
* <define name="DC_ZOOM_OUT_LED" value="8"/>
|
||||
* <define name="DC_POWER_LED" value="9"/>
|
||||
* Related bank and pin must also be defined:
|
||||
* <define name="LED_6_BANK" value="0"/>
|
||||
* <define name="LED_6_PIN" value="2"/>
|
||||
* The required initialization (dc_init()) and periodic (4Hz) process
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LED_CAM_CTRL_H
|
||||
#define LED_CAM_CTRL_H
|
||||
|
||||
// Include Standard Camera Control Interface
|
||||
#include "dc.h"
|
||||
|
||||
extern uint8_t dc_timer;
|
||||
|
||||
static inline void led_cam_ctrl_init(void)
|
||||
{
|
||||
// Call common DC init
|
||||
dc_init();
|
||||
|
||||
// Do LED specific DC init
|
||||
dc_timer = 0;
|
||||
}
|
||||
|
||||
#ifndef DC_PUSH
|
||||
#define DC_PUSH LED_ON
|
||||
#endif
|
||||
|
||||
#ifndef DC_RELEASE
|
||||
#define DC_RELEASE LED_OFF
|
||||
#endif
|
||||
|
||||
#ifndef SHUTTER_DELAY
|
||||
#define SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
|
||||
#endif
|
||||
|
||||
#ifndef DC_SHUTTER_LED
|
||||
#error DC: Please specify at least a SHUTTER LED
|
||||
#endif
|
||||
|
||||
/* Command The Camera */
|
||||
static inline void dc_send_command(uint8_t cmd)
|
||||
{
|
||||
dc_timer = SHUTTER_DELAY;
|
||||
switch (cmd)
|
||||
{
|
||||
case DC_SHOOT:
|
||||
DC_PUSH(DC_SHUTTER_LED);
|
||||
dc_send_shot_position();
|
||||
break;
|
||||
#ifdef DC_ZOOM_IN_LED
|
||||
case DC_ZOOM_IN:
|
||||
DC_PUSH(DC_ZOOM_IN_LED);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DC_ZOOM_OUT_LED
|
||||
case DC_ZOOM_OUT:
|
||||
DC_PUSH(DC_ZOOM_OUT_LED);
|
||||
break;
|
||||
#endif
|
||||
#ifdef DC_POWER_LED
|
||||
case DC_POWER:
|
||||
DC_PUSH(DC_POWER_LED);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* 4Hz Periodic */
|
||||
static inline void led_cam_ctrl_periodic( void )
|
||||
{
|
||||
if (dc_timer) {
|
||||
dc_timer--;
|
||||
} else {
|
||||
DC_RELEASE(DC_SHUTTER_LED);
|
||||
#ifdef DC_ZOOM_IN_LED
|
||||
DC_RELEASE(DC_ZOOM_IN_LED);
|
||||
#endif
|
||||
#ifdef DC_ZOOM_OUT_LED
|
||||
DC_RELEASE(DC_ZOOM_OUT_LED);
|
||||
#endif
|
||||
#ifdef DC_POWER_LED
|
||||
DC_RELEASE(DC_POWER_LED);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Common DC Periodic task
|
||||
dc_periodic_4Hz();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // DC_H
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2010 The Paparazzi Team
|
||||
*
|
||||
* This file is part of paparazzi.
|
||||
*
|
||||
* paparazzi is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* paparazzi 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with paparazzi; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/** \file sim_i2c_cam_ctrl.c
|
||||
* \brief Simulated Interface with digital camera
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include "atmega_i2c_cam_ctrl.h"
|
||||
|
||||
|
||||
#ifndef DOWNLINK_DEVICE
|
||||
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
|
||||
#endif
|
||||
#include "uart.h"
|
||||
#include "messages.h"
|
||||
#include "downlink.h"
|
||||
#include "estimator.h"
|
||||
|
||||
|
||||
void atmega_i2c_cam_ctrl_init(void)
|
||||
{
|
||||
dc_init();
|
||||
}
|
||||
|
||||
void atmega_i2c_cam_ctrl_periodic (void)
|
||||
{
|
||||
dc_periodic_4Hz();
|
||||
|
||||
// Request Status
|
||||
dc_send_command(DC_GET_STATUS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void atmega_i2c_cam_ctrl_send(uint8_t cmd)
|
||||
{
|
||||
static uint8_t zoom = 0;
|
||||
static uint8_t mode = 0;
|
||||
unsigned char cam_ret[1];
|
||||
|
||||
if (cmd == DC_SHOOT)
|
||||
{
|
||||
dc_send_shot_position();
|
||||
}
|
||||
else if (cmd == DC_TALLER)
|
||||
{
|
||||
zoom = 1;
|
||||
}
|
||||
else if (cmd == DC_WIDER)
|
||||
{
|
||||
zoom = 0;
|
||||
}
|
||||
else if (cmd == DC_GET_STATUS)
|
||||
{
|
||||
mode++;
|
||||
if (mode > 15)
|
||||
mode = 0;
|
||||
}
|
||||
|
||||
cam_ret[0] = mode + zoom * 0x20;
|
||||
RunOnceEvery(6,DOWNLINK_SEND_PAYLOAD(DefaultChannel, 1, cam_ret ));
|
||||
|
||||
}
|
||||
|
||||
void atmega_i2c_cam_ctrl_event( void )
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
#ifndef RADIO_CONTROL_SPEKTRUM_DX7SE_H
|
||||
#define RADIO_CONTROL_SPEKTRUM_DX7SE_H
|
||||
|
||||
#define RADIO_NB_CHANNEL 7
|
||||
#define RADIO_CONTROL_NB_CHANNEL 7
|
||||
|
||||
#define RADIO_ROLL 0
|
||||
#define RADIO_THROTTLE 1
|
||||
#define RADIO_PITCH 2
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user