Merging from the dev branch.

This commit is contained in:
Bernard Davison
2012-03-04 10:30:09 +11:00
104 changed files with 950 additions and 1057 deletions
+2 -10
View File
@@ -259,19 +259,11 @@ dist_clean_irreversible: clean
ab_clean:
find sw/airborne -name '*~' -exec rm -f {} \;
#test_all_example_airframes:
# $(MAKE) AIRCRAFT=BOOZ2_A1 clean_ac ap sim
# $(MAKE) AIRCRAFT=Microjet clean_ac ap sim
# $(MAKE) AIRCRAFT=Tiny_IMU clean_ac ap
# $(MAKE) AIRCRAFT=EasyStar_ETS clean_ac ap sim
test_all_example_airframes2: test_all_example_airframes
test_all_example_airframes: replace_current_conf_xml
for ap in `grep name conf/conf.xml.example | sed -e 's/.*name=\"//' | sed -e 's/"//'`; do echo "Making $$ap"; make -C ./ AIRCRAFT=$$ap clean_ac ap.compile || exit 1; done
for ap in `grep name conf/conf.xml.example | sed -e 's/.*name=\"//' | sed -e 's/".*//'`; do for airframe in `grep $$ap conf/conf.xml.example | sed -e 's/.*airframe=\"//' | sed -e 's/".*//'`; do for target in `grep target conf/$$airframe | grep name | sed -e 's/.*name=\"//' | sed -e 's/\".*//'`; do echo "Making $$ap $$target"; make -C ./ AIRCRAFT=$$ap clean_ac $$target.compile || exit 1; done; done; done
replace_current_conf_xml:
mv conf/conf.xml conf/conf.xml.backup.`date +%Y%m%d-%H%M%s`
test conf/conf.xml || mv conf/conf.xml conf/conf.xml.backup.`date +%Y%m%d-%H%M%s`
cp conf/conf.xml.example conf/conf.xml
commands: paparazzi sw/simulator/launchsitl
-48
View File
@@ -1,48 +0,0 @@
# Paparazzi main $Id$
# Copyright (C) 2004 Pascal Brisset Antoine Drouin
#
# 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.
PAPARAZZI_DIR=/usr/share/paparazzi
ifeq ($(PAPARAZZI_HOME),)
PAPARAZZI_HOME=$(HOME)/paparazzi
endif
ac_h :
$(PAPARAZZI_DIR)/bin/gen_aircraft.out $(AIRCRAFT)
sim_sitl :
cd $(PAPARAZZI_DIR)/sw/simulator; $(MAKE) sim_sitl AIRCRAFT=$(AIRCRAFT)
clean_ac :
rm -fr $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
run_sitl :
$(PAPARAZZI_HOME)/var/$(AIRCRAFT)/sim/simsitl
ap:
cd $(PAPARAZZI_DIR)/sw/airborne/autopilot; $(MAKE) all
fbw:
cd $(PAPARAZZI_DIR)/sw/airborne/fly_by_wire; $(MAKE) all
upload_ap:
cd $(PAPARAZZI_DIR)/sw/airborne/autopilot; $(MAKE) upload
upload_fbw:
cd $(PAPARAZZI_DIR)/sw/airborne/fly_by_wire; $(MAKE) upload
-98
View File
@@ -1,98 +0,0 @@
# Copyright (C) 2003-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.
Intro
-----
Paparazzi is an attempt to develop a free software Unmanned (Air) Vehicle System.
As of today the system is being used successfuly by a number of hobyists, universities and companies all over the world, on vehicle of various size ( 100g to 25Kg ) and of various nature ( fixed wing, rotorcrafts, boats and surface vehicles).
Up to date information is available from the wiki website
http://paparazzi.enac.fr
and from the mailing list (http://savannah.nongnu.org/mail/?group=paparazzi)
and the IRC channel (freenode, #paparazzi).
Directories quick and dirty description:
---------------------------------------
conf: the configuration directory (airframe, radio, ... descriptions).
data: where to put read-only data (e.g. maps, terrain elevation files, icons)
sw: software (onboard, ground station, simulation, ...)
var: products of compilation, cache for the map tiles, ...
debian: Debian packaging control files
Required Software
-----------------
Installation is described in the wiki (paparazzi.enac.fr/wiki/Installation).
Main requirements include
- OCaml (ocaml.org), xml-light library (http://tech.motion-twin.com/xmllight)
- gcc, GTK2, Glib2, libgnomecanvas, libxml2
- ARM7 micro-controller development environnment (gcc, loader, libc, binutils)
- ...
For Debian or Ubuntu users, required packages are available at
http://paparazzi.enac.fr/debian
- "paparazzi-dev" will provide everything needed to compile and run the ground segment and the simulator. If something is missing, please report it.
- "paparazzi-arm-multilib" is required to compile the code for LPC21 and STM32 based boards
- "paparazzi-omap" is needed for building code for the optional Gumstix Overo module available on lisa/L
- "paparazzi-jsbsim" is needed for using jsbsim as flight dynamic model for the simulator.
Compilation and demo simulation
-------------------------------
1) type "make" in the top directory to compile all the libraries and tools.
2) "./paparazzi" to run the Paparazzi Center
3) Select the "Microjet" aircraft in the upper-left A/C
combo box. Select "sim" from upper-middle "target" combo box. Click
"Build". When the compilation is finished, select "Simulation" from
the upper-right session combo box and click "Execute".
4) In the GCS, wait about 10s for the aircraft to be in the "Holding
point" navigation block. Switch to the "Takeoff" block (lower-left
blue airway button in the strip). Takeoff with the green launch button.
Uploading of the embedded software
----------------------------------
1) Power the flight controller board while it is connected to the PC with
the USB cable.
2) From the Paparazzi center, select the "ap" target, and click "Upload".
Flight
-------------------------------------
1) From the Paparazzi Center, select the flight session and ... do
the same than in simulation !
+69
View File
@@ -0,0 +1,69 @@
Paparazzi UAS
=============
Paparazzi is an attempt to develop a free software Unmanned (Air) Vehicle System.
As of today the system is being used successfuly by a number of hobyists, universities and companies all over the world, on vehicle of various size ( 100g to 25Kg ) and of various nature ( fixed wing, rotorcrafts, boats and surface vehicles).
Up to date information is available in the wiki http://paparazzi.enac.fr
and from the mailing list [paparazzi-devel@nongnu.org] (http://savannah.nongnu.org/mail/?group=paparazzi)
and the IRC channel (freenode, #paparazzi).
Required Software
-----------------
Installation is described in the wiki (http://paparazzi.enac.fr/wiki/Installation).
For Ubuntu users, required packages are available in the [paparazzi-uav PPA] (https://launchpad.net/~paparazzi-uav/+archive/ppa),
Debian users can use http://paparazzi.enac.fr/debian
- **paparazzi-dev** is the meta-package that depends on everything needed to compile and run the ground segment and the simulator.
- **paparazzi-arm-multilib** ARM cross-compiling toolchain for LPC21 and STM32 based boards.
- **paparazzi-omap** toolchain for the optional Gumstix Overo module available on lisa/L.
- **paparazzi-jsbsim** is needed for using JSBSim as flight dynamic model for the simulator.
Directories quick and dirty description:
----------------------------------------
_conf_: the configuration directory (airframe, radio, ... descriptions).
_data_: where to put read-only data (e.g. maps, terrain elevation files, icons)
_doc_: documentation (diagrams, manual source files, ...)
_sw_: software (onboard, ground station, simulation, ...)
_var_: products of compilation, cache for the map tiles, ...
Compilation and demo simulation
-------------------------------
1. type "make" in the top directory to compile all the libraries and tools.
2. "./paparazzi" to run the Paparazzi Center
3. Select the "Microjet" aircraft in the upper-left A/C combo box.
Select "sim" from upper-middle "target" combo box. Click "Build".
When the compilation is finished, select "Simulation" from
the upper-right session combo box and click "Execute".
4. In the GCS, wait about 10s for the aircraft to be in the "Holding point" navigation block.
Switch to the "Takeoff" block (lower-left blue airway button in the strip).
Takeoff with the green launch button.
Uploading of the embedded software
----------------------------------
1. Power the flight controller board while it is connected to the PC with the USB cable.
2. From the Paparazzi center, select the "ap" target, and click "Upload".
Flight
------
1. From the Paparazzi Center, select the flight session and ... do the same than in simulation !
+1 -1
View File
@@ -115,7 +115,7 @@ OPT = s
CSTANDARD = -std=gnu99
CINCS = $(INCLUDES) -I $(SRC_ARCH)/include
CINCS = $(INCLUDES) -I$(SRC_ARCH)/include
# Compiler flags.
CFLAGS = $(CINCS)
+3 -102
View File
@@ -14,10 +14,10 @@
<!--load name="infrared_i2c.xml"/-->
<!--load name="max3100.xml"/>
<load name="gsm.xml"/-->
<load name="demo_module.xml">
<!--load name="demo_module.xml">
<define name="TEST" value="1"/>
<define name="TEST_FLAG"/>
</load>
</load-->
<!--load name="enose.xml"/-->
<load name="light.xml"/>
<load name="infrared_adc.xml"/>
@@ -33,7 +33,7 @@
<subsystem name="radio_control" type="ppm"/>
<subsystem name="telemetry" type="xbee_api"/>
<subsystem name="control" type="new"/>
<subsystem name="control" type="adaptive"/>
<subsystem name="ahrs" type="infrared"/>
<subsystem name="gps" type="ublox"/>
<subsystem name="navigation"/>
@@ -217,103 +217,4 @@
<define name="YAW_RESPONSE_FACTOR" value="1."/>
</section>
<!--
<makefile>
CONFIG = \"tiny_2_1_1.h\"
include $(PAPARAZZI_SRC)/conf/autopilot/tiny.makefile
FLASH_MODE=IAP
ap.CFLAGS += -DFBW -DAP -DBOARD_CONFIG=$(CONFIG) -DUSE_LED -DSYS_TIME_LED=1
ap.srcs = mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c main_fbw.c main_ap.c main.c
ap.CFLAGS += -DINTER_MCU
ap.srcs += inter_mcu.c
ap.srcs += commands.c
########## RC actuators + radio
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
########## Modems
ap.CFLAGS += -DDOWNLINK -DUSE_UART1 -DDOWNLINK_TRANSPORT=XBeeTransport -DXBEE_UART=Uart1 -DDATALINK=XBEE -DUART1_BAUD=B57600
ap.srcs += subsystems/datalink/downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c subsystems/datalink/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 += subsystems/datalink/downlink.c $(SRC_ARCH)/mcu_periph/uart_arch.c datalink.c subsystems/datalink/pprz_transport.c
########## ADC
ap.CFLAGS += -DADC -DUSE_ADC_0 -DUSE_ADC_1 -DUSE_ADC_2 -DUSE_ADC_3
ap.srcs += $(SRC_ARCH)/adc_hw.c
########## GPS
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
########## IR sensors
ap.CFLAGS += -DUSE_INFRARED -DALT_KALMAN
ap.srcs += infrared.c estimator.c
########## Gyro
#ap.CFLAGS += -DUSE_GYRO -DADXRS150
#ap.srcs += gyro.c
########## Nav
ap.CFLAGS += -DNAV -DAGR_CLIMB -DPITCH_TRIM
ap.srcs += subsystems/nav.c fw_h_ctl_a.c fw_v_ctl_n.c
ap.srcs += subsystems/navigation/nav_survey_rectangle.c
ap.srcs += subsystems/navigation/nav_line.c
########## SPI Master use slave0
ap.CFLAGS += -DUSE_SPI -DSPI_MASTER -DUSE_SPI_SLAVE0
ap.srcs += spi.c $(SRC_ARCH)/spi_hw.c
########## Barometer (SPI)
#ap.CFLAGS += -DUSE_BARO_MS5534A
#ap.srcs += $(SRC_ARCH)/baro_MS5534A.c
########## I2C0
ap.CFLAGS += -DUSE_I2C0
ap.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
########## Lights
ap.CFLAGS += -DUSE_LIGHT
ap.srcs += light.c
########## Max3100
ap.CFLAGS += -DMAX3100_BAUD_RATE=MAX3100_B9600
ap.CFLAGS += -DGCS_NUMBER=\"+33640286530\"
ap.CFLAGS += -DUSE_MODULES
# Config for SITL simulation
#include $(PAPARAZZI_SRC)/conf/autopilot/sitl.makefile
sim.ARCHDIR = $(ARCHI)
sim.CFLAGS += -DSITL -DAP -DFBW -DRADIO_CONTROL -DINTER_MCU -DDOWNLINK -DDOWNLINK_TRANSPORT=IvyTransport -DUSE_INFRARED -DNAV -DUSE_LED -DWIND_INFO
sim.srcs = latlong.c radio_control.c subsystems/datalink/downlink.c commands.c gps.c inter_mcu.c infrared.c fw_h_ctl_a.c fw_v_ctl_n.c subsystems/nav.c estimator.c mcu_periph/sys_time.c main_fbw.c main_ap.c datalink.c $(SRC_ARCH)/ppm_hw.c $(SRC_ARCH)/sim_gps.c $(SRC_ARCH)/sim_ir.c $(SRC_ARCH)/sim_ap.c $(SRC_ARCH)/ivy_transport.c $(SRC_ARCH)/sim_adc_generic.c $(SRC_ARCH)/led_hw.c
sim.CFLAGS += -DBOARD_CONFIG=\"tiny.h\" -DAGR_CLIMB -DPITCH_TRIM -DALT_KALMAN
sim.srcs += subsystems/navigation/nav_line.c subsystems/navigation/nav_survey_rectangle.c
sim.CFLAGS += -DUSE_LIGHT
sim.srcs += light.c
sim.CFLAGS += -DUSE_I2C0
sim.srcs += i2c.c $(SRC_ARCH)/i2c_hw.c
sim.CFLAGS += -DUSE_MODULES
</makefile>
-->
</airframe>
+15 -27
View File
@@ -1,11 +1,11 @@
<airframe name="Blender">
<modules main_freq="512">
<load name="booz_pwm.xml">
<!--load name="booz_pwm.xml">
<define name="USE_PWM1"/>
</load>
<load name="booz_drop.xml"/>
<load name="booz_cam.xml"/>
<load name="booz_cam.xml"/-->
<!--load name="sonar_maxbotix_booz.xml"/-->
</modules>
@@ -21,13 +21,13 @@
</target>
<target name="sim" board="pc">
<subsystem name="fdm" type="nps"/>
<!--define name="NPS_NO_SUPERVISION"/-->
</target>
<subsystem name="radio_control" type="ppm"/>
<subsystem name="telemetry" type="transparent"/>
<subsystem name="actuators" type="asctec"/>
<!--subsystem name="actuators" type="mkk"/-->
<subsystem name="actuators" type="skiron">
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
</subsystem>
<subsystem name="imu" type="b2_v1.1"/>
<subsystem name="gps" type="ublox">
<configure name="GPS_BAUD" value="B57600"/>
@@ -47,17 +47,11 @@
</firmware>
<servos min="0" neutral="0" max="0xff">
<servo name="PITCH" no="0" min="0" neutral="0" max="255"/>
<servo name="ROLL" no="1" min="0" neutral="0" max="255"/>
<servo name="YAW" no="2" min="0" neutral="0" max="255"/>
<servo name="THRUST" no="3" min="0" neutral="0" max="255"/>
</servos>
<!--servos min="0" neutral="0" max="0xff">
<servo name="FRONT" no="0" min="0" neutral="0" max="255"/>
<servo name="BACK" no="1" min="0" neutral="0" max="255"/>
<servo name="RIGHT" no="2" min="0" neutral="0" max="255"/>
<servo name="BACK" no="2" min="0" neutral="0" max="255"/>
<servo name="RIGHT" no="1" min="0" neutral="0" max="255"/>
<servo name="LEFT" no="3" min="0" neutral="0" max="255"/>
</servos-->
</servos>
<commands>
<axis name="PITCH" failsafe_value="0"/>
@@ -66,20 +60,15 @@
<axis name="THRUST" failsafe_value="0"/>
</commands>
<!--section name="ACTUATORS_MKK" prefix="ACTUATORS_MKK_">
<section name="ACTUATORS_SKIRON" prefix="ACTUATORS_SKIRON_">
<define name="NB" value="4"/>
<define name="ADDR" value="{ 0x52, 0x56, 0x54, 0x58 }"/>
</section-->
<define name="IDX" value="{ SERVO_FRONT, SERVO_BACK, SERVO_RIGHT, SERVO_LEFT }"/>
</section>
<section name="SUPERVISION" prefix="SUPERVISION_">
<define name="TRIM_A" value="0"/>
<define name="TRIM_E" value="0"/>
<define name="TRIM_R" value="0"/>
</section>
<!--section name="SUPERVISION" prefix="SUPERVISION_">
<define name="MIN_MOTOR" value="25"/>
<define name="MAX_MOTOR" value="243"/>
<define name="TRIM_A" value="0"/>
<define name="MIN_MOTOR" value="20"/>
<define name="MAX_MOTOR" value="255"/>
<define name="TRIM_A" value="6"/>
<define name="TRIM_E" value="0"/>
<define name="TRIM_R" value="0"/>
<define name="NB_MOTOR" value="4"/>
@@ -88,8 +77,7 @@
<define name="PITCH_COEF" value="{ 256, -256, 0, 0}"/>
<define name="YAW_COEF" value="{ -256, -256, 256, 256}"/>
<define name="THRUST_COEF" value="{ 256, 256, 256, 256}"/>
</section-->
</section>
<section name="IMU" prefix="IMU_">
+29 -19
View File
@@ -20,7 +20,6 @@
</target>
<target name="sim" board="pc">
<subsystem name="fdm" type="nps"/>
<!--define name="NPS_NO_SUPERVISION"/-->
</target>
<subsystem name="radio_control" type="ppm"/>
@@ -29,11 +28,11 @@
<define name="SKIRON_I2C_SCL_TIME" value="25"/>
</subsystem>
<subsystem name="imu" type="navgo"/>
<subsystem name="gps" type="ublox"/>
<subsystem name="stabilization" type="euler"/>
<subsystem name="ahrs" type="int_cmpl_euler">
<define name="LOW_NOISE_THRESHOLD" value="50000"/>
<subsystem name="gps" type="ublox">
<configure name="GPS_BAUD" value="B57600"/>
</subsystem>
<subsystem name="stabilization" type="euler"/>
<subsystem name="ahrs" type="int_cmpl_euler"/>
<subsystem name="ins" type="hff"/>
</firmware>
@@ -72,31 +71,39 @@
<section name="IMU" prefix="IMU_">
<define name="GYRO_P_NEUTRAL" value="-126"/>
<define name="GYRO_Q_NEUTRAL" value="-29"/>
<define name="GYRO_R_NEUTRAL" value="-32"/>
<define name="GYRO_P_NEUTRAL" value="10"/>
<define name="GYRO_Q_NEUTRAL" value="-32"/>
<define name="GYRO_R_NEUTRAL" value="11"/>
<!-- SENS ITG3200 1/14.375 (deg/s)/LSB, rate frac 12bit => 1/14.375 * pi / 180 * 2^12 -->
<define name="GYRO_P_SENS" value="4.97312" integer="16"/>
<define name="GYRO_Q_SENS" value="4.97312" integer="16"/>
<define name="GYRO_R_SENS" value="4.97312" integer="16"/>
<define name="ACCEL_X_NEUTRAL" value="4"/>
<define name="ACCEL_Y_NEUTRAL" value="-17"/>
<define name="ACCEL_Z_NEUTRAL" value="-22"/>
<define name="ACCEL_X_NEUTRAL" value="9"/>
<define name="ACCEL_Y_NEUTRAL" value="14"/>
<define name="ACCEL_Z_NEUTRAL" value="-16"/>
<!-- SENS ADXL345 16G 31.2 mg/LSB, accel frac 10bit => 31.2 * 2^10 / 1000 = 31.9488-->
<define name="ACCEL_X_SENS" value="38.2816633245" integer="16"/>
<define name="ACCEL_Y_SENS" value="38.7857058923" integer="16"/>
<define name="ACCEL_Z_SENS" value="39.7459254023" integer="16"/>
<define name="ACCEL_X_SENS" value="38.5866088465" integer="16"/>
<define name="ACCEL_Y_SENS" value="38.7212932023" integer="16"/>
<define name="ACCEL_Z_SENS" value="39.403098907" integer="16"/>
<define name="MAG_X_NEUTRAL" value="85"/>
<define name="MAG_Y_NEUTRAL" value="97"/>
<define name="MAG_Z_NEUTRAL" value="-43"/>
<define name="MAG_X_NEUTRAL" value="80"/>
<define name="MAG_Y_NEUTRAL" value="-271"/>
<define name="MAG_Z_NEUTRAL" value="112"/>
<define name="MAG_X_SENS" value="4.44131219218" integer="16"/>
<define name="MAG_Y_SENS" value="4.56234629213" integer="16"/>
<define name="MAG_Z_SENS" value="5.298653926" integer="16"/>
<!--define name="MAG_X_NEUTRAL" value="0"/>
<define name="MAG_Y_NEUTRAL" value="0"/>
<define name="MAG_Z_NEUTRAL" value="0"/>
<define name="MAG_X_SENS" value="5.43371021972" integer="16"/>
<define name="MAG_Y_SENS" value="4.8961742578" integer="16"/>
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/>
<define name="MAG_Z_SENS" value="5.31527656902" integer="16"/-->
<define name="BODY_TO_IMU_PHI" value="0." unit="deg"/> <!-- -10 -->
<define name="BODY_TO_IMU_THETA" value="0." unit="deg"/> <!-- -10 -->
@@ -124,6 +131,8 @@
<define name="ACCEL_Y_SENS" value="38.7108" integer="16"/>
<define name="ACCEL_Z_SENS" value="39.6583" integer="16"/>
<define name="MAG_X_NEUTRAL" value="55"/>
<define name="MAG_Y_NEUTRAL" value="54"/>
<define name="MAG_Z_NEUTRAL" value="92"/>
@@ -148,7 +157,8 @@
</section>
<section name="INS" prefix="INS_">
<define name="BARO_SENS" value="14" integer="16"/>
<!-- 1.4 mm/LSB : 0.0014*2^8 = 0.3584 -->
<define name="BARO_SENS" value="1.156" integer="16"/>
</section>
-10
View File
@@ -209,15 +209,5 @@
<subsystem name="ins" type="hff"/>
</firmware>
<firmware name="booz_test_progs">
<target name="test_telemetry" board="booz_1.0"/>
<target name="test_baro" board="booz_1.0"/>
<target name="test_rc_spektrum" board="booz_1.0"/>
<target name="test_rc_ppm" board="booz_1.0"/>
<target name="test_esc_mkk_simple" board="booz_1.0"/>
<target name="test_actuators_mkk" board="booz_1.0"/>
<target name="test_ami601" board="booz_1.0"/>
</firmware>
</airframe>
-5
View File
@@ -174,11 +174,6 @@
<subsystem name="radio_control" type="spektrum"/>
<subsystem name="actuators" type="mkk"/>
</target>
<target name="sim" board="pc">
<subsystem name="fdm" type="nps"/>
<subsystem name="radio_control" type="ppm"/>
<subsystem name="actuators" type="mkk"/>
</target>
<subsystem name="telemetry" type="transparent"/>
<!-- <subsystem name="imu" type="b2_v1.1"/> -->
<subsystem name="imu" type="aspirin_v1.0"/>
+1 -1
View File
@@ -22,7 +22,7 @@
</firmware>
<firmware name="booz2_test_progs">
<target name="test_telemetry" board="booz_1.0"/>
<target name="test_downlink" board="booz_1.0"/>
<target name="test_baro" board="booz_1.0"/>
<target name="test_spektrum" board="booz_1.0"/>
<target name="tunnel" board="booz_1.0"/>
@@ -28,7 +28,6 @@
<firmware name="setup">
<target name="tunnel" board="tiny_2.11"/>
<target name="setup_actuators" board="tiny_2.11"/>
</firmware>
<servos>
-1
View File
@@ -171,7 +171,6 @@
<firmware name="setup">
<target name="tunnel" board="tiny_0.99" />
<target name="setup_actuators" board="tiny_0.99" />
</firmware>
<modules>
-1
View File
@@ -31,7 +31,6 @@
<firmware name="setup">
<target name="tunnel" board="twog_1.0" />
<target name="setup_actuators" board="twog_1.0" />
</firmware>
<modules>
-1
View File
@@ -30,7 +30,6 @@
<firmware name="setup">
<target name="tunnel" board="twog_1.0"/>
<target name="setup_actuators" board="twog_1.0"/>
</firmware>
<!-- commands section -->
-13
View File
@@ -225,18 +225,5 @@
<target name="test_actuators_asctecv1" board="lisa_l_1.1"/>
</firmware>
<firmware name="lisa_passthrough">
<target name="overo_test_passthrough" board="lisa_l_1.1" >
<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"/>
<subsystem name="imu" type="b2_v1.1"/>
</target>
</firmware>
</airframe>
-1
View File
@@ -56,7 +56,6 @@ http://paparazzi.enac.fr/w/index.php?title=Theory_of_Operation
<firmware name="setup">
<target name="tunnel" board="twog_1.0" />
<target name="usb_tunnel_0" board="twog_1.0" />
<target name="setup_actuators" board="twog_1.0" />
</firmware>
+9 -1
View File
@@ -25,6 +25,9 @@
<subsystem name="gps" type="ublox"/>
<subsystem name="stabilization" type="euler"/>
<subsystem name="ahrs" type="int_cmpl_quat"/>
<!--subsystem name="ahrs" type="float_cmpl">
<define name="AHRS_PROPAGATE_QUAT"/>
</subsystem-->
</firmware>
<firmware name="setup">
@@ -55,7 +58,7 @@
</firmware>
<modules main_freq="512">
<!--load name="sys_mon.xml"/-->
<load name="sys_mon.xml"/>
</modules>
<commands>
@@ -143,7 +146,12 @@
<!-- setpoints -->
<define name="SP_MAX_PHI" value="45." unit="deg"/>
<define name="SP_MAX_THETA" value="45." unit="deg"/>
<define name="SP_MAX_PSI" value="45." unit="deg"/>
<define name="SP_MAX_P" value="180." unit="deg/s"/>
<define name="SP_MAX_Q" value="180." unit="deg/s"/>
<define name="SP_MAX_R" value="90." unit="deg/s"/>
<define name="DEADBAND_A" value="250"/>
<define name="DEADBAND_E" value="250"/>
<define name="DEADBAND_R" value="250"/>
<!-- reference -->
-1
View File
@@ -36,7 +36,6 @@
<firmware name="setup">
<target name="tunnel" board="tiny_2.11"/>
<target name="setup_actuators" board="tiny_2.11"/>
</firmware>
<modules main_freq="60">
-1
View File
@@ -39,7 +39,6 @@
<firmware name="setup">
<target name="tunnel" board="tiny_2.11"/>
<target name="setup_actuators" board="tiny_2.11"/>
</firmware>
<!-- commands section -->
-1
View File
@@ -31,7 +31,6 @@
<firmware name="setup">
<target name="tunnel" board="twog_1.0" />
<target name="usb_tunnel_0" board="twog_1.0" />
<target name="setup_actuators" board="twog_1.0" />
</firmware>
<modules main_freq="60">
-1
View File
@@ -202,7 +202,6 @@
<target name="tunnel" board="tiny_1.1" />
<target name="usb_tunnel_0" board="tiny_1.1" />
<target name="usb_tunnel_1" board="tiny_1.1" />
<target name="setup_actuators" board="tiny_1.1" />
</firmware>
</airframe>
-1
View File
@@ -33,7 +33,6 @@
<target name="tunnel" board="twog_1.0" />
<target name="usb_tunnel_0" board="twog_1.0" />
<target name="usb_tunnel_1" board="twog_1.0" />
<target name="setup_actuators" board="twog_1.0" />
</firmware>
<modules>
-1
View File
@@ -32,7 +32,6 @@
<firmware name="setup">
<target name="tunnel" board="twog_1.0" />
<target name="setup_actuators" board="twog_1.0" />
</firmware>
<modules>
-1
View File
@@ -29,7 +29,6 @@
<firmware name="setup">
<target name="tunnel" board="twog_1.0"/>
<target name="setup_actuators" board="twog_1.0"/>
</firmware>
<modules>
+1 -1
View File
@@ -95,7 +95,7 @@ stm_passthrough.CFLAGS += -DUSE_I2C2
stm_passthrough.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
# Vanes
stm_passthrough.CFLAGS += -I $(SRC_CSC)
stm_passthrough.CFLAGS += -I$(SRC_CSC)
stm_passthrough.CFLAGS += -DUSE_CAN1 \
-DUSE_CAN1 \
-DUSE_USB_LP_CAN1_RX0_IRQ \
+1
View File
@@ -528,6 +528,7 @@ test_actuators_asctecv1.srcs = $(COMMON_TEST_SRCS)
test_actuators_asctecv1.CFLAGS += $(COMMON_TELEMETRY_CFLAGS)
test_actuators_asctecv1.srcs += $(COMMON_TELEMETRY_SRCS)
test_actuators_asctecv1.srcs += test/test_actuators.c
test_actuators_asctecv1.srcs += $(SRC_FIRMWARE)/commands.c
test_actuators_asctecv1.CFLAGS += -DACTUATORS_ASCTEC_DEVICE=i2c1
test_actuators_asctecv1.srcs += $(SRC_FIRMWARE)/actuators/actuators_asctec.c
+2 -2
View File
@@ -54,7 +54,7 @@ ap.CFLAGS += -DHW_ENDPOINT_LPC2000_SPINUM=$(SPI_CHANNEL)
ap.CFLAGS += -DUSE_USB_HIGH_PCLK
#efsl
ap.CFLAGS += -I $(SRC_ARCH)/efsl/inc -I $(SRC_ARCH)/efsl/conf
ap.CFLAGS += -I$(SRC_ARCH)/efsl/inc -I$(SRC_ARCH)/efsl/conf
ap.srcs += $(SRC_ARCH)/efsl/src/efs.c $(SRC_ARCH)/efsl/src/plibc.c
ap.srcs += $(SRC_ARCH)/efsl/src/disc.c $(SRC_ARCH)/efsl/src/partition.c
@@ -69,7 +69,7 @@ ap.srcs += $(SRC_ARCH)/efsl/src/interfaces/sd.c
#usb mass storage
ap.CFLAGS += -DUSE_USB_MSC
ap.CFLAGS += -I $(SRC_ARCH)/lpcusb -I $(SRC_ARCH)/lpcusb/examples
ap.CFLAGS += -I$(SRC_ARCH)/lpcusb -I$(SRC_ARCH)/lpcusb/examples
ap.srcs += $(SRC_ARCH)/usb_msc_hw.c
ap.srcs += $(SRC_ARCH)/lpcusb/usbhw_lpc.c $(SRC_ARCH)/lpcusb/usbcontrol.c
+5 -3
View File
@@ -145,9 +145,11 @@ ap.CFLAGS += -DUSE_I2C2
else ifeq ($(BOARD), lisa_m)
ap.CFLAGS += -DUSE_I2C2
else ifeq ($(BOARD), navgo)
ap.CFLAGS += -DUSE_I2C1
ap.CFLAGS += -DADS1114_I2C_DEVICE=i2c1
ap.srcs += peripherals/ads1114.c
include $(CFG_ROTORCRAFT)/spi.makefile
ap.CFLAGS += -DUSE_SPI_SLAVE0
ap.CFLAGS += -DSPI_NO_UNSELECT_SLAVE
ap.CFLAGS += -DSPI_MASTER
ap.srcs += peripherals/mcp355x.c
endif
ifneq ($(BARO_LED),none)
ap.CFLAGS += -DROTORCRAFT_BARO_LED=$(BARO_LED)
+6 -1
View File
@@ -97,11 +97,16 @@ endif
# a test program to setup actuators
ifeq ($(ARCH), lpc21)
setup_actuators.CFLAGS += -DFBW -DUSE_LED -DSYS_TIME_LED=1
setup_actuators.CFLAGS += -DFBW -DUSE_LED -DPERIPHERALS_AUTO_INIT
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.CFLAGS += $(SETUP_INC) -Ifirmwares/fixedwing
ifneq ($(SYS_TIME_LED),none)
setup_actuators.CFLAGS += -DSYS_TIME_LED=$(SYS_TIME_LED)
endif
setup_actuators.CFLAGS += -DPERIODIC_FREQUENCY='60'
setup_actuators.CFLAGS += -DUSE_SYS_TIME
setup_actuators.srcs += mcu_periph/sys_time.c $(SRC_ARCH)/mcu_periph/sys_time_arch.c $(SRC_ARCH)/armVIC.c subsystems/datalink/pprz_transport.c subsystems/datalink/downlink.c $(SRC_FIRMWARE)/setup_actuators.c mcu_periph/uart.c $(SRC_ARCH)/mcu_periph/uart_arch.c firmwares/fixedwing/main.c mcu.c $(SRC_ARCH)/mcu_arch.c
else ifeq ($(TARGET),setup_actuators)
$(error setup_actuators currently only implemented for the lpc21)
@@ -51,7 +51,6 @@ ifeq ($(ARCH), lpc21)
imu_CFLAGS += -DIMU_TYPE_H=\"subsystems/imu/imu_analog.h\" -DUSE_IMU
imu_CFLAGS += -DADC
imu_CFLAGS += -DADC_CHANNEL_GYRO_NB_SAMPLES=$(ADC_GYRO_NB_SAMPLES)
ifeq ($(ADC_ACCEL_NB_SAMPLES),)
@@ -12,10 +12,12 @@ IMU_NAVGO_CFLAGS += -DUSE_I2C1 -DI2C1_SCLL=25 -DI2C1_SCLH=25
IMU_NAVGO_CFLAGS += -DITG3200_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
IMU_NAVGO_CFLAGS += -DITG3200_I2C_ADDR=ITG3200_ADDR_ALT
IMU_NAVGO_CFLAGS += -DITG3200_SMPLRT_DIV=1
IMU_NAVGO_CFLAGS += -DITG3200_DLFP_CFG=5
IMU_NAVGO_SRCS += peripherals/itg3200.c
IMU_NAVGO_CFLAGS += -DADXL345_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
IMU_NAVGO_CFLAGS += -DADXL345_I2C_ADDR=ADXL345_ADDR_ALT
IMU_NAVGO_CFLAGS += -DADXL345_BW_RATE=0x8
IMU_NAVGO_SRCS += peripherals/adxl345.i2c.c
IMU_NAVGO_CFLAGS += -DHMC58XX_I2C_DEVICE=$(IMU_NAVGO_I2C_DEVICE)
+15 -95
View File
@@ -1,102 +1,22 @@
<?xml version="1.0"?>
<conf>
<!-- arm7 aircrafts -->
<!-- NOTE: All targets in the example config need to be on single lines so that the "make test_all_example_airframes" target can build all targets for each aircraft airframe -->
<!-- booz2 -->
<aircraft
name="BOOZ2_A1"
ac_id="150"
airframe="airframes/Poine/booz2_a1.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_booz2.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_booz2.xml settings/settings_booz2_ahrs_cmpl.xml"
gui_color="white"
/>
<!-- arm7 aircrafts -->
<!-- LISA -->
<aircraft
name="Hexa_LisaL"
ac_id="153"
airframe="airframes/Poine/h_hex.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_booz2.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_booz2.xml"
gui_color="white"
/>
<aircraft
name="BOOZ2_A7"
ac_id="159"
airframe="airframes/Poine/booz2_a7.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_booz2.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_booz2.xml"
gui_color="white"
/>
<aircraft
name="LISA_ASCTEC_PIOTR"
ac_id="161"
airframe="airframes/esden/lisa_asctec.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_booz2.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_booz2.xml settings/settings_booz2_ahrs_cmpl.xml"
gui_color="white"
/>
<!-- booz2 -->
<aircraft name="BOOZ2_A1" ac_id="150" airframe="airframes/Poine/booz2_a1.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/telemetry_booz2.xml" flight_plan="flight_plans/dummy.xml" settings="settings/settings_booz2.xml settings/settings_booz2_ahrs_cmpl.xml" gui_color="white" />
<!-- tiny -->
<aircraft
name="Microjet"
ac_id="5"
airframe="airframes/microjet_example.xml"
radio="radios/cockpitMM.xml"
telemetry="telemetry/default.xml"
flight_plan="flight_plans/basic.xml"
settings="settings/basic_infrared.xml"
gui_color="#6293ba"
/>
<aircraft
name="Tiny_IMU"
ac_id="7"
airframe="airframes/example_twog_analogimu.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default_fixedwing_imu.xml"
flight_plan="flight_plans/versatile.xml"
settings="settings/tuning_ins.xml"
gui_color="blue"
/>
<aircraft
name="Twinjet"
ac_id="6"
airframe="airframes/twinjet_example.xml"
radio="radios/cockpitMM.xml"
telemetry="telemetry/default.xml"
flight_plan="flight_plans/versatile.xml"
settings="settings/tuning.xml settings/infrared.xml"
gui_color="#ba6293"
/>
<aircraft
name="EasyStar_ETS"
ac_id="8"
airframe="airframes/easystar_ets_example.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/default.xml"
flight_plan="flight_plans/versatile.xml"
settings="settings/tuning.xml settings/infrared.xml"
gui_color="red"
/>
<!-- LISA -->
<aircraft name="Hexa_LisaL" ac_id="153" airframe="airframes/Poine/h_hex.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/telemetry_booz2.xml" flight_plan="flight_plans/dummy.xml" settings="settings/settings_booz2.xml" gui_color="white" />
<aircraft name="LISA_ASCTEC_PIOTR" ac_id="161" airframe="airframes/esden/lisa_asctec.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/telemetry_booz2.xml" flight_plan="flight_plans/dummy.xml" settings="settings/settings_booz2.xml settings/settings_booz2_ahrs_cmpl.xml" gui_color="white" />
<!-- Hardware test Lisa/L -->
<aircraft
name="LisaLv11_Booz2v12_RC"
ac_id="9"
airframe="airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml"
radio="radios/cockpitSX.xml"
telemetry="telemetry/telemetry_booz2.xml"
flight_plan="flight_plans/dummy.xml"
settings="settings/settings_booz2.xml"
gui_color="white"
/>
<!-- tiny -->
<aircraft name="Microjet" ac_id="5" airframe="airframes/microjet_example.xml" radio="radios/cockpitMM.xml" telemetry="telemetry/default.xml" flight_plan="flight_plans/basic.xml" settings="settings/basic_infrared.xml" gui_color="#6293ba" />
<aircraft name="Tiny_IMU" ac_id="7" airframe="airframes/example_twog_analogimu.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/default_fixedwing_imu.xml" flight_plan="flight_plans/versatile.xml" settings="settings/tuning_ins.xml" gui_color="blue" />
<aircraft name="Twinjet" ac_id="6" airframe="airframes/twinjet_example.xml" radio="radios/cockpitMM.xml" telemetry="telemetry/default.xml" flight_plan="flight_plans/versatile.xml" settings="settings/tuning.xml settings/infrared.xml" gui_color="#ba6293" />
<aircraft name="EasyStar_ETS" ac_id="8" airframe="airframes/easystar_ets_example.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/default.xml" flight_plan="flight_plans/versatile.xml" settings="settings/tuning.xml settings/infrared.xml" gui_color="red" />
<!-- Hardware test Lisa/L -->
<aircraft name="LisaLv11_Booz2v12_RC" ac_id="9" airframe="airframes/TestHardware/LisaL_v1.1_b2_v1.2_rc.xml" radio="radios/cockpitSX.xml" telemetry="telemetry/telemetry_booz2.xml" flight_plan="flight_plans/dummy.xml" settings="settings/settings_booz2.xml" gui_color="white" />
</conf>
+24
View File
@@ -66,6 +66,30 @@ int32_t f(int32_t x1, int32_t x2)
}
@endcode
@section styleswitch Switch statements
- specify a default case
- prefer an enum over defines for the different states
@code
enum state
{
STATE_FOO = 1,
STATE_BAR = 2
};
switch( state )
{
case STATE_FOO:
foo();
break;
case STATE_BAR:
bar();
break;
default:
break;
}
@endcode
@section stylecpp Preprocessor directives
- For conditional compilation use @c #if instead of @c #ifdef.
Someone might write code like:
-3
View File
@@ -1,3 +0,0 @@
#!/bin/bash
make -C /usr/share/paparazzi -f Makefile.ac $*
+1 -1
View File
@@ -26,7 +26,7 @@ OBJDIR = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)/$(TARGET)
VARINCLUDE=$(PAPARAZZI_HOME)/var/include
ACINCLUDE = $(PAPARAZZI_HOME)/var/$(AIRCRAFT)
INCLUDES = -I $(PAPARAZZI_SRC)/sw/include -I $(PAPARAZZI_SRC)/sw/airborne -I $(PAPARAZZI_SRC)/conf/autopilot -I $(PAPARAZZI_SRC)/sw/airborne/arch/$($(TARGET).ARCHDIR) -I $(VARINCLUDE) -I $(ACINCLUDE)
INCLUDES = -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne -I$(PAPARAZZI_SRC)/conf/autopilot -I$(PAPARAZZI_SRC)/sw/airborne/arch/$($(TARGET).ARCHDIR) -I$(VARINCLUDE) -I$(ACINCLUDE)
ifneq ($(MAKECMDGOALS),clean)
@@ -193,7 +193,9 @@ void SPI1_ISR(void) {
}
if (bit_is_set(SSPMIS, RTMIS)) { /* Rx fifo is not empty and no receive took place in the last 32 bits period */
#if !SPI_NO_UNSELECT_SLAVE
SpiUnselectCurrentSlave();
#endif
SpiReceive();
SpiDisableRti();
SpiClearRti(); /* clear interrupt */
+21 -6
View File
@@ -13,6 +13,10 @@ static inline void i2c_reset_init(struct i2c_periph *p);
#define I2C_BUSY 0x20
// If a hard reset cannot free up SDA, SCL lines abort. Previously stm32 would hang
// when lines stuck i.e. no pullups on I2C lines
#define I2C_MAX_RESET_FAIL_COUNT 20
#ifdef DEBUG_I2C
#define SPURIOUS_INTERRUPT(_periph, _status, _event) { while(1); }
#define OUT_OF_SYNC_STATE_MACHINE(_periph, _status, _event) { while(1); }
@@ -76,7 +80,6 @@ static inline void abort_and_reset(struct i2c_periph *p) {
end_of_transaction(p);
}
#ifdef USE_I2C2
static inline void on_status_start_requested(struct i2c_periph *periph, struct i2c_transaction* trans, uint32_t event);
static inline void on_status_addr_wr_sent(struct i2c_periph *periph, struct i2c_transaction* trans, uint32_t event);
static inline void on_status_sending_byte(struct i2c_periph *periph, struct i2c_transaction* trans, uint32_t event);
@@ -355,6 +358,7 @@ static inline void i2c_error(struct i2c_periph *p)
static inline void i2c_hard_reset(struct i2c_periph *p)
{
uint8_t timeout_fails=0;
I2C_TypeDef *regs = (I2C_TypeDef *) p->reg_addr;
I2C_DeInit(p->reg_addr);
@@ -366,10 +370,13 @@ static inline void i2c_hard_reset(struct i2c_periph *p)
GPIO_SetBits(GPIOB, p->scl_pin | p->sda_pin);
GPIO_Init(GPIOB, &GPIO_InitStructure);
while(GPIO_ReadInputDataBit(GPIOB, p->sda_pin) == Bit_RESET) {
while((GPIO_ReadInputDataBit(GPIOB, p->sda_pin) == Bit_RESET) && timeout_fails < I2C_MAX_RESET_FAIL_COUNT) {
// Raise SCL, wait until SCL is high (in case of clock stretching)
GPIO_SetBits(GPIOB, p->scl_pin);
while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET);
while ((GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET) && timeout_fails < I2C_MAX_RESET_FAIL_COUNT) {
i2c_delay();
timeout_fails++;
}
i2c_delay();
// Lower SCL, wait
@@ -379,6 +386,7 @@ static inline void i2c_hard_reset(struct i2c_periph *p)
// Raise SCL, wait
GPIO_SetBits(GPIOB, p->scl_pin);
i2c_delay();
timeout_fails++;
}
// Generate a start condition followed by a stop condition
@@ -391,10 +399,17 @@ static inline void i2c_hard_reset(struct i2c_periph *p)
// Raise both SCL and SDA and wait for SCL high (in case of clock stretching)
GPIO_SetBits(GPIOB, p->scl_pin | p->sda_pin);
while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET);
while (GPIO_ReadInputDataBit(GPIOB, p->scl_pin) == Bit_RESET && timeout_fails < I2C_MAX_RESET_FAIL_COUNT) {
i2c_delay();
timeout_fails++;
}
// Wait for SDA to be high
while (GPIO_ReadInputDataBit(GPIOB, p->sda_pin) != Bit_SET);
while (GPIO_ReadInputDataBit(GPIOB, p->sda_pin) != Bit_SET && timeout_fails < I2C_MAX_RESET_FAIL_COUNT)
{
i2c_delay();
timeout_fails++;
}
// SCL and SDA should be high at this point, bus should be free
// Return the GPIO pins to the alternate function
@@ -423,7 +438,7 @@ static inline void i2c_reset_init(struct i2c_periph *p)
// enable error interrupts
I2C_ITConfig(p->reg_addr, I2C_IT_ERR, ENABLE);
}
#endif /* USE_I2C2 */
#ifdef USE_I2C1
+15 -18
View File
@@ -9,16 +9,16 @@
#include "mcu_periph/spi.h"
// SPI2 Slave Selection
// SPI2 Slave Selection
#define Spi2Slave0Unselect() GPIOB->BSRR = GPIO_Pin_12
#define Spi2Slave0Select() GPIOB->BRR = GPIO_Pin_12
// spi dma end of rx handler
// spi dma end of rx handler
void dma1_c4_irq_handler(void);
void spi_arch_int_enable(void) {
// Enable DMA1 channel4 IRQ Channel ( SPI RX)
// Enable DMA1 channel4 IRQ Channel ( SPI RX)
NVIC_InitTypeDef NVIC_init_struct = {
.NVIC_IRQChannel = DMA1_Channel4_IRQn,
.NVIC_IRQChannelPreemptionPriority = 0,
@@ -57,7 +57,7 @@ void spi_init(void) {
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO , ENABLE);
SPI_Cmd(SPI2, ENABLE);
// configure SPI
// configure SPI
SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
@@ -73,7 +73,7 @@ void spi_init(void) {
RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE);
// SLAVE 0
// set accel slave select as output and assert it ( on PB12)
// set accel slave select as output and assert it ( on PB12)
Spi2Slave0Unselect();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
@@ -103,7 +103,7 @@ void spi_clear_rx_buf(void) {
struct spi_transaction* slave0;
void spi_rw(struct spi_transaction * _trans)
void spi_rw(struct spi_transaction * _trans)
{
// Store local copy to notify of the results
slave0 = _trans;
@@ -145,14 +145,14 @@ void spi_rw(struct spi_transaction * _trans)
};
DMA_Init(DMA1_Channel5, &DMA_initStructure_5);
// Enable SPI_2 Rx request
// Enable SPI_2 Rx request
SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, ENABLE);
// Enable DMA1 Channel4
// Enable DMA1 Channel4
DMA_Cmd(DMA1_Channel4, ENABLE);
// Enable SPI_2 Tx request
// Enable SPI_2 Tx request
SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, ENABLE);
// Enable DMA1 Channel5
// Enable DMA1 Channel5
DMA_Cmd(DMA1_Channel5, ENABLE);
// Enable DMA1 Channel4 Transfer Complete interrupt
@@ -162,13 +162,13 @@ void spi_rw(struct spi_transaction * _trans)
// Accel end of DMA transfert
void dma1_c4_irq_handler(void)
void dma1_c4_irq_handler(void)
{
Spi2Slave0Unselect();
if (DMA_GetITStatus(DMA1_IT_TC4)) {
// clear int pending bit
DMA_ClearITPendingBit(DMA1_IT_GL4);
// clear int pending bit
DMA_ClearITPendingBit(DMA1_IT_GL4);
// mark as available
spi_message_received = TRUE;
@@ -176,16 +176,13 @@ void dma1_c4_irq_handler(void)
// disable DMA Channel
DMA_ITConfig(DMA1_Channel4, DMA_IT_TC, DISABLE);
// Disable SPI_2 Rx and TX request
// Disable SPI_2 Rx and TX request
SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Rx, DISABLE);
SPI_I2S_DMACmd(SPI2, SPI_I2S_DMAReq_Tx, DISABLE);
// Disable DMA1 Channel4 and 5
// Disable DMA1 Channel4 and 5
DMA_Cmd(DMA1_Channel4, DISABLE);
DMA_Cmd(DMA1_Channel5, DISABLE);
slave0->status = SPITransSuccess;
*(slave0->ready) = 1;
}
+3 -7
View File
@@ -40,7 +40,7 @@ void spi_rw(struct spi_transaction * _trans);
/*
//////////
//////////
// from aspirin_arch.h
@@ -85,7 +85,7 @@ extern void adxl345_start_reading_data(void);
#ifdef SPI_MASTER
// !!!!!!!!!!!!! Code for one single slave at a time !!!!!!!!!!!!!!!!!
// !!!!!!!!!!!!! Code for one single slave at a time !!!!!!!!!!!!!!!!!
#if defined SPI_SELECT_SLAVE1_PIN && defined SPI_SELECT_SLAVE0_PIN
#error "SPI: one single slave, please"
#endif
@@ -159,8 +159,4 @@ extern void adxl345_start_reading_data(void);
*/
#endif // SPI_ARCH_H
#endif // SPI_ARCH_H
+2 -2
View File
@@ -47,7 +47,7 @@ int main(void) {
main_init();
while(1) {
if (sys_time_periodic())
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
@@ -57,7 +57,7 @@ int main(void) {
static inline void main_init( void ) {
mcu_init();
sys_time_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
booz2_analog_init();
baro_init();
mcu_int_enable();
+4 -2
View File
@@ -33,6 +33,8 @@
#include "mcu_periph/sys_time.h"
#include "mcu_periph/uart.h"
#include "led.h"
#include "subsystems/datalink/downlink.h"
#include "subsystems/sensors/baro.h"
@@ -50,7 +52,7 @@ int main(void) {
main_init();
while(1) {
if (sys_time_periodic())
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
@@ -60,7 +62,7 @@ int main(void) {
static inline void main_init( void ) {
mcu_init();
sys_time_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
baro_init();
// DEBUG_SERVO1_INIT();
+12 -26
View File
@@ -27,57 +27,43 @@
#include "subsystems/sensors/baro.h"
#include "led.h"
#include "mcu_periph/spi.h"
/* Common Baro struct */
struct Baro baro;
/* Number of values to compute an offset at startup */
#define OFFSET_NBSAMPLES_AVRG 300
uint16_t offset_cnt;
#if USE_BARO_AS_ALTIMETER
/* Weight for offset IIR filter */
#define OFFSET_FILTER 7
float baro_alt;
float baro_alt_offset;
#endif
/* Counter to init mcp355x at startup */
#define STARTUP_COUNTER 200
uint16_t startup_cnt;
void baro_init( void ) {
ads1114_init();
mcp355x_init();
SpiSelectSlave0(); // never unselect this slave (continious conversion mode)
baro.status = BS_UNINITIALIZED;
baro.absolute = 0;
baro.differential = 0; /* not handled on this board */
#ifdef ROTORCRAFT_BARO_LED
LED_OFF(ROTORCRAFT_BARO_LED);
#endif
offset_cnt = OFFSET_NBSAMPLES_AVRG;
#if USE_BARO_AS_ALTIMETER
baro_alt = 0.;
baro_alt_offset = 0.;
#endif
startup_cnt = STARTUP_COUNTER;
}
void baro_periodic( void ) {
if (baro.status == BS_UNINITIALIZED) {
#if USE_BARO_AS_ALTIMETER
// IIR filter to compute an initial offset
baro_alt_offset = (OFFSET_FILTER * baro_alt_offset + (float)baro.absolute) / (OFFSET_FILTER + 1);
#endif
// decrease init counter
--offset_cnt;
// Run some loops to get correct readings from the adc
--startup_cnt;
#ifdef ROTORCRAFT_BARO_LED
LED_TOGGLE(ROTORCRAFT_BARO_LED);
#endif
if (offset_cnt == 0) {
if (startup_cnt == 0) {
baro.status = BS_RUNNING;
#ifdef ROTORCRAFT_BARO_LED
LED_ON(ROTORCRAFT_BARO_LED);
#endif
}
}
// Read the ADC
ads1114_read();
// Read the ADC (at 50/4 Hz, conversion time is 68 ms)
RunOnceEvery(4,mcp355x_read());
}
+5 -11
View File
@@ -31,22 +31,16 @@
#include "std.h"
#include "peripherals/ads1114.h"
#if USE_BARO_AS_ALTIMETER
extern float baro_alt;
extern float baro_alt_offset;
#define BaroAltHandler() { baro_alt = BARO_SENS*(baro_alt_offset - (float)baro.absolute); }
#endif
#include "peripherals/mcp355x.h"
#define BARO_FILTER_GAIN 5
#define BaroEvent(_b_abs_handler, _b_diff_handler) { \
Ads1114Event(); \
if (ads1114_data_available) { \
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*Ads1114GetValue()) / (BARO_FILTER_GAIN+1); \
mcp355x_event(); \
if (mcp355x_data_available) { \
baro.absolute = (baro.absolute + BARO_FILTER_GAIN*mcp355x_data) / (BARO_FILTER_GAIN+1); \
_b_abs_handler(); \
ads1114_data_available = FALSE; \
mcp355x_data_available = FALSE; \
} \
}
+2 -2
View File
@@ -103,7 +103,7 @@ void imu_navgo_event( void )
// If the itg3200 I2C transaction has succeeded: convert the data
itg3200_event();
if (itg3200_data_available) {
RATES_COPY(imu.gyro_unscaled, itg3200_data);
RATES_ASSIGN(imu.gyro_unscaled, -itg3200_data.q, itg3200_data.p, itg3200_data.r);
itg3200_data_available = FALSE;
gyr_valid = TRUE;
}
@@ -119,7 +119,7 @@ void imu_navgo_event( void )
// HMC58XX event task
hmc58xx_event();
if (hmc58xx_data_available) {
VECT3_ASSIGN(imu.mag_unscaled, -hmc58xx_data.x, -hmc58xx_data.y, hmc58xx_data.z);
VECT3_ASSIGN(imu.mag_unscaled, hmc58xx_data.x, hmc58xx_data.y, hmc58xx_data.z);
hmc58xx_data_available = FALSE;
mag_valid = TRUE;
}
+13 -10
View File
@@ -18,17 +18,17 @@
#define PCLK (CCLK / PBSD_VAL)
/* Onboard LEDs */
#define LED_1_BANK 1
#define LED_1_PIN 25
#define LED_1_BANK 0
#define LED_1_PIN 22
#define LED_2_BANK 1
#define LED_2_PIN 24
#define LED_2_PIN 28
#define LED_3_BANK 1
#define LED_3_PIN 23
#define LED_3_PIN 29
#define LED_4_BANK 1
#define LED_4_PIN 31
#define LED_4_PIN 30
/* PPM : rc rx on P0.28 ( CAP0.2 ) */
#define PPM_PINSEL PINSEL1
@@ -45,19 +45,22 @@
/* battery */
/* allow to define ADC_CHANNEL_VSUPPLY in the airframe file*/
#ifndef ADC_CHANNEL_VSUPPLY
#define ADC_CHANNEL_VSUPPLY AdcBank1(3)
#ifndef USE_AD1
#define USE_AD1
#define ADC_CHANNEL_VSUPPLY AdcBank0(2)
#ifndef USE_AD0
#define USE_AD0
#endif
#define USE_AD1_3
#define USE_AD0_2
#endif
#define DefaultVoltageOfAdc(adc) (0.01837*adc)
#define DefaultVoltageOfAdc(adc) (0.017889*adc)
/* SPI (SSP) */
#define SPI_SELECT_SLAVE0_PORT 0
#define SPI_SELECT_SLAVE0_PIN 20
//#define SPI_SELECT_SLAVE1_PORT 1
//#define SPI_SELECT_SLAVE1_PIN 19
#define SPI1_DRDY_PINSEL PINSEL1
#define SPI1_DRDY_PINSEL_BIT 0
#define SPI1_DRDY_PINSEL_VAL 1
+3 -3
View File
@@ -22,7 +22,7 @@
##
CC = gcc
CFLAGS = -std=gnu99 -Wall -I.. -I../.. -I../../test/ -I../../../include -I ../../booz_priv
CFLAGS = -std=gnu99 -Wall -I.. -I../.. -I../../test/ -I../../../include -I../../booz_priv
LDFLAGS = -lm
CFLAGS += -I../../../../var/BOOZ2_A1P
@@ -47,8 +47,8 @@ TEST_ATT_CFLAGS = -DSTABILISATION_ATTITUDE_TYPE_INT \
-DSTABILISATION_ATTITUDE_REF_H=\"stabilization/booz_stabilization_attitude_ref_quat_int.h\"
test_att_ref: test_att_ref.c ../stabilization/booz_stabilization_attitude_ref_quat_int.c
$(CC) $(CFLAGS) $(TEST_ATT_CFLAGS) -I /home/poine/work/savannah/paparazzi3/trunk/var/BOOZ2_A1 -o $@ $^ $(LDFLAGS)
$(CC) $(CFLAGS) $(TEST_ATT_CFLAGS) -I/home/poine/work/savannah/paparazzi3/trunk/var/BOOZ2_A1 -o $@ $^ $(LDFLAGS)
clean:
rm -f *~ test_att_ref
rm -f *~ test_att_ref
@@ -51,7 +51,7 @@ static inline void main_event_task( void );
int main( void ) {
main_init();
while(1) {
if (sys_time_periodic())
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
@@ -60,7 +60,7 @@ int main( void ) {
static inline void main_init( void ) {
mcu_init();
sys_time_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
mcu_int_enable();
}
+2 -2
View File
@@ -45,7 +45,7 @@ static inline void on_imu_event(void);
int main( void ) {
main_init();
while(1) {
if (sys_time_periodic())
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
@@ -54,7 +54,7 @@ int main( void ) {
static inline void main_init( void ) {
mcu_init();
sys_time_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
led_init();
/* LED_ON(4); */
+2 -2
View File
@@ -39,7 +39,7 @@ static void on_gps_sol(void);
int main( void ) {
main_init();
while(1) {
if (sys_time_periodic())
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
@@ -48,7 +48,7 @@ int main( void ) {
static inline void main_init( void ) {
mcu_init();
sys_time_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
led_init();
gps_init();
mcu_int_enable();

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