Merge branch 'dev' into imu_analog_gyro

This commit is contained in:
Felix Ruess
2011-11-18 01:17:20 +01:00
69 changed files with 2076 additions and 752 deletions
+4 -1
View File
@@ -65,6 +65,8 @@
# /sw/ground_segment/lpc21iap/
/sw/ground_segment/lpc21iap/lpc21iap
/sw/ground_segment/misc/ivy2serial
# /sw/ground_segment/multimon/
/sw/ground_segment/multimon/costabf.c
/sw/ground_segment/multimon/mkcostab
@@ -82,8 +84,9 @@
/sw/ground_segment/tmtc/ivy2udp
/sw/ground_segment/tmtc/server
/sw/ground_segment/tmtc/diadec
/sw/ground_segment/misc/ivy2serial
/sw/ground_segment/tmtc/ivy_serial_bridge
/sw/ground_segment/tmtc/GSM/SMS_GS
/sw/ground_segment/tmtc/gpsd2ivy
# /sw/ground_segment/joystick
/sw/ground_segment/joystick/input2ivy
+8 -2
View File
@@ -50,7 +50,6 @@ OBJCOPY = $(GCC_BIN_PREFIX)-objcopy
OBJDUMP = $(GCC_BIN_PREFIX)-objdump
NM = $(GCC_BIN_PREFIX)-nm
SIZE = $(GCC_BIN_PREFIX)-size
OOCD = $(TOOLCHAIN_DIR)/bin/openocd
#
# If we can't find the toolchain (in /opt/paparazzi/arm-multilib or ~/sat) then try picking up the compilers from the path
@@ -72,7 +71,15 @@ OBJCOPY = $(shell which $(GCC_PREFIX)-objcopy)
OBJDUMP = $(shell which $(GCC_PREFIX)-objdump)
NM = $(shell which $(GCC_PREFIX)-nm)
SIZE = $(shell which $(GCC_PREFIX)-size)
endif
#first try to find OpenOCD in the path
OOCD = $(shell which openocd)
#if OpenOCD could not be found in the path, try the toolchain dir
ifeq ($(OOCD),)
ifneq ($(TOOLCHAIN),)
OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi)
endif
endif
# Define some other programs and commands.
@@ -182,7 +189,6 @@ LPC21IAP = $(PAPARAZZI_SRC)/sw/ground_segment/lpc21iap/lpc21iap
# ---------------------------------------------------------------------------
# Flash-Programming support using openocd
OOCD = openocd
OOCD_INTERFACE = arm-usb-ocd
OOCD_TARGET = csc
+12 -4
View File
@@ -53,7 +53,6 @@ DMP = $(GCC_BIN_PREFIX)-objdump
NM = $(GCC_BIN_PREFIX)-nm
SIZE = $(GCC_BIN_PREFIX)-size
RM = rm
OOCD = $(TOOLCHAIN_DIR)/bin/openocd
# If we can't find the toolchain then try picking up the compilers from the path
else
@@ -63,10 +62,19 @@ CP = $(shell which arm-none-eabi-objcopy)
DMP = $(shell which arm-none-eabi-objdump)
NM = $(shell which arm-none-eabi-nm)
SIZE = $(shell which arm-none-eabi-size)
OOCD = $(shell which openocd)
GCC_LIB_DIR=$(shell dirname `which arm-none-eabi-gcc`)/../arm-none-eabi/lib
endif
#first try to find OpenOCD in the path
OOCD = $(shell which openocd)
#if OpenOCD could not be found in the path, try the toolchain dir
ifeq ($(OOCD),)
ifneq ($(TOOLCHAIN),)
OOCD = $(shell if test -e $(TOOLCHAIN_DIR)/bin/openocd ; then echo $(TOOLCHAIN_DIR)/bin/openocd ; else echo "Warning: OpenOCD not found"; fi)
endif
endif
LOADER=/home/poine/work/stm32/stm32loader-a3c51c26ad6c/stm32loader.py
ifndef $(TARGET).OOCD_INTERFACE
@@ -162,9 +170,9 @@ printcommands:
@echo "Using SIZE = $(SIZE)"
@echo "Using OOCD = $(OOCD)"
@echo "GCC version:"
@$(CC) --version
@$(CC) --version | head -1
@echo "OOCD version:"
@$(OOCD) --version
@$(OOCD) --version | head -1
ifeq ("$(MULTILIB)","yes")
printmultilib:
+4 -4
View File
@@ -296,10 +296,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.0" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.0">
<subsystem name="radio_control" type="ppm"/>
+4 -4
View File
@@ -265,10 +265,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.0" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.0">
<subsystem name="radio_control" type="spektrum"/>
+6 -6
View File
@@ -193,24 +193,24 @@
<target name="stm_passthrough" board="lisa_l_1.0" processor="stm32" >
</target>
<subsystem name="radio_control" type="spektrum">
<param name="RADIO_CONTROL_SPEKTRUM_MODEL"
<configure name="RADIO_CONTROL_SPEKTRUM_MODEL"
value="\\\"subsystems/radio_control/spektrum_dx7se.h\\\""/>
</subsystem>
<subsystem name="imu" type="b2_v1.1"/>
<target name="overo_test_passthrough" board="lisa_l_1.0" processor="omap" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
</firmware>
<firmware name="lisa_l_test_progs">
<target name="test_telemetry" board="lisa_l_1.0">
<param name="MODEM_PORT" value="UART2"/>
<configure name="MODEM_PORT" value="UART2"/>
</target>
<target name="test_baro" board="lisa_l_1.0"/>
<target name="test_spektrum" board="lisa_l_1.0"/>
+1 -1
View File
@@ -29,7 +29,7 @@
<target name="test_uart" board="lisa_m_1.0"/>
<target name="test_servos" board="lisa_m_1.0"/>
<target name="test_telemetry" board="lisa_m_1.0">
<param name="MODEM_PORT" value="UART2"/>
<configure name="MODEM_PORT" value="UART2"/>
</target>
<target name="test_bmp085" board="lisa_m_1.0"/>
<target name="test_esc_mkk_simple" board="lisa_m_1.0"/>
+1 -1
View File
@@ -272,7 +272,7 @@ second attempt
<firmware name="rotorcraft">
<target name="ap" board="booz_1.0">
<param name="FLASH_MODE" value="IAP"/> <!-- default for the board but putting it here as example-->
<configure name="FLASH_MODE" value="IAP"/> <!-- default for the board but putting it here as example-->
<define name="RADIO_KILL_SWITCH" value="4"/>
<define name="MODEM_BAUD" value = "B57600"/>
<define name="GPS_LAG" value = "0.8"/>
+1 -1
View File
@@ -232,7 +232,7 @@
<firmware name="rotorcraft">
<target name="ap" board="booz_1.0">
<param name="FLASH_MODE" value="IAP"/> <!-- default for the board but putting it here as example-->
<configure name="FLASH_MODE" value="IAP"/> <!-- default for the board but putting it here as example-->
<define name="RADIO_KILL_SWITCH" value="RADIO_CONTROL_SWITCH1"/>
<define name="MODEM_BAUD" value = "B57600"/>
<define name="BOOZ_START_DELAY" value = "3"/>
+4 -4
View File
@@ -229,10 +229,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.1" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.1">
<subsystem name="radio_control" type="spektrum"/>
+4 -4
View File
@@ -231,10 +231,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.1" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.1">
<subsystem name="radio_control" type="spektrum"/>
+4 -4
View File
@@ -232,10 +232,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.1" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.1">
<subsystem name="radio_control" type="spektrum"/>
+4 -4
View File
@@ -235,10 +235,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.1" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.1">
<subsystem name="radio_control" type="spektrum"/>
+47
View File
@@ -0,0 +1,47 @@
<!DOCTYPE airframe SYSTEM "airframe.dtd">
<!--
Connects a microSD card to the SPI port of the Paparazzi Tiny. Keep cables
short, microSD card can be directly soldered to Molex cable. For now only
non SDHC SD cards (<= 2GB) are supported. martinmm@pfump.org
microSD TinyV2 SPI J3
8 nc
7 DO 5 MISO
6 GND 1 GND
5 CLK 7 SCK
4 Vcc 2 +3V3
3 DI 4 MOSI
2 CS 3 SSEL
1 nc
Looking onto the gold plated connector side of the microSD card:
###############
I 8
I 7
I 6
I 5
I 4
I 3
I 2
I 1
###### ##
\ I \
## ##
-->
<airframe name="Logger">
<firmware name="logger">
<target name="ap" board="tiny_2.11" >
<configure name="SPI_CHANNEL" value="1" />
<configure name="UART0_BAUD" value="B9600" />
<configure name="UART1_BAUD" value="B9600" />
</target>
</firmware>
</airframe>
+1 -1
View File
@@ -28,7 +28,7 @@
<subsystem name="navigation_bomb"/>
<subsystem name="gyro" type="roll">
<param name="ADC_GYRO_ROLL" value="ADC_3"/>
<configure name="ADC_GYRO_ROLL" value="ADC_3"/>
</subsystem>
</firmware>
+1 -1
View File
@@ -27,7 +27,7 @@
<subsystem name="navigation"/>
<subsystem name="gyro" type="roll">
<param name="ADC_GYRO_ROLL" value="ADC_3"/>
<configure name="ADC_GYRO_ROLL" value="ADC_3"/>
</subsystem>
</firmware>
+3 -3
View File
@@ -28,15 +28,15 @@
<subsystem name="navigation"/>
<subsystem name="gyro" type="roll">
<param name="ADC_GYRO_ROLL" value="ADC_3"/>
<configure name="ADC_GYRO_ROLL" value="ADC_3"/>
</subsystem>
</firmware>
<!-- modules -->
<modules>
<load name="airspeed_ets.xml">
<!--param name="USE_AIRSPEED" value="1"/-->
<param name="SENSOR_SYNC_SEND" value="1"/>
<!--define name="USE_AIRSPEED" value="1"/-->
<define name="SENSOR_SYNC_SEND" value="1"/>
</load>
<load name="infrared_adc.xml"/>
</modules>
+4 -4
View File
@@ -230,10 +230,10 @@
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.0" >
<param name="HOST" value="A7"/>
<param name="USER" value=""/>
<param name="TARGET_DIR" value="~"/>
<param name="PERIODIC_FREQ" value="512"/>
<configure name="HOST" value="A7"/>
<configure name="USER" value=""/>
<configure name="TARGET_DIR" value="~"/>
<configure name="PERIODIC_FREQ" value="512"/>
</target>
<target name="stm_passthrough" board="lisa_l_1.0">
<subsystem name="radio_control" type="spektrum"/>
+1 -1
View File
@@ -25,7 +25,7 @@
<!-- Communication -->
<subsystem name="telemetry" type="transparent">
<param name="MODEM_BAUD" value="B38400"/>
<configure name="MODEM_BAUD" value="B38400"/>
</subsystem>
<!-- Actuators are automatically chosen according to board-->
@@ -1,62 +1,54 @@
<!DOCTYPE airframe SYSTEM "airframe.dtd">
#
# setup.makefile
#
#
<!--
Connects a microSD card to the SPI port of the Paparazzi Tiny. Keep cables
short, microSD card can be directly soldered to Molex cable. For now only
non SDHC SD cards (<= 2GB) are supported. martinmm@pfump.org
CFG_SHARED=$(PAPARAZZI_SRC)/conf/autopilot/subsystems/shared
microSD TinyV2 SPI J3
8 nc
7 DO 5 MISO
6 GND 1 GND
5 CLK 7 SCK
4 Vcc 2 +3V3
3 DI 4 MOSI
2 CS 3 SSEL
1 nc
SRC_ARCH=arch/$(ARCH)
SRC_FIRMWARE=firmwares/logger
Looking onto the gold plated connector side of the microSD card:
SETUP_INC = -I$(SRC_FIRMWARE)
###############
I 8
I 7
I 6
I 5
I 4
I 3
I 2
I 1
###### ##
\ I \
## ##
$(TARGET).CFLAGS += -DBOARD_CONFIG=$(BOARD_CFG)
-->
# default config
ifndef SPI_CHANNEL
SPI_CHANNEL = 1
endif
<airframe name="Logger">
ifndef UART0_BAUD
UART0_BAUD = B9600
endif
<makefile>
ifndef UART1_BAUD
UART1_BAUD = B9600
endif
CONFIG = \"tiny_2_1_1_usb.h\"
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
# a configuration program to access both uart through usb
ifeq ($(ARCH), lpc21)
FLASH_MODE=IAP
ap.CFLAGS += -DBOARD_CONFIG=$(CONFIG) -DUSE_LED
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c main_logger.c
ap.CFLAGS += -DUSE_LED
ap.srcs = sys_time.c $(SRC_ARCH)/sys_time_hw.c $(SRC_ARCH)/armVIC.c $(SRC_FIRMWARE)/main_logger.c
#choose one
ap.CFLAGS += -DLOG_XBEE
#ap.CFLAGS += -DLOG_PPRZ
#set the speed
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=B9600 -DUSE_UART0_RX_ONLY
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=B9600 -DUSE_UART1_RX_ONLY
ap.CFLAGS += -DUSE_UART0 -DUART0_BAUD=$(UART0_BAUD) -DUSE_UART0_RX_ONLY
ap.CFLAGS += -DUSE_UART1 -DUART1_BAUD=$(UART1_BAUD) -DUSE_UART1_RX_ONLY
ap.srcs += $(SRC_ARCH)/mcu_periph/uart_arch.c
ap.srcs += mcu_periph/uart.c
ap.srcs += $(SRC_ARCH)/mcu_arch.c
ap.srcs += mcu.c
#set SPI interface for SD card (0 or 1)
ap.CFLAGS += -DHW_ENDPOINT_LPC2000_SPINUM=1
ap.CFLAGS += -DHW_ENDPOINT_LPC2000_SPINUM=$(SPI_CHANNEL)
#efsl
ap.CFLAGS += -I $(SRC_ARCH)/efsl/inc -I $(SRC_ARCH)/efsl/conf
@@ -84,7 +76,9 @@ ap.srcs += $(SRC_ARCH)/lpcusb/examples/msc_scsi.c
ap.srcs += $(SRC_ARCH)/lpcusb/examples/blockdev_sd.c
ap.srcs += $(SRC_ARCH)/lpcusb/examples/lpc2000_spi.c
</makefile>
</airframe>
else
$(error usb_tunnel currently only implemented for the lpc21)
endif
+6 -2
View File
@@ -78,7 +78,7 @@
<message name="BAT" id="12">
<field name="throttle" type="int16" unit="pprz"/>
<field name="voltage" type="uint8" unit="1e-1V" alt_unit="V" alt_unit_coef="0.1"/>
<field name="amps" type="int16" unit="A" alt_unit="A" />
<field name="amps" type="int16" unit="1e-2A" alt_unit="A" alt_unit_coef="0.01"/>
<field name="flight_time" type="uint16" unit="s"/>
<field name="kill_auto_throttle" type="uint8" unit="bool"/>
<field name="block_time" type="uint16" unit="s"/>
@@ -542,7 +542,11 @@
<field name="AOA" type="float" unit="rad"></field>
</message>
<!-- 70 is free -->
<message name="XTEND_RSSI" id="70">
<field name="datalink_time" type="uint16" unit="s"/>
<field name="rssi_fade_margin" type="uint8" unit="dB"/>
<field name="duty" type="uint8" unit="%"/>
</message>
<!-- 71 is free -->
<!-- 72 is free -->
<!-- 73 is free -->
+43
View File
@@ -0,0 +1,43 @@
<!DOCTYPE module SYSTEM "./module.dtd">
<!--
// Use (parts of) the following section in airframe file to change
<section name="DIGITAL_CAMERA" prefix="DC_">
<configure name="PUSH" value"LED_ON" />
<configure name="RELEASE" value"LED_OFF" />
<configure name="AUTOSHOOT_QUARTERSEC_PERIOD" value="6" unit="quarter_second"/>
<configure 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
-->
<module name="digital_cam_servo" dir="digital_cam">
<header>
<file name="servo_cam_ctrl.h"/>
</header>
<init fun="servo_cam_ctrl_init()"/>
<periodic fun="servo_cam_ctrl_periodic()" freq="4" autorun="TRUE"/>
<makefile >
<define name="DIGITAL_CAM" />
<file name="servo_cam_ctrl.c"/>
<file name="dc.c"/>
<define name="SENSOR_SYNC_SEND" value="1" />
</makefile>
</module>
+17
View File
@@ -0,0 +1,17 @@
<!DOCTYPE module SYSTEM "module.dtd">
<module name="mcp355x" dir="adcs">
<header>
<file name="mcp355x.h"/>
</header>
<init fun="mcp355x_init()"/>
<periodic fun="mcp355x_read()" freq="10"/>
<event fun="mcp355x_event()"/>
<makefile target="ap">
<file name="mcp355x.c" dir="peripherals"/>
<define name="USE_SPI_SLAVE0"/>
<define name="SPI_MASTER"/>
</makefile>
</module>
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE module SYSTEM "module.dtd">
<!-- Currently only available on LPC21xx arch
pwm input measurement mcu periph access and init wrapper for other modules
For LPC21xx on the TWOG:
1 - INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V->3.3V voltage divider)
2 - INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
-->
<module name="pwm_meas" dir="core">
<header>
<file name="pwm_meas.h"/>
</header>
<init fun="pwm_meas_init()"/>
<makefile target="ap">
<file name="pwm_meas.c"/>
<file name="pwm_input.c" dir="mcu_periph"/>
<file_arch name="pwm_input_arch.c" dir="mcu_periph"/>
<define name="USE_PWM_INPUT"/> <!-- needed to enable the pwm_input interrupts in sys_time_hw.c -->
</makefile>
</module>
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE module SYSTEM "module.dtd">
<!-- Currently only available on LPC21xx arch
Digi Xtend RSSI PWM Module
@configure XTEND_RSSI_PWM_INPUT_CHANNEL on which arch dep input the pwm line is connected
For LPC21xx on the TWOG:
1 - INPUT CAPTURE CAP0.3 on P0.29 (TWOG ADC5, 5V->3.3V voltage divider)
2 - INPUT CAPTURE CAP0.0 on P0.30 (TWOG ADC4, no voltage divider)
-->
<module name="xtend_rssi" dir="datalink">
<depend require="pwm_meas.xml"/>
<header>
<file name="xtend_rssi.h"/>
</header>
<periodic fun="xtend_rssi_periodic()" freq="0.5"/>
<makefile target="ap">
<file name="xtend_rssi.c"/>
<define name="XTEND_RSSI_PWM_INPUT_CHANNEL" value="$(XTEND_RSSI_PWM_INPUT_CHANNEL)"/> <!-- configure the pwm input to be used in airframe file -->
<define name="USE_PWM_INPUT$(XTEND_RSSI_PWM_INPUT_CHANNEL)" value="PWM_PULSE_TYPE_ACTIVE_HIGH"/> <!-- rssi signal is active high -->
</makefile>
</module>
+1
View File
@@ -22,6 +22,7 @@
<dl_setting MAX="1" MIN="0" STEP="1" VAR="launch"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle"/>
<dl_setting MAX="2" MIN="0" STEP="1" VAR="telemetry_mode_Ap_DefaultChannel" shortname="tele_AP" module="downlink" values="Default|Minimal|Extremal"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="telemetry_mode_Fbw_DefaultChannel" shortname="tele_FBW" module="downlink" values="Default|Debug"/>
<dl_setting MAX="2" MIN="0" STEP="1" VAR="gps.reset" module="subsystems/gps" handler="Reset" shortname="GPS reset"/>
</dl_settings>
+1
View File
@@ -22,6 +22,7 @@
<dl_setting MAX="1" MIN="0" STEP="1" VAR="launch"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle"/>
<dl_setting MAX="2" MIN="0" STEP="1" VAR="telemetry_mode_Ap_DefaultChannel" shortname="tele_AP" module="downlink" values="Default|Minimal|Extremal"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="telemetry_mode_Fbw_DefaultChannel" shortname="tele_FBW" module="downlink" values="Default|Debug"/>
<dl_setting MAX="2" MIN="0" STEP="1" VAR="gps.reset" module="subsystems/gps" handler="Reset" shortname="GPS reset"/>
</dl_settings>
+1
View File
@@ -22,6 +22,7 @@
<dl_setting MAX="1" MIN="0" STEP="1" VAR="launch"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="kill_throttle"/>
<dl_setting MAX="5" MIN="0" STEP="1" VAR="telemetry_mode_Ap_DefaultChannel" shortname="tele_AP" module="downlink" values="Default|Minimal|Extremal|Raw|Scaled|DebugIMU"/>
<dl_setting MAX="1" MIN="0" STEP="1" VAR="telemetry_mode_Fbw_DefaultChannel" shortname="tele_FBW" module="downlink" values="Default|Debug"/>
<dl_setting MAX="2" MIN="0" STEP="1" VAR="gps.reset" module="subsystems/gps" handler="Reset" shortname="GPS reset"/>
</dl_settings>
+8 -8
View File
@@ -3,19 +3,19 @@
<telemetry>
<process name="Ap">
<mode name="default">
<message name="AIRSPEED" period="1"/>
<message name="AIRSPEED" period="1.4"/>
<message name="ALIVE" period="5"/>
<message name="GPS" period="0.5"/>
<message name="NAVIGATION" period="1."/>
<message name="ATTITUDE" period="0.1"/>
<message name="ESTIMATOR" period="0.5"/>
<message name="ATTITUDE" period="0.7"/>
<message name="ESTIMATOR" period="0.6"/>
<message name="ENERGY" period="2.5"/>
<message name="WP_MOVED" period="0.75"/>
<message name="WP_MOVED" period="1.1"/>
<message name="CIRCLE" period="1.05"/>
<message name="DESIRED" period="1.05"/>
<message name="BAT" period="1.1"/>
<message name="BARO_MS5534A" period="1.0"/>
<message name="SCP_STATUS" period="1.0"/>
<message name="BARO_MS5534A" period="1.4"/>
<message name="SCP_STATUS" period="1.3"/>
<message name="SEGMENT" period="1.2"/>
<message name="CALIBRATION" period="2.1"/>
<message name="NAVIGATION_REF" period="9."/>
@@ -23,13 +23,13 @@
<message name="SETTINGS" period="5."/>
<message name="STATE_FILTER_STATUS" period="2.2"/>
<message name="DOWNLINK" period="5.1"/>
<message name="DL_VALUE" period="1.5"/>
<message name="DL_VALUE" period="1.2"/>
<message name="IR_SENSORS" period="1.2"/>
<message name="SURVEY" period="2.1"/>
<message name="GPS_SOL" period="2.0"/>
<message name="IMU_ACCEL" period=".8"/>
<message name="IMU_GYRO" period=".9"/>
<message name="IMU_MAG" period="1.3"/>
<message name="IMU_MAG" period="1.9"/>
</mode>
<mode name="minimal">
<message name="ALIVE" period="5"/>
+2 -2
View File
@@ -57,7 +57,7 @@
#define PERIODIC_SEND_ALIVE(_chan) DOWNLINK_SEND_ALIVE(_chan, 16, MD5SUM);
#define PERIODIC_SEND_BAT(_chan) { \
uint16_t amps = (int16_t) (current/1000); \
int16_t amps = (int16_t) (current/10); \
Downlink({ int16_t e = energy; \
DOWNLINK_SEND_BAT(_chan, \
&v_ctl_throttle_slewed, \
@@ -69,7 +69,7 @@
&stage_time, \
&e); \
}); \
}
}
#ifdef MCU_SPI_LINK
#define PERIODIC_SEND_DEBUG_MCU_LINK(_chan) DOWNLINK_SEND_DEBUG_MCU_LINK(_chan, &link_mcu_nb_err, &link_mcu_fbw_nb_err, &mcu1_ppm_cpt);
@@ -0,0 +1,150 @@
/* $Id$
*
* Copyright (C) 2011 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.
*
*/
/** \brief handling of arm7 PWM input using a timer with capture
*
*/
#include "mcu_periph/pwm_input_arch.h"
#include "LPC21xx.h"
#include "interrupt_hw.h"
//UPDATE THESE TO BE MORE ACCESSIBLE AND BE WARY OF EXISTING USAGE
//POSSIBLY MAKE MORE INPUTS ACCESSIBLE
#ifdef USE_PWM_INPUT1
//INPUT CAPTURE CAP0.3 on P0.29
#define PWM_INPUT1_PINSEL PINSEL1
#define PWM_INPUT1_PINSEL_BIT 26
#define PWM_INPUT1_PINSEL_VAL (0x2 << PWM_INPUT1_PINSEL_BIT)
#define PWM_INPUT1_PINSEL_MASK (0x3 <<PWM_INPUT1_PINSEL_BIT)
#endif
#ifdef USE_PWM_INPUT2
//INPUT CAPTURE CAP0.0 on P0.30
#define PWM_INPUT2_PINSEL PINSEL1
#define PWM_INPUT2_PINSEL_BIT 28
#define PWM_INPUT2_PINSEL_VAL (0x3 << PWM_INPUT2_PINSEL_BIT)
#define PWM_INPUT2_PINSEL_MASK (0x3 <<PWM_INPUT2_PINSEL_BIT)
#endif
void pwm_input_init ( void )
{
// initialize the arrays to 0 to avoid junk
for (int i=0; i < PWM_INPUT_NB; i++)
{
pwm_input_duty_tics[i] = 0;
pwm_input_duty_valid[i] = 0;
pwm_input_period_tics[i] = 0;
pwm_input_period_valid[i] = 0;
}
/* select pin for capture */
#ifdef USE_PWM_INPUT1
PWM_INPUT1_PINSEL = (PWM_INPUT1_PINSEL & ~PWM_INPUT1_PINSEL_MASK) | PWM_INPUT1_PINSEL_VAL;
//enable capture 0.3 on rising edge + trigger interrupt
T0CCR |= TCCR_CR3_R | TCCR_CR3_I;
#endif
#ifdef USE_PWM_INPUT2
PWM_INPUT2_PINSEL = (PWM_INPUT2_PINSEL & ~PWM_INPUT2_PINSEL_MASK) | PWM_INPUT2_PINSEL_VAL;
//enable capture 0.0 on rising edge + trigger interrupt
T0CCR |= TCCR_CR0_R | TCCR_CR0_I;
#endif
}
//FIXME what about clock time overflow???
#ifdef USE_PWM_INPUT1
void pwm_input_isr1(void)
{
static uint32_t t_rise;
static uint32_t t_fall;
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
static uint32_t t_oldrise = 0;
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
static uint32_t t_oldfall = 0;
#endif
if (T0CCR & TCCR_CR3_F) {
t_fall = T0CR3;
T0CCR |= TCCR_CR3_R;
T0CCR &= ~TCCR_CR3_F;
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_duty_tics[0] = t_fall - t_rise;
pwm_input_duty_valid[0] = TRUE;
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_period_tics[0] = t_fall - t_oldfall;
pwm_input_period_valid[0] = TRUE;
t_oldfall = t_fall;
#endif //ACTIVE_HIGH
} else if (T0CCR & TCCR_CR3_R) {
t_rise = T0CR3;
T0CCR |= TCCR_CR3_F;
T0CCR &= ~TCCR_CR3_R;
#if USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_duty_tics[0] = t_rise - t_fall;
pwm_input_duty_valid[0] = TRUE;
#elif USE_PWM_INPUT1 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_period_tics[0] = t_rise - t_oldrise;
pwm_input_period_valid[0] = TRUE;
t_oldrise = t_rise;
#endif //ACTIVE_LOW
}
}
#endif //USE_PWM_INPUT1
#ifdef USE_PWM_INPUT2
void pwm_input_isr2(void)
{
static uint32_t t_rise;
static uint32_t t_fall;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
static uint32_t t_oldrise = 0;
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
static uint32_t t_oldfall = 0;
#endif
if (T0CCR & TCCR_CR0_F) {
t_fall = T0CR0;
T0CCR |= TCCR_CR0_R;
T0CCR &= ~TCCR_CR0_F;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_duty_tics[1] = t_fall - t_rise;
pwm_input_duty_valid[1] = TRUE;
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_period_tics[1] = t_fall - t_oldfall;
pwm_input_period_valid[1] = TRUE;
t_oldfall = t_fall;
#endif //ACTIVE_HIGH
} else if (T0CCR & TCCR_CR0_R) {
t_rise = T0CR0;
T0CCR |= TCCR_CR0_F;
T0CCR &= ~TCCR_CR0_R;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_duty_tics[1] = t_rise - t_fall;
pwm_input_duty_valid[1] = TRUE;
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_period_tics[1] = t_rise - t_oldrise;
pwm_input_period_valid[1] = TRUE;
t_oldrise = t_rise;
#endif //ACTIVE_LOW
}
}
#endif //USE_PWM_INPUT2
@@ -0,0 +1,51 @@
/* $Id$
*
* Copyright (C) 2011 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.
*
*/
/** \brief handling of arm7 PWM input using a timer with capture
*
*/
#ifndef PWM_INPUT_ARCH_H
#define PWM_INPUT_ARCH_H
#include "std.h"
#include "LPC21xx.h"
#include "interrupt_hw.h"
#define PWM_INPUT_NB 2 //this is architecture dependent
#include "mcu_periph/pwm_input.h"
#ifdef USE_PWM_INPUT1
extern void pwm_input_isr1(void);
#define PWM_INPUT_IT1 TIR_CR3I
#define PWM_INPUT_ISR_1() pwm_input_isr1()
#endif //USE_PWM_INPUT1
#ifdef USE_PWM_INPUT2
extern void pwm_input_isr2(void);
#define PWM_INPUT_IT2 TIR_CR0I
#define PWM_INPUT_ISR_2() pwm_input_isr2()
#endif //USE_PWM_INPUT2
#endif /* PWM_INPUT_ARCH_H */
-62
View File
@@ -1,62 +0,0 @@
#include "pwm_input.h"
#include "LPC21xx.h"
#include "interrupt_hw.h"
volatile uint32_t pwm_input_duration[PWM_INPUT_NB];
volatile uint8_t pwm_input_valid[PWM_INPUT_NB];
#ifdef USE_PWM_INPUT1
/* INPUT CAPTURE CAP0.3 on P0.29 */
#define PWM_INPUT1_PINSEL PINSEL1
#define PWM_INPUT1_PINSEL_BIT 26
#define PWM_INPUT1_PINSEL_VAL (0x2 << PWM_INPUT1_PINSEL_BIT)
#define PWM_INPUT1_PINSEL_MASK (0x3 <<PWM_INPUT1_PINSEL_BIT)
#endif
#ifdef USE_PWM_INPUT2
/* INPUT CAPTURE CAP0.0 on P0.30 */
#define PWM_INPUT2_PINSEL PINSEL1
#define PWM_INPUT2_PINSEL_BIT 28
#define PWM_INPUT2_PINSEL_VAL (0x3 << PWM_INPUT2_PINSEL_BIT)
#define PWM_INPUT2_PINSEL_MASK (0x3 <<PWM_INPUT2_PINSEL_BIT)
#endif
#ifdef USE_PWM_INPUT3
/* INPUT CAPTURE CAP0.1 on P0.27 */
#define PWM_INPUT3_PINSEL PINSEL1
#define PWM_INPUT3_PINSEL_BIT 22
#define PWM_INPUT3_PINSEL_VAL (0x2 << PWM_INPUT3_PINSEL_BIT)
#define PWM_INPUT3_PINSEL_MASK (0x3 <<PWM_INPUT3_PINSEL_BIT)
#endif
#ifdef USE_PWM_INPUT4
/* INPUT CAPTURE CAP0.2 on P0.28 */
#define PWM_INPUT4_PINSEL PINSEL1
#define PWM_INPUT4_PINSEL_BIT 24
#define PWM_INPUT4_PINSEL_VAL (0x2 << PWM_INPUT4_PINSEL_BIT)
#define PWM_INPUT4_PINSEL_MASK (0x3 <<PWM_INPUT4_PINSEL_BIT)
#endif
void pwm_input_init ( void )
{
/* select pin for capture */
#ifdef USE_PWM_INPUT1
PWM_INPUT1_PINSEL = (PWM_INPUT1_PINSEL & ~PWM_INPUT1_PINSEL_MASK) | PWM_INPUT1_PINSEL_VAL;
/* enable capture 0.3 on falling edge + trigger interrupt */
T0CCR |= TCCR_CR3_R | TCCR_CR3_I;
#endif
#ifdef USE_PWM_INPUT2
PWM_INPUT2_PINSEL = (PWM_INPUT2_PINSEL & ~PWM_INPUT2_PINSEL_MASK) | PWM_INPUT2_PINSEL_VAL;
/* enable capture 0.0 on falling edge + trigger interrupt */
T0CCR |= TCCR_CR0_R | TCCR_CR0_I;
#endif
#ifdef USE_PWM_INPUT3
PWM_INPUT3_PINSEL = (PWM_INPUT3_PINSEL & ~PWM_INPUT3_PINSEL_MASK) | PWM_INPUT3_PINSEL_VAL;
/* enable capture 0.1 on falling edge + trigger interrupt */
T0CCR |= TCCR_CR1_R | TCCR_CR1_I;
#endif
#ifdef USE_PWM_INPUT4
PWM_INPUT4_PINSEL = (PWM_INPUT4_PINSEL & ~PWM_INPUT4_PINSEL_MASK) | PWM_INPUT4_PINSEL_VAL;
/* enable capture 0.2 on falling edge + trigger interrupt */
T0CCR |= TCCR_CR2_R | TCCR_CR2_I;
#endif
}
-97
View File
@@ -1,97 +0,0 @@
#ifndef PWM_INPUT_H
#define PWM_INPUT_H
#include "std.h"
#include "LPC21xx.h"
#include "interrupt_hw.h"
#define PWM_INPUT_NB 4
void pwm_input_init ( void );
/* tracks of length of positive pulse duration */
extern volatile uint32_t pwm_input_duration[PWM_INPUT_NB];
extern volatile uint8_t pwm_input_valid[PWM_INPUT_NB];
static inline void pwm_input_isr1()
{
static uint32_t t_rise;
static uint32_t t_fall;
if (T0CCR & TCCR_CR3_F) {
t_fall = T0CR3;
T0CCR |= TCCR_CR3_R;
T0CCR &= ~TCCR_CR3_F;
pwm_input_duration[0] = t_fall - t_rise;
pwm_input_valid[0] = TRUE;
} else if (T0CCR & TCCR_CR3_R) {
t_rise = T0CR3;
T0CCR |= TCCR_CR3_F;
T0CCR &= ~TCCR_CR3_R;
}
}
static inline void pwm_input_isr2()
{
static uint32_t t_rise;
static uint32_t t_fall;
if (T0CCR & TCCR_CR0_F) {
t_fall = T0CR0;
T0CCR |= TCCR_CR0_R;
T0CCR &= ~TCCR_CR0_F;
pwm_input_duration[1] = t_fall - t_rise;
pwm_input_valid[1] = TRUE;
} else if (T0CCR & TCCR_CR0_R) {
t_rise = T0CR0;
T0CCR |= TCCR_CR0_F;
T0CCR &= ~TCCR_CR0_R;
}
}
static inline void pwm_input_isr3()
{
static uint32_t t_rise;
static uint32_t t_fall;
if (T0CCR & TCCR_CR1_F) {
t_fall = T0CR1;
T0CCR |= TCCR_CR1_R;
T0CCR &= ~TCCR_CR1_F;
pwm_input_duration[2] = t_fall - t_rise;
pwm_input_valid[2] = TRUE;
} else if (T0CCR & TCCR_CR1_R) {
t_rise = T0CR1;
T0CCR |= TCCR_CR1_F;
T0CCR &= ~TCCR_CR1_R;
}
}
static inline void pwm_input_isr4()
{
static uint32_t t_rise;
static uint32_t t_fall;
if (T0CCR & TCCR_CR2_F) {
t_fall = T0CR2;
T0CCR |= TCCR_CR2_R;
T0CCR &= ~TCCR_CR2_F;
pwm_input_duration[3] = t_fall - t_rise;
pwm_input_valid[3] = TRUE;
} else if (T0CCR & TCCR_CR2_R) {
t_rise = T0CR2;
T0CCR |= TCCR_CR2_F;
T0CCR &= ~TCCR_CR2_R;
}
}
#define PWM_INPUT_IT1 TIR_CR3I
#define PWM_INPUT_IT2 TIR_CR0I
#define PWM_INPUT_IT3 TIR_CR1I
#define PWM_INPUT_IT4 TIR_CR2I
#define PWM_INPUT_ISR_1() pwm_input_isr1()
#define PWM_INPUT_ISR_2() pwm_input_isr2()
#define PWM_INPUT_ISR_3() pwm_input_isr3()
#define PWM_INPUT_ISR_4() pwm_input_isr4()
#endif /* PWM_INPUT_H */
+5 -18
View File
@@ -35,12 +35,13 @@ uint32_t sys_time_chrono; /* T0TC ticks */
#endif
#ifdef USE_PWM_INPUT
#include "pwm_input.h"
#else
#include "mcu_periph/pwm_input.h"
#endif
#ifndef USE_PWM_INPUT1
#define PWM_INPUT_IT1 0x00
#endif
#ifndef USE_PWM_INPUT2
#define PWM_INPUT_IT2 0x00
#define PWM_INPUT_IT3 0x00
#define PWM_INPUT_IT4 0x00
#endif
#ifdef USE_AMI601
@@ -64,8 +65,6 @@ uint32_t sys_time_chrono; /* T0TC ticks */
MB_TACHO_IT |\
PWM_INPUT_IT1 |\
PWM_INPUT_IT2 |\
PWM_INPUT_IT3 |\
PWM_INPUT_IT4 |\
AMI601_IT)
void TIMER0_ISR ( void ) {
@@ -125,18 +124,6 @@ LED_TOGGLE(3);
T0IR = PWM_INPUT_IT2;
}
#endif
#ifdef USE_PWM_INPUT3
if (T0IR&PWM_INPUT_IT3) {
PWM_INPUT_ISR_3();
T0IR = PWM_INPUT_IT3;
}
#endif
#ifdef USE_PWM_INPUT4
if (T0IR&PWM_INPUT_IT4) {
PWM_INPUT_ISR_4();
T0IR = PWM_INPUT_IT4;
}
#endif
#ifdef USE_AMI601
if (T0IR&AMI601_IT) {
AMI601_ISR();
+7 -4
View File
@@ -74,13 +74,16 @@ void imu_impl_init(void)
void imu_periodic( void )
{
// Start reading the latest gyroscope data
itg3200_periodic();
Itg3200Periodic();
// Start reading the latest accelerometer data
adxl345_periodic();
// Periodicity is automatically adapted
// 3200 is the maximum output freq corresponding to the parameter 0xF
// A factor 2 is applied to reduice the delay without overloading the i2c
RunOnceEvery((PERIODIC_FREQUENCY/(2*3200>>(0xf-ADXL345_BW_RATE))),Adxl345Periodic());
// Read HMC58XX at 50Hz (main loop for rotorcraft: 512Hz)
RunOnceEvery(10,hmc58xx_periodic());
// Read HMC58XX at 100Hz (main loop for rotorcraft: 512Hz)
RunOnceEvery(5,Hmc58xxPeriodic());
//RunOnceEvery(20,imu_navgo_downlink_raw());
}
+11 -1
View File
@@ -51,6 +51,16 @@
#define DefaultVoltageOfAdc(adc) (0.01837*adc)
/* SPI (SSP) */
#define SPI_SELECT_SLAVE0_PORT 0
#define SPI_SELECT_SLAVE0_PIN 20
#define SPI1_DRDY_PINSEL PINSEL1
#define SPI1_DRDY_PINSEL_BIT 0
#define SPI1_DRDY_PINSEL_VAL 1
#define SPI1_DRDY_EINT 0
#define SPI1_DRDY_VIC_IT VIC_EINT0
/* PWM0 (internal PWM5) */
/* P0.21 */
#define PWM0_PINSEL PINSEL1
@@ -65,4 +75,4 @@
#define BOARD_HAS_BARO
#endif /* CONFIG_UMARIM_V1_0_H */
#endif /* CONFIG_NAVGO_V1_0_H */
+2 -2
View File
@@ -69,10 +69,10 @@ void imu_impl_init(void)
void imu_periodic( void )
{
// Start reading the latest gyroscope data
itg3200_periodic();
Itg3200Periodic();
// Start reading the latest accelerometer data
adxl345_periodic();
Adxl345Periodic();
//RunOnceEvery(10,imu_umarim_downlink_raw());
}
+34
View File
@@ -0,0 +1,34 @@
/*
* Paparazzi $Id$
*
* Copyright (C) 2011 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 mcu_periph/pwm_input.c
* \brief arch independent PWM input capture API */
#include "std.h"
#include "mcu_periph/pwm_input.h"
volatile uint32_t pwm_input_duty_tics[PWM_INPUT_NB];
volatile uint8_t pwm_input_duty_valid[PWM_INPUT_NB];
volatile uint32_t pwm_input_period_tics[PWM_INPUT_NB];
volatile uint8_t pwm_input_period_valid[PWM_INPUT_NB];
+49
View File
@@ -0,0 +1,49 @@
/*
* Paparazzi $Id$
*
* Copyright (C) 2011 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 mcu_periph/pwm_input.h
* \brief arch independent PWM input capture API */
#ifndef PWM_INPUT_H
#define PWM_INPUT_H
#ifdef USE_PWM_INPUT
#include "std.h"
#include "mcu_periph/pwm_input_arch.h"
#define PWM_PULSE_TYPE_ACTIVE_HIGH 0
#define PWM_PULSE_TYPE_ACTIVE_LOW 1
extern volatile uint32_t pwm_input_duty_tics[PWM_INPUT_NB];
extern volatile uint8_t pwm_input_duty_valid[PWM_INPUT_NB];
extern volatile uint32_t pwm_input_period_tics[PWM_INPUT_NB];
extern volatile uint8_t pwm_input_period_valid[PWM_INPUT_NB];
extern void pwm_input_init(void);
#endif /* USE_PWM_INPUT */
#endif /* PWM_INPUT_H */
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright (C) 2011 Gautier Hattenberger
*
* 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.
*
*/
/* driver for MCP3550/1/3 (Module wrapper)
*/
#ifndef MCP355X_MODULE_H
#define MCP355X_MODULE_H
#include "peripherals/mcp355x.h"
#endif
+38
View File
@@ -0,0 +1,38 @@
/*
* $Id$
*
* Copyright (C) 2011 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 pwm_meas.c
*
* Wrapper to access pwm_input mcu peripheral from other modules
*/
#include "modules/core/pwm_meas.h"
#include "mcu_periph/pwm_input.h"
#include "sys_time.h"
void pwm_meas_init( void )
{
pwm_input_init();
}
+35
View File
@@ -0,0 +1,35 @@
/*
* $Id$
*
* Copyright (C) 2011 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 pwm_meas.h
*
* Wrapper to access pwm_input mcu peripheral from other modules
*/
#ifndef PWM_MEAS_H
#define PWM_MEAS_H
void pwm_meas_init( void );
#endif
+70
View File
@@ -0,0 +1,70 @@
/*
* $Id$
*
* Copyright (C) 2011 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 xtend_rssi.c
*
* This measures the rssi pwm signal from a Digi XTend radio modem
* and sends a message with the info.
*/
#include "modules/datalink/xtend_rssi.h"
#include "mcu_periph/pwm_input.h"
#include "sys_time.h"
#ifndef DOWNLINK_DEVICE
#define DOWNLINK_DEVICE DOWNLINK_AP_DEVICE
#endif
#include "mcu_periph/uart.h"
#include "messages.h"
#include "downlink.h"
//from Digi XTend manual
#define XTEND_RSSI_PWM_PERIOD_USEC 8320 //rssi pwm period () in sys tics
#define XTEND_RSSI_PWM_ARRAY_INDEX (XTEND_RSSI_PWM_INPUT_CHANNEL - 1)
void xtend_rssi_periodic( void ) {
/* get the last duty if valid then reset valid flag (this says if we got another pulse since the last one)
calculate the % and dB from the duty using datasheet specs
send the %, dB, datalink time
*/
uint32_t duty_tics = pwm_input_duty_tics[XTEND_RSSI_PWM_ARRAY_INDEX];
uint8_t duty_percent = 0;
uint8_t rssi_dB_fade_margin = 0; //shows dB fade margin above rated minimum sensitivity
if (pwm_input_duty_valid[XTEND_RSSI_PWM_ARRAY_INDEX])
{
duty_percent = (duty_tics * 100) / SYS_TICS_OF_USEC(XTEND_RSSI_PWM_PERIOD_USEC);
rssi_dB_fade_margin = (2 * duty_percent + 10) / 3; //not sure if this is right, datasheet isn't very informative
pwm_input_duty_valid[XTEND_RSSI_PWM_ARRAY_INDEX] = FALSE;
}
DOWNLINK_SEND_XTEND_RSSI(DefaultChannel,
&datalink_time,
&rssi_dB_fade_margin,
&duty_percent );
}
+37
View File
@@ -0,0 +1,37 @@
/*
* $Id$
*
* Copyright (C) 2011 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 xtend_rssi.h
*
* This measures the rssi pwm signal from a Digi XTend radio modem
* and sends a message with the info.
*
*/
#ifndef XTEND_RSSI_H
#define XTEND_RSSI_H
void xtend_rssi_periodic( void );
#endif
@@ -0,0 +1,30 @@
/*
* 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 "servo_cam_ctrl.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 servo_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_SERVO" value="6"/>
* <define name="DC_ZOOM_IN_SERVO" value="7"/>
* <define name="DC_ZOOM_OUT_SERVO" value="8"/>
* <define name="DC_POWER_SERVO" 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 servo_cam_ctrl_H
#define servo_cam_ctrl_H
// Include Standard Camera Control Interface
#include "dc.h"
// Include Servo and airframe servo channels
#include "std.h"
#include "commands.h"
#include "generated/airframe.h"
extern uint8_t dc_timer;
static inline void servo_cam_ctrl_init(void)
{
// Call common DC init
dc_init();
// Do LED specific DC init
dc_timer = 0;
}
#define DC_PUSH(X) commands[X] = -MAX_PPRZ;
#define DC_RELEASE(X) commands[X] = MAX_PPRZ;
#ifndef DC_SHUTTER_DELAY
#define DC_SHUTTER_DELAY 2 /* 4Hz -> 0.5s */
#endif
#ifndef DC_SHUTTER_SERVO
#error DC: Please specify at least a SHUTTER SERVO
#endif
/* Command The Camera */
static inline void dc_send_command(uint8_t cmd)
{
dc_timer = DC_SHUTTER_DELAY;
switch (cmd)
{
case DC_SHOOT:
DC_PUSH(DC_SHUTTER_SERVO);
dc_send_shot_position();
break;
#ifdef DC_ZOOM_IN_SERVO
case DC_TALLER:
DC_PUSH(DC_ZOOM_IN_SERVO);
break;
#endif
#ifdef DC_ZOOM_OUT_SERVO
case DC_WIDER:
DC_PUSH(DC_ZOOM_OUT_SERVO);
break;
#endif
#ifdef DC_POWER_SERVO
case DC_POWER:
DC_PUSH(DC_POWER_SERVO);
break;
#endif
}
}
/* 4Hz Periodic */
static inline void servo_cam_ctrl_periodic( void )
{
if (dc_timer) {
dc_timer--;
} else {
DC_RELEASE(DC_SHUTTER_SERVO);
#ifdef DC_ZOOM_IN_SERVO
DC_RELEASE(DC_ZOOM_IN_SERVO);
#endif
#ifdef DC_ZOOM_OUT_SERVO
DC_RELEASE(DC_ZOOM_OUT_SERVO);
#endif
#ifdef DC_POWER_SERVO
DC_RELEASE(DC_POWER_SERVO);
#endif
}
// Common DC Periodic task
dc_periodic_4Hz();
}
#endif // DC_H
+10 -1
View File
@@ -67,6 +67,8 @@
#define ADXL345_I2C_DEVICE i2c1
#endif
// Config done flag
extern bool_t adxl345_initialized;
// Data ready flag
extern volatile bool_t adxl345_data_available;
// Data vector
@@ -78,9 +80,16 @@ extern struct i2c_transaction adxl345_trans;
// Functions
extern void adxl345_init(void);
extern void adxl345_periodic(void);
extern void adxl345_configure(void);
extern void adxl345_read(void);
extern void adxl345_event(void);
// Macro for using ADXL345 in periodic function
#define Adxl345Periodic() { \
if (adxl345_initialized) adxl345_read(); \
else adxl345_configure(); \
}
#define AccelEvent(_handler) { \
adxl345_event(); \
if (adxl345_data_available) { \
+25 -11
View File
@@ -62,21 +62,25 @@ static void adxl345_send_config(void)
adxl345_i2c_trans.buf[0] = ADXL345_REG_BW_RATE;
adxl345_i2c_trans.buf[1] = ADXL345_BW_RATE;
I2CTransmit(ADXL345_I2C_DEVICE, adxl345_i2c_trans, ADXL345_I2C_ADDR, 2);
adxl345_init_status++;
break;
case ADXL_CONF_POWER:
adxl345_i2c_trans.buf[0] = ADXL345_REG_POWER_CTL;
adxl345_i2c_trans.buf[1] = ADXL345_POWER_CTL;
I2CTransmit(ADXL345_I2C_DEVICE, adxl345_i2c_trans, ADXL345_I2C_ADDR, 2);
adxl345_init_status++;
break;
case ADXL_CONF_INT:
adxl345_i2c_trans.buf[0] = ADXL345_REG_INT_ENABLE;
adxl345_i2c_trans.buf[1] = ADXL345_INT_ENABLE;
I2CTransmit(ADXL345_I2C_DEVICE, adxl345_i2c_trans, ADXL345_I2C_ADDR, 2);
adxl345_init_status++;
break;
case ADXL_CONF_FORMAT:
adxl345_i2c_trans.buf[0] = ADXL345_REG_DATA_FORMAT;
adxl345_i2c_trans.buf[1] = ADXL345_DATA_FORMAT;
I2CTransmit(ADXL345_I2C_DEVICE, adxl345_i2c_trans, ADXL345_I2C_ADDR, 2);
adxl345_init_status++;
break;
case ADXL_CONF_DONE:
adxl345_initialized = TRUE;
@@ -87,25 +91,24 @@ static void adxl345_send_config(void)
}
}
void adxl345_periodic(void)
// Configure
void adxl345_configure(void)
{
if (!adxl345_initialized) {
// Configure
if (adxl345_i2c_trans.status == I2CTransSuccess || adxl345_i2c_trans.status == I2CTransDone) {
if (adxl345_init_status == ADXL_CONF_UNINIT) {
adxl345_init_status++;
if (adxl345_i2c_trans.status == I2CTransSuccess || adxl345_i2c_trans.status == I2CTransDone) {
adxl345_send_config();
}
if (adxl345_i2c_trans.status == I2CTransFailed) {
adxl345_send_config(); // Retry config
}
}
else {
// Normal reading
if (adxl345_i2c_trans.status == I2CTransDone){
}
// Normal reading
void adxl345_read(void)
{
if (adxl345_initialized && adxl345_i2c_trans.status == I2CTransDone) {
adxl345_i2c_trans.buf[0] = ADXL345_REG_DATA_X0;
I2CTransceive(ADXL345_I2C_DEVICE, adxl345_i2c_trans, ADXL345_I2C_ADDR, 1, 6);
}
}
}
#define Int16FromBuf(_buf,_idx) ((int16_t)((_buf[_idx+1]<<8) | _buf[_idx]))
@@ -125,6 +128,17 @@ void adxl345_event(void)
adxl345_i2c_trans.status = I2CTransDone;
}
}
else if (!adxl345_initialized && adxl345_init_status != ADXL_CONF_UNINIT) { // Configuring
if (adxl345_i2c_trans.status == I2CTransSuccess || adxl345_i2c_trans.status == I2CTransDone) {
adxl345_i2c_trans.status = I2CTransDone;
adxl345_send_config();
}
if (adxl345_i2c_trans.status == I2CTransFailed) {
adxl345_init_status--;
adxl345_i2c_trans.status = I2CTransDone;
adxl345_send_config(); // Retry config (TODO max retry)
}
}
}

Some files were not shown because too many files have changed in this diff Show More