diff --git a/.gitignore b/.gitignore index cadc7e4c75..3ec1f73d6b 100644 --- a/.gitignore +++ b/.gitignore @@ -52,6 +52,9 @@ paparazzi.sublime-workspace # Vagrant VM files /.vagrant +# Rust +Cargo.lock + /var /dox diff --git a/.travis.yml b/.travis.yml index 899638a42b..c788b5d392 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ before_install: - sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa -y - sudo apt-get update -q install: - - sudo apt-get install -y --allow-unauthenticated paparazzi-dev paparazzi-jsbsim gcc-arm-embedded gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libipc-run-perl rustc cargo libgazebo9-dev libgps-dev + - sudo apt-get install -y --allow-unauthenticated paparazzi-dev paparazzi-jsbsim gcc-arm-embedded gcc-arm-linux-gnueabi g++-arm-linux-gnueabi libipc-run-perl rustc cargo libgazebo9-dev libgps-dev python3-lxml script: - arm-none-eabi-gcc --version - if [ "${COVERITY_SCAN_BRANCH}" != 1 ]; then if [ "${TRAVIS_EVENT_TYPE}" == "cron" ]; then make test_all_confs; else make test; fi; fi diff --git a/Makefile b/Makefile index 7a231199e6..6e3df4c922 100644 --- a/Makefile +++ b/Makefile @@ -302,7 +302,7 @@ ab_clean: # # Tests # -test: test_math test_examples +test: test_math test_examples test_modules # subset of airframes for coverity test to pass the limited build time on travis test_coverity: all @@ -324,6 +324,10 @@ test_tudelft: all test_examples: all CONF_XML=conf/conf_tests.xml prove tests/aircrafts/ +# test compilation of modules +test_modules: all + prove -v tests/modules/test_modules.py + test_all_confs: all opencv_bebop $(Q)$(eval $CONFS:=$(shell ./find_confs.py)) @echo "************\nFound $(words $($CONFS)) config files: $($CONFS)" diff --git a/conf/conf_tests.xml b/conf/conf_tests.xml index 3501712221..ed58852ab3 100644 --- a/conf/conf_tests.xml +++ b/conf/conf_tests.xml @@ -1,26 +1,4 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + diff --git a/conf/modules/actuators_asctec.xml b/conf/modules/actuators_asctec.xml index 06ab25b9d2..c947099f6e 100644 --- a/conf/modules/actuators_asctec.xml +++ b/conf/modules/actuators_asctec.xml @@ -24,6 +24,10 @@ + + + + diff --git a/conf/modules/actuators_asctec_v2.xml b/conf/modules/actuators_asctec_v2.xml index 1f0db3518f..54430ed2fc 100644 --- a/conf/modules/actuators_asctec_v2.xml +++ b/conf/modules/actuators_asctec_v2.xml @@ -24,6 +24,14 @@ + + + + + + + + diff --git a/conf/modules/actuators_asctec_v2_new.xml b/conf/modules/actuators_asctec_v2_new.xml index d2cecdf060..1c446674c9 100644 --- a/conf/modules/actuators_asctec_v2_new.xml +++ b/conf/modules/actuators_asctec_v2_new.xml @@ -24,6 +24,14 @@ + + + + + + + + diff --git a/conf/modules/actuators_bebop.xml b/conf/modules/actuators_bebop.xml index 16995e783c..b0fad99301 100644 --- a/conf/modules/actuators_bebop.xml +++ b/conf/modules/actuators_bebop.xml @@ -16,6 +16,11 @@ + + + + + diff --git a/conf/modules/actuators_disco.xml b/conf/modules/actuators_disco.xml index 8019b5ed86..160ee61eac 100644 --- a/conf/modules/actuators_disco.xml +++ b/conf/modules/actuators_disco.xml @@ -14,6 +14,11 @@ + + + + + diff --git a/conf/modules/actuators_md25.xml b/conf/modules/actuators_md25.xml index ef4f21e149..572a2ded80 100644 --- a/conf/modules/actuators_md25.xml +++ b/conf/modules/actuators_md25.xml @@ -19,6 +19,10 @@ + + + + diff --git a/conf/modules/actuators_mkk.xml b/conf/modules/actuators_mkk.xml index 802a802c0b..c1be71aa98 100644 --- a/conf/modules/actuators_mkk.xml +++ b/conf/modules/actuators_mkk.xml @@ -30,11 +30,23 @@ + + + + + + + + + + + + diff --git a/conf/modules/actuators_mkk_v2.xml b/conf/modules/actuators_mkk_v2.xml index 78c137dc02..a0c8a360b5 100644 --- a/conf/modules/actuators_mkk_v2.xml +++ b/conf/modules/actuators_mkk_v2.xml @@ -30,11 +30,23 @@ + + + + + + + + + + + + diff --git a/conf/modules/actuators_ostrich.xml b/conf/modules/actuators_ostrich.xml index 3e1b61730d..ce19a2293e 100644 --- a/conf/modules/actuators_ostrich.xml +++ b/conf/modules/actuators_ostrich.xml @@ -18,6 +18,10 @@ + + + + diff --git a/conf/modules/actuators_sbus.xml b/conf/modules/actuators_sbus.xml index 4d7199449e..ea7ce490b0 100644 --- a/conf/modules/actuators_sbus.xml +++ b/conf/modules/actuators_sbus.xml @@ -20,6 +20,11 @@ + + + + + diff --git a/conf/modules/actuators_skiron.xml b/conf/modules/actuators_skiron.xml index 9b2ecd580c..034a5e5a49 100644 --- a/conf/modules/actuators_skiron.xml +++ b/conf/modules/actuators_skiron.xml @@ -24,11 +24,21 @@ + + + + + + + + + + diff --git a/conf/modules/actuators_spektrum.xml b/conf/modules/actuators_spektrum.xml index d6bc835e6f..55a27542c2 100644 --- a/conf/modules/actuators_spektrum.xml +++ b/conf/modules/actuators_spektrum.xml @@ -28,6 +28,11 @@ + + + + + diff --git a/conf/modules/adc.xml b/conf/modules/adc.xml index 3d6a9c63e8..abf4aaabd8 100644 --- a/conf/modules/adc.xml +++ b/conf/modules/adc.xml @@ -13,6 +13,7 @@ + diff --git a/conf/modules/agl_dist.xml b/conf/modules/agl_dist.xml index bf92fe722f..dc2434dce6 100644 --- a/conf/modules/agl_dist.xml +++ b/conf/modules/agl_dist.xml @@ -20,6 +20,7 @@ + diff --git a/conf/modules/ahrs_float_cmpl_quat.xml b/conf/modules/ahrs_float_cmpl_quat.xml index 501df5e325..82ed9a0cb4 100644 --- a/conf/modules/ahrs_float_cmpl_quat.xml +++ b/conf/modules/ahrs_float_cmpl_quat.xml @@ -58,6 +58,11 @@ + + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), fcq float_cmpl_quat)) diff --git a/conf/modules/ahrs_float_cmpl_rmat.xml b/conf/modules/ahrs_float_cmpl_rmat.xml index c3d0d21105..5cdc279647 100644 --- a/conf/modules/ahrs_float_cmpl_rmat.xml +++ b/conf/modules/ahrs_float_cmpl_rmat.xml @@ -54,6 +54,11 @@ + + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), fcr float_cmpl_rmat)) diff --git a/conf/modules/ahrs_float_dcm.xml b/conf/modules/ahrs_float_dcm.xml index 9209809ba1..419da82a1d 100644 --- a/conf/modules/ahrs_float_dcm.xml +++ b/conf/modules/ahrs_float_dcm.xml @@ -48,6 +48,10 @@ + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), dcm float_dcm)) diff --git a/conf/modules/ahrs_float_invariant.xml b/conf/modules/ahrs_float_invariant.xml index 6c4d7abbc9..cdd7f78814 100644 --- a/conf/modules/ahrs_float_invariant.xml +++ b/conf/modules/ahrs_float_invariant.xml @@ -44,6 +44,10 @@ + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), invariant float_invariant)) diff --git a/conf/modules/ahrs_float_mlkf.xml b/conf/modules/ahrs_float_mlkf.xml index d5732481b4..68233b9bc4 100644 --- a/conf/modules/ahrs_float_mlkf.xml +++ b/conf/modules/ahrs_float_mlkf.xml @@ -42,6 +42,10 @@ + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), mlkf float_mlkf)) diff --git a/conf/modules/ahrs_gx3.xml b/conf/modules/ahrs_gx3.xml index 1b9d47e90e..e9dfe72bf8 100644 --- a/conf/modules/ahrs_gx3.xml +++ b/conf/modules/ahrs_gx3.xml @@ -25,5 +25,11 @@ + + + + + + diff --git a/conf/modules/ahrs_infrared.xml b/conf/modules/ahrs_infrared.xml index 63d0ffc6ae..97f80a80d4 100644 --- a/conf/modules/ahrs_infrared.xml +++ b/conf/modules/ahrs_infrared.xml @@ -18,5 +18,8 @@ + + + diff --git a/conf/modules/ahrs_int_cmpl_euler.xml b/conf/modules/ahrs_int_cmpl_euler.xml index 5d2d4617a6..f62bb26e49 100644 --- a/conf/modules/ahrs_int_cmpl_euler.xml +++ b/conf/modules/ahrs_int_cmpl_euler.xml @@ -44,6 +44,10 @@ + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), ice int_cmpl_euler)) diff --git a/conf/modules/ahrs_int_cmpl_quat.xml b/conf/modules/ahrs_int_cmpl_quat.xml index 22ee745db1..445a4ccd47 100644 --- a/conf/modules/ahrs_int_cmpl_quat.xml +++ b/conf/modules/ahrs_int_cmpl_quat.xml @@ -69,6 +69,17 @@ + + + + + + + + + + + ifdef SECONDARY_AHRS ifneq (,$(findstring $(SECONDARY_AHRS), icq int_cmpl_quat)) diff --git a/conf/modules/ahrs_madgwick.xml b/conf/modules/ahrs_madgwick.xml index b1e7a8f94d..6bcac206e9 100644 --- a/conf/modules/ahrs_madgwick.xml +++ b/conf/modules/ahrs_madgwick.xml @@ -49,6 +49,10 @@ else $(TARGET).CFLAGS += -DAHRS_TYPE_H=\"modules/ahrs/ahrs_madgwick_wrapper.h\" endif + + + + diff --git a/conf/modules/ahrs_sim.xml b/conf/modules/ahrs_sim.xml index cf8ce4e474..a7f160b5e0 100644 --- a/conf/modules/ahrs_sim.xml +++ b/conf/modules/ahrs_sim.xml @@ -16,5 +16,9 @@ + + + + diff --git a/conf/modules/ahrs_vectornav.xml b/conf/modules/ahrs_vectornav.xml index 21a5c7ba53..e189948205 100644 --- a/conf/modules/ahrs_vectornav.xml +++ b/conf/modules/ahrs_vectornav.xml @@ -43,5 +43,11 @@ else $(TARGET).CFLAGS += -DAHRS_TYPE_H=\"subsystems/ahrs/ahrs_vectornav_wrapper.h\" endif + + + + + + diff --git a/conf/modules/airspeed_adc.xml b/conf/modules/airspeed_adc.xml index 04d480c4c7..2d06efa947 100644 --- a/conf/modules/airspeed_adc.xml +++ b/conf/modules/airspeed_adc.xml @@ -27,6 +27,11 @@ + + + + + diff --git a/conf/modules/airspeed_ads1114.xml b/conf/modules/airspeed_ads1114.xml index be7a781343..7decfa81ca 100644 --- a/conf/modules/airspeed_ads1114.xml +++ b/conf/modules/airspeed_ads1114.xml @@ -16,6 +16,10 @@ + + + + diff --git a/conf/modules/airspeed_amsys.xml b/conf/modules/airspeed_amsys.xml index 9e7c4b5cf1..45512e27d7 100644 --- a/conf/modules/airspeed_amsys.xml +++ b/conf/modules/airspeed_amsys.xml @@ -38,6 +38,12 @@ + + + + + + diff --git a/conf/modules/airspeed_ets.xml b/conf/modules/airspeed_ets.xml index a32ec8534d..3c1d676ff8 100644 --- a/conf/modules/airspeed_ets.xml +++ b/conf/modules/airspeed_ets.xml @@ -40,6 +40,10 @@ + + + + diff --git a/conf/modules/airspeed_ms45xx_i2c.xml b/conf/modules/airspeed_ms45xx_i2c.xml index bf5bd70b6e..ee743797cc 100644 --- a/conf/modules/airspeed_ms45xx_i2c.xml +++ b/conf/modules/airspeed_ms45xx_i2c.xml @@ -43,5 +43,12 @@ + + + + + + + diff --git a/conf/modules/airspeed_otf.xml b/conf/modules/airspeed_otf.xml index fb4a1fa541..4c37037b06 100644 --- a/conf/modules/airspeed_otf.xml +++ b/conf/modules/airspeed_otf.xml @@ -27,6 +27,12 @@ + + + + + + diff --git a/conf/modules/airspeed_sdp3x.xml b/conf/modules/airspeed_sdp3x.xml index 408157fc0e..09abf49ab2 100644 --- a/conf/modules/airspeed_sdp3x.xml +++ b/conf/modules/airspeed_sdp3x.xml @@ -40,5 +40,13 @@ + + + + + + + + diff --git a/conf/modules/airspeed_uADC.xml b/conf/modules/airspeed_uADC.xml index b936dacfb7..a53ee2d9db 100644 --- a/conf/modules/airspeed_uADC.xml +++ b/conf/modules/airspeed_uADC.xml @@ -26,6 +26,12 @@ + + + + + + diff --git a/conf/modules/baro_bmp.xml b/conf/modules/baro_bmp.xml index 98f99149b0..f05b6cc48f 100644 --- a/conf/modules/baro_bmp.xml +++ b/conf/modules/baro_bmp.xml @@ -18,6 +18,13 @@ + + + + + + + diff --git a/conf/modules/baro_bmp3.xml b/conf/modules/baro_bmp3.xml index 67d2384768..f41e6f44b7 100644 --- a/conf/modules/baro_bmp3.xml +++ b/conf/modules/baro_bmp3.xml @@ -22,6 +22,10 @@ + + + + diff --git a/conf/modules/baro_hca.xml b/conf/modules/baro_hca.xml index db27c37d59..4728733c50 100644 --- a/conf/modules/baro_hca.xml +++ b/conf/modules/baro_hca.xml @@ -18,6 +18,12 @@ + + + + + + diff --git a/conf/modules/bebop_cam.xml b/conf/modules/bebop_cam.xml index ffdec72349..98e0743ebd 100644 --- a/conf/modules/bebop_cam.xml +++ b/conf/modules/bebop_cam.xml @@ -60,8 +60,8 @@ - - + + @@ -69,6 +69,9 @@ + + + diff --git a/conf/modules/charge_sens.xml b/conf/modules/charge_sens.xml index c7e52e1f26..c918cce285 100644 --- a/conf/modules/charge_sens.xml +++ b/conf/modules/charge_sens.xml @@ -15,6 +15,12 @@ + + + + + + diff --git a/conf/modules/dfu_command.xml b/conf/modules/dfu_command.xml index d6113f094b..42bc23b04d 100644 --- a/conf/modules/dfu_command.xml +++ b/conf/modules/dfu_command.xml @@ -19,8 +19,8 @@ - - + + diff --git a/conf/modules/fdm_jsbsim.xml b/conf/modules/fdm_jsbsim.xml index b02ab74148..a0a3ce1982 100644 --- a/conf/modules/fdm_jsbsim.xml +++ b/conf/modules/fdm_jsbsim.xml @@ -22,7 +22,7 @@ - + ifeq ($(FIND_JSBSIM_VIA_PKG_CONFIG), yes) nps.CFLAGS += $(shell pkg-config JSBSim --cflags) diff --git a/conf/modules/gps.xml b/conf/modules/gps.xml index 1f1054fe39..ad355560ed 100644 --- a/conf/modules/gps.xml +++ b/conf/modules/gps.xml @@ -34,6 +34,9 @@ + + + diff --git a/conf/modules/gps_datalink.xml b/conf/modules/gps_datalink.xml index 3eb6d9898c..7ff95bee85 100644 --- a/conf/modules/gps_datalink.xml +++ b/conf/modules/gps_datalink.xml @@ -35,6 +35,9 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_datalink.h\" endif + + + diff --git a/conf/modules/gps_furuno.xml b/conf/modules/gps_furuno.xml index 2dc4396a93..a8798a9b33 100644 --- a/conf/modules/gps_furuno.xml +++ b/conf/modules/gps_furuno.xml @@ -46,6 +46,13 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" endif + + + + + + + diff --git a/conf/modules/gps_mediatek_diy.xml b/conf/modules/gps_mediatek_diy.xml index 5bafea50b0..fff9678242 100644 --- a/conf/modules/gps_mediatek_diy.xml +++ b/conf/modules/gps_mediatek_diy.xml @@ -42,6 +42,13 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_mtk.h\" endif + + + + + + + diff --git a/conf/modules/gps_nmea.xml b/conf/modules/gps_nmea.xml index aeccf017ff..4cf997fd05 100644 --- a/conf/modules/gps_nmea.xml +++ b/conf/modules/gps_nmea.xml @@ -42,6 +42,13 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_nmea.h\" endif + + + + + + + diff --git a/conf/modules/gps_nps.xml b/conf/modules/gps_nps.xml index 1e053f4c67..5617b17650 100644 --- a/conf/modules/gps_nps.xml +++ b/conf/modules/gps_nps.xml @@ -17,5 +17,9 @@ + + + + diff --git a/conf/modules/gps_optitrack.xml b/conf/modules/gps_optitrack.xml index 8750261049..c487066886 100644 --- a/conf/modules/gps_optitrack.xml +++ b/conf/modules/gps_optitrack.xml @@ -15,6 +15,7 @@ + diff --git a/conf/modules/gps_piksi.xml b/conf/modules/gps_piksi.xml index ae2fc05845..45ead02506 100644 --- a/conf/modules/gps_piksi.xml +++ b/conf/modules/gps_piksi.xml @@ -45,6 +45,14 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_piksi.h\" endif + + + + + + + + diff --git a/conf/modules/gps_sim.xml b/conf/modules/gps_sim.xml index dc0ebc8cd0..fa9ed1ab9d 100644 --- a/conf/modules/gps_sim.xml +++ b/conf/modules/gps_sim.xml @@ -16,5 +16,6 @@ + diff --git a/conf/modules/gps_sim_hitl.xml b/conf/modules/gps_sim_hitl.xml index 021d40eac6..efbe4f5d9b 100644 --- a/conf/modules/gps_sim_hitl.xml +++ b/conf/modules/gps_sim_hitl.xml @@ -15,10 +15,9 @@ - - + diff --git a/conf/modules/gps_sirf.xml b/conf/modules/gps_sirf.xml index f004cd6521..8d71a9d8c7 100644 --- a/conf/modules/gps_sirf.xml +++ b/conf/modules/gps_sirf.xml @@ -42,6 +42,13 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_sirf.h\" endif + + + + + + + diff --git a/conf/modules/gps_skytraq.xml b/conf/modules/gps_skytraq.xml index 8151387497..3aa3d9b56a 100644 --- a/conf/modules/gps_skytraq.xml +++ b/conf/modules/gps_skytraq.xml @@ -42,6 +42,13 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_skytraq.h\" endif + + + + + + + diff --git a/conf/modules/gps_ublox.xml b/conf/modules/gps_ublox.xml index f06153bd74..a1a69f4947 100644 --- a/conf/modules/gps_ublox.xml +++ b/conf/modules/gps_ublox.xml @@ -42,6 +42,11 @@ $(TARGET).CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_ubx.h\" endif + + + + + diff --git a/conf/modules/gps_ubx_i2c.xml b/conf/modules/gps_ubx_i2c.xml index e58a5cb372..eacbdf4c88 100644 --- a/conf/modules/gps_ubx_i2c.xml +++ b/conf/modules/gps_ubx_i2c.xml @@ -26,6 +26,14 @@ + + + + + + + + diff --git a/conf/modules/gps_ubx_ucenter.xml b/conf/modules/gps_ubx_ucenter.xml index 0dbc039a35..764cae478b 100644 --- a/conf/modules/gps_ubx_ucenter.xml +++ b/conf/modules/gps_ubx_ucenter.xml @@ -43,6 +43,10 @@ Warning: you still need to tell the driver, which paparazzi port you use. + + + + diff --git a/conf/modules/gps_udp.xml b/conf/modules/gps_udp.xml index 236689e39d..be095fdd52 100644 --- a/conf/modules/gps_udp.xml +++ b/conf/modules/gps_udp.xml @@ -5,6 +5,8 @@ GPS via UDP. Read GPS messages from UDP port 7000. + + TODO not working; to be removed or fixed diff --git a/conf/modules/guidance_basic_fw.xml b/conf/modules/guidance_basic_fw.xml index de78e7c82f..6bd458916b 100644 --- a/conf/modules/guidance_basic_fw.xml +++ b/conf/modules/guidance_basic_fw.xml @@ -54,5 +54,16 @@ + + + + + + + + + + + diff --git a/conf/modules/hott_telemetry.xml b/conf/modules/hott_telemetry.xml index dba6bb0752..c4d7e3e47a 100644 --- a/conf/modules/hott_telemetry.xml +++ b/conf/modules/hott_telemetry.xml @@ -37,6 +37,11 @@ + + + + + diff --git a/conf/modules/i2c.xml b/conf/modules/i2c.xml index 1f0b46bc38..c66e12b13f 100644 --- a/conf/modules/i2c.xml +++ b/conf/modules/i2c.xml @@ -14,6 +14,8 @@ + + diff --git a/conf/modules/imu_analog.xml b/conf/modules/imu_analog.xml index 11d37b312f..0eb8541a5d 100644 --- a/conf/modules/imu_analog.xml +++ b/conf/modules/imu_analog.xml @@ -89,5 +89,15 @@ else ifeq ($(ARCH), stm32) $(error Not implemented for the stm32 yet... should be trivial, just do it...) endif + + + + + + + + + + diff --git a/conf/modules/imu_apogee.xml b/conf/modules/imu_apogee.xml index 2da7a2feb6..10d9e060ab 100644 --- a/conf/modules/imu_apogee.xml +++ b/conf/modules/imu_apogee.xml @@ -27,5 +27,12 @@ + + + + + + + diff --git a/conf/modules/imu_apogee_mpu9150.xml b/conf/modules/imu_apogee_mpu9150.xml index cfb1f006b7..91d20b41c8 100644 --- a/conf/modules/imu_apogee_mpu9150.xml +++ b/conf/modules/imu_apogee_mpu9150.xml @@ -26,5 +26,6 @@ + diff --git a/conf/modules/imu_ardrone2.xml b/conf/modules/imu_ardrone2.xml index 66c39efe02..1b0889af5a 100644 --- a/conf/modules/imu_ardrone2.xml +++ b/conf/modules/imu_ardrone2.xml @@ -26,5 +26,9 @@ + + + + diff --git a/conf/modules/imu_bebop.xml b/conf/modules/imu_bebop.xml index 4dcde257a4..1238091d1c 100644 --- a/conf/modules/imu_bebop.xml +++ b/conf/modules/imu_bebop.xml @@ -38,5 +38,13 @@ + + + + + + + + diff --git a/conf/modules/imu_bmi088_i2c.xml b/conf/modules/imu_bmi088_i2c.xml index 35a930f960..0a51435e84 100644 --- a/conf/modules/imu_bmi088_i2c.xml +++ b/conf/modules/imu_bmi088_i2c.xml @@ -37,5 +37,13 @@ + + + + + + + + diff --git a/conf/modules/imu_common.xml b/conf/modules/imu_common.xml index 56b3256bb2..36293f8202 100644 --- a/conf/modules/imu_common.xml +++ b/conf/modules/imu_common.xml @@ -24,5 +24,6 @@ + diff --git a/conf/modules/imu_disco.xml b/conf/modules/imu_disco.xml index 4a74a39bae..e458781029 100644 --- a/conf/modules/imu_disco.xml +++ b/conf/modules/imu_disco.xml @@ -34,6 +34,12 @@ + + + + + + diff --git a/conf/modules/imu_drotek_10dof_v2.xml b/conf/modules/imu_drotek_10dof_v2.xml index 3a144fcc35..f86bc4c8fc 100644 --- a/conf/modules/imu_drotek_10dof_v2.xml +++ b/conf/modules/imu_drotek_10dof_v2.xml @@ -37,5 +37,11 @@ + + + + + + diff --git a/conf/modules/imu_mpu6000.xml b/conf/modules/imu_mpu6000.xml index 158db1b364..8cc4e5b44a 100644 --- a/conf/modules/imu_mpu6000.xml +++ b/conf/modules/imu_mpu6000.xml @@ -37,5 +37,14 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + + diff --git a/conf/modules/imu_mpu6000_hmc5883.xml b/conf/modules/imu_mpu6000_hmc5883.xml index e6a779226b..8e04b773ba 100644 --- a/conf/modules/imu_mpu6000_hmc5883.xml +++ b/conf/modules/imu_mpu6000_hmc5883.xml @@ -61,5 +61,16 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + + + + diff --git a/conf/modules/imu_mpu9250.xml b/conf/modules/imu_mpu9250.xml index e47113d529..710dc43005 100644 --- a/conf/modules/imu_mpu9250.xml +++ b/conf/modules/imu_mpu9250.xml @@ -24,6 +24,13 @@ + + + + + + + diff --git a/conf/modules/imu_mpu9250_i2c.xml b/conf/modules/imu_mpu9250_i2c.xml index d00153c502..bce3fd9eef 100644 --- a/conf/modules/imu_mpu9250_i2c.xml +++ b/conf/modules/imu_mpu9250_i2c.xml @@ -39,5 +39,10 @@ + + + + + diff --git a/conf/modules/imu_mpu9250_spi.xml b/conf/modules/imu_mpu9250_spi.xml index 7f546a8f7a..3b187bd46c 100644 --- a/conf/modules/imu_mpu9250_spi.xml +++ b/conf/modules/imu_mpu9250_spi.xml @@ -48,5 +48,13 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + diff --git a/conf/modules/imu_px4fmu_v1.7.xml b/conf/modules/imu_px4fmu_v1.7.xml index d91c25005e..4e82fb9938 100644 --- a/conf/modules/imu_px4fmu_v1.7.xml +++ b/conf/modules/imu_px4fmu_v1.7.xml @@ -34,5 +34,15 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + + + diff --git a/conf/modules/imu_px4fmu_v2.4.xml b/conf/modules/imu_px4fmu_v2.4.xml index ddec36a89b..d00c9dc4fc 100644 --- a/conf/modules/imu_px4fmu_v2.4.xml +++ b/conf/modules/imu_px4fmu_v2.4.xml @@ -42,5 +42,17 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + + + + + diff --git a/conf/modules/imu_swing.xml b/conf/modules/imu_swing.xml index 856cbc30a9..00c9c75da0 100644 --- a/conf/modules/imu_swing.xml +++ b/conf/modules/imu_swing.xml @@ -22,5 +22,10 @@ + + + + + diff --git a/conf/modules/imu_xsens.xml b/conf/modules/imu_xsens.xml index 4078bbadb0..2ba607f6a4 100644 --- a/conf/modules/imu_xsens.xml +++ b/conf/modules/imu_xsens.xml @@ -30,6 +30,14 @@ + + + + + + + + diff --git a/conf/modules/ins.xml b/conf/modules/ins.xml index e5a5e45458..2d70868c3f 100644 --- a/conf/modules/ins.xml +++ b/conf/modules/ins.xml @@ -20,5 +20,6 @@ + diff --git a/conf/modules/ins_alt_float.xml b/conf/modules/ins_alt_float.xml index f4ad65942b..6959265bc4 100644 --- a/conf/modules/ins_alt_float.xml +++ b/conf/modules/ins_alt_float.xml @@ -20,5 +20,6 @@ + diff --git a/conf/modules/ins_extended.xml b/conf/modules/ins_extended.xml index df80c044dd..a0dc1183dd 100644 --- a/conf/modules/ins_extended.xml +++ b/conf/modules/ins_extended.xml @@ -43,5 +43,6 @@ + diff --git a/conf/modules/ins_float_invariant.xml b/conf/modules/ins_float_invariant.xml index 9bf6453797..d8778a200f 100644 --- a/conf/modules/ins_float_invariant.xml +++ b/conf/modules/ins_float_invariant.xml @@ -45,6 +45,7 @@ + diff --git a/conf/modules/ins_gps_passthrough.xml b/conf/modules/ins_gps_passthrough.xml index 4b26605e65..67e0e35d5e 100644 --- a/conf/modules/ins_gps_passthrough.xml +++ b/conf/modules/ins_gps_passthrough.xml @@ -15,6 +15,7 @@ + diff --git a/conf/modules/ins_hff.xml b/conf/modules/ins_hff.xml index 512457268a..e536cd22f2 100644 --- a/conf/modules/ins_hff.xml +++ b/conf/modules/ins_hff.xml @@ -22,5 +22,8 @@ + + + diff --git a/conf/modules/ins_hff_extended.xml b/conf/modules/ins_hff_extended.xml index e333d5a33d..2891e89395 100644 --- a/conf/modules/ins_hff_extended.xml +++ b/conf/modules/ins_hff_extended.xml @@ -39,5 +39,8 @@ + + + diff --git a/conf/modules/ins_mekf_wind.xml b/conf/modules/ins_mekf_wind.xml index 0389d75536..c584029606 100644 --- a/conf/modules/ins_mekf_wind.xml +++ b/conf/modules/ins_mekf_wind.xml @@ -77,6 +77,10 @@ + + + + diff --git a/conf/modules/ins_nps.xml b/conf/modules/ins_nps.xml index b4882e49d3..cafba1bc2a 100644 --- a/conf/modules/ins_nps.xml +++ b/conf/modules/ins_nps.xml @@ -19,6 +19,10 @@ + + + + diff --git a/conf/modules/ins_sim.xml b/conf/modules/ins_sim.xml index 0656cc7da0..5d3b4053a7 100644 --- a/conf/modules/ins_sim.xml +++ b/conf/modules/ins_sim.xml @@ -20,5 +20,9 @@ + + + + diff --git a/conf/modules/ins_skeleton.xml b/conf/modules/ins_skeleton.xml index 30d679293f..7c8558c2f5 100644 --- a/conf/modules/ins_skeleton.xml +++ b/conf/modules/ins_skeleton.xml @@ -26,5 +26,6 @@ + diff --git a/conf/modules/ins_vectornav.xml b/conf/modules/ins_vectornav.xml index e4c852d2b9..3c61650205 100644 --- a/conf/modules/ins_vectornav.xml +++ b/conf/modules/ins_vectornav.xml @@ -50,5 +50,11 @@ ap.CFLAGS += -DGPS_TYPE_H=\"subsystems/gps/gps_ubx.h\" endif + + + + + + diff --git a/conf/modules/ins_vn100.xml b/conf/modules/ins_vn100.xml index 5e5959bcb0..1fab93d8e0 100644 --- a/conf/modules/ins_vn100.xml +++ b/conf/modules/ins_vn100.xml @@ -25,6 +25,14 @@ + + + + + + + + diff --git a/conf/modules/ins_xsens.xml b/conf/modules/ins_xsens.xml index c97e6f61f4..5cb433d6b9 100644 --- a/conf/modules/ins_xsens.xml +++ b/conf/modules/ins_xsens.xml @@ -37,6 +37,17 @@ + + + + + + + + + + + diff --git a/conf/modules/ins_xsens700.xml b/conf/modules/ins_xsens700.xml index 77746fef3c..4f1f2c603a 100644 --- a/conf/modules/ins_xsens700.xml +++ b/conf/modules/ins_xsens700.xml @@ -36,6 +36,17 @@ + + + + + + + + + + + diff --git a/conf/modules/logger_sd_chibios.xml b/conf/modules/logger_sd_chibios.xml index 33d2ca1664..39eb19c4ec 100644 --- a/conf/modules/logger_sd_chibios.xml +++ b/conf/modules/logger_sd_chibios.xml @@ -35,5 +35,19 @@ + diff --git a/conf/modules/mag_hmc5843.xml b/conf/modules/mag_hmc5843.xml index 0f61d02028..ed7e084408 100644 --- a/conf/modules/mag_hmc5843.xml +++ b/conf/modules/mag_hmc5843.xml @@ -18,5 +18,13 @@ + + + + + + + + diff --git a/conf/modules/mag_hmc58xx.xml b/conf/modules/mag_hmc58xx.xml index 1e5e8bc5ef..78492471d9 100644 --- a/conf/modules/mag_hmc58xx.xml +++ b/conf/modules/mag_hmc58xx.xml @@ -32,7 +32,6 @@ - ifeq ($(MAG_HMC58XX_I2C_DEV),) $(error mag_hmc58xx module error: please configure MAG_HMC58XX_I2C_DEV) @@ -41,5 +40,12 @@ + + + + + + + diff --git a/conf/modules/mag_ist8310.xml b/conf/modules/mag_ist8310.xml index 5f94c8dad6..b032e6db36 100644 --- a/conf/modules/mag_ist8310.xml +++ b/conf/modules/mag_ist8310.xml @@ -38,5 +38,12 @@ + + + + + + + diff --git a/conf/modules/mag_lis3mdl.xml b/conf/modules/mag_lis3mdl.xml index 8334baecbd..4a591d984d 100644 --- a/conf/modules/mag_lis3mdl.xml +++ b/conf/modules/mag_lis3mdl.xml @@ -38,5 +38,12 @@ + + + + + + + diff --git a/conf/modules/mag_pitot_uart.xml b/conf/modules/mag_pitot_uart.xml index d4652619b1..341673aedc 100644 --- a/conf/modules/mag_pitot_uart.xml +++ b/conf/modules/mag_pitot_uart.xml @@ -28,6 +28,10 @@ + + + + diff --git a/conf/modules/mission_fw.xml b/conf/modules/mission_fw.xml index bda8626a09..de5a4b4dce 100644 --- a/conf/modules/mission_fw.xml +++ b/conf/modules/mission_fw.xml @@ -31,5 +31,11 @@ + + + + + + diff --git a/conf/modules/mission_rotorcraft.xml b/conf/modules/mission_rotorcraft.xml index 0412d56a73..a9fd03055a 100644 --- a/conf/modules/mission_rotorcraft.xml +++ b/conf/modules/mission_rotorcraft.xml @@ -31,5 +31,10 @@ + + + + + diff --git a/conf/modules/module.dtd b/conf/modules/module.dtd index 83b8ab6fde..5d59a69bc7 100644 --- a/conf/modules/module.dtd +++ b/conf/modules/module.dtd @@ -13,7 +13,8 @@ - + + @@ -22,6 +23,7 @@ + @@ -95,6 +97,9 @@ name CDATA #REQUIRED value CDATA #REQUIRED cond CDATA #IMPLIED> + + + + + diff --git a/conf/modules/nav_basic_fw.xml b/conf/modules/nav_basic_fw.xml index cfc4883124..ef5cb74c7e 100644 --- a/conf/modules/nav_basic_fw.xml +++ b/conf/modules/nav_basic_fw.xml @@ -34,5 +34,11 @@ + + + + + + diff --git a/conf/modules/nav_basic_rotorcraft.xml b/conf/modules/nav_basic_rotorcraft.xml index 302eea5f6b..9a6aacc39a 100644 --- a/conf/modules/nav_basic_rotorcraft.xml +++ b/conf/modules/nav_basic_rotorcraft.xml @@ -27,5 +27,11 @@ + + + + + + diff --git a/conf/modules/nav_bungee_takeoff.xml b/conf/modules/nav_bungee_takeoff.xml index 3630232f18..df0f44a9ab 100644 --- a/conf/modules/nav_bungee_takeoff.xml +++ b/conf/modules/nav_bungee_takeoff.xml @@ -24,5 +24,8 @@ + + + diff --git a/conf/modules/nav_catapult.xml b/conf/modules/nav_catapult.xml index fdcc013898..4d8f76a23c 100644 --- a/conf/modules/nav_catapult.xml +++ b/conf/modules/nav_catapult.xml @@ -52,6 +52,10 @@ Block example: + + + + diff --git a/conf/modules/nav_cube.xml b/conf/modules/nav_cube.xml index c6b96ce4cc..d0ba754ec7 100644 --- a/conf/modules/nav_cube.xml +++ b/conf/modules/nav_cube.xml @@ -29,5 +29,6 @@ + diff --git a/conf/modules/nav_drop.xml b/conf/modules/nav_drop.xml index af2f6224e5..a19deff3f7 100644 --- a/conf/modules/nav_drop.xml +++ b/conf/modules/nav_drop.xml @@ -13,5 +13,6 @@ + diff --git a/conf/modules/nav_fish.xml b/conf/modules/nav_fish.xml index 3d4331b2ef..aa6be6f46f 100644 --- a/conf/modules/nav_fish.xml +++ b/conf/modules/nav_fish.xml @@ -50,5 +50,10 @@ + + + + + diff --git a/conf/modules/nav_flower.xml b/conf/modules/nav_flower.xml index e8eb6990c9..751d743b79 100644 --- a/conf/modules/nav_flower.xml +++ b/conf/modules/nav_flower.xml @@ -12,5 +12,8 @@ + + + diff --git a/conf/modules/nav_gls.xml b/conf/modules/nav_gls.xml index a7f350df2f..7833782716 100644 --- a/conf/modules/nav_gls.xml +++ b/conf/modules/nav_gls.xml @@ -14,5 +14,8 @@ + + + diff --git a/conf/modules/nav_heli_spinup.xml b/conf/modules/nav_heli_spinup.xml index 681b251834..c2976a5958 100644 --- a/conf/modules/nav_heli_spinup.xml +++ b/conf/modules/nav_heli_spinup.xml @@ -14,6 +14,10 @@ + + + + diff --git a/conf/modules/nav_launcher.xml b/conf/modules/nav_launcher.xml index 2851398ba9..3852c5bbc3 100644 --- a/conf/modules/nav_launcher.xml +++ b/conf/modules/nav_launcher.xml @@ -17,6 +17,9 @@ + + + diff --git a/conf/modules/nav_line.xml b/conf/modules/nav_line.xml index dcc9211d15..36860ddb12 100644 --- a/conf/modules/nav_line.xml +++ b/conf/modules/nav_line.xml @@ -16,5 +16,8 @@ + + + diff --git a/conf/modules/nav_line_border.xml b/conf/modules/nav_line_border.xml index 5aefa752ac..080e8c2a87 100644 --- a/conf/modules/nav_line_border.xml +++ b/conf/modules/nav_line_border.xml @@ -21,5 +21,8 @@ + + + diff --git a/conf/modules/nav_line_osam.xml b/conf/modules/nav_line_osam.xml index 6199ca08e1..2505f0aca4 100644 --- a/conf/modules/nav_line_osam.xml +++ b/conf/modules/nav_line_osam.xml @@ -11,5 +11,8 @@ + + + diff --git a/conf/modules/nav_poles.xml b/conf/modules/nav_poles.xml index c29e0a6e45..6af8c16086 100644 --- a/conf/modules/nav_poles.xml +++ b/conf/modules/nav_poles.xml @@ -18,6 +18,7 @@ + diff --git a/conf/modules/nav_rover_base.xml b/conf/modules/nav_rover_base.xml index c736a7ff18..25facbf880 100644 --- a/conf/modules/nav_rover_base.xml +++ b/conf/modules/nav_rover_base.xml @@ -26,6 +26,12 @@ + + + + + + diff --git a/conf/modules/nav_skid_landing.xml b/conf/modules/nav_skid_landing.xml index a6a30307a6..f640b268fd 100644 --- a/conf/modules/nav_skid_landing.xml +++ b/conf/modules/nav_skid_landing.xml @@ -55,6 +55,10 @@ + + + + diff --git a/conf/modules/nav_smooth.xml b/conf/modules/nav_smooth.xml index adb88405f6..80aa0d9496 100644 --- a/conf/modules/nav_smooth.xml +++ b/conf/modules/nav_smooth.xml @@ -18,5 +18,8 @@ + + + diff --git a/conf/modules/nav_spiral.xml b/conf/modules/nav_spiral.xml index cbf1e14f0d..43aaae1233 100644 --- a/conf/modules/nav_spiral.xml +++ b/conf/modules/nav_spiral.xml @@ -16,5 +16,8 @@ + + + diff --git a/conf/modules/nav_survey_disc.xml b/conf/modules/nav_survey_disc.xml index e8798c110f..a9ee9079f3 100644 --- a/conf/modules/nav_survey_disc.xml +++ b/conf/modules/nav_survey_disc.xml @@ -11,5 +11,8 @@ + + + diff --git a/conf/modules/nav_survey_poly_osam.xml b/conf/modules/nav_survey_poly_osam.xml index a3abc46a2c..6f8597dcbe 100644 --- a/conf/modules/nav_survey_poly_osam.xml +++ b/conf/modules/nav_survey_poly_osam.xml @@ -33,5 +33,8 @@ You can use: + + + diff --git a/conf/modules/nav_survey_poly_rotorcraft.xml b/conf/modules/nav_survey_poly_rotorcraft.xml index 7dc2ba913c..0fafc9dfd9 100644 --- a/conf/modules/nav_survey_poly_rotorcraft.xml +++ b/conf/modules/nav_survey_poly_rotorcraft.xml @@ -29,5 +29,6 @@ You can use: + diff --git a/conf/modules/nav_survey_polygon.xml b/conf/modules/nav_survey_polygon.xml index 7932937646..0a81ab61c3 100644 --- a/conf/modules/nav_survey_polygon.xml +++ b/conf/modules/nav_survey_polygon.xml @@ -31,5 +31,8 @@ Block example: + + + diff --git a/conf/modules/nav_survey_rectangle_rotorcraft.xml b/conf/modules/nav_survey_rectangle_rotorcraft.xml index 949ed54c3d..3ea27521fe 100644 --- a/conf/modules/nav_survey_rectangle_rotorcraft.xml +++ b/conf/modules/nav_survey_rectangle_rotorcraft.xml @@ -46,5 +46,6 @@ or using flightplan primitive + diff --git a/conf/modules/nav_survey_zamboni.xml b/conf/modules/nav_survey_zamboni.xml index 59d6ac5521..cc31ce5992 100644 --- a/conf/modules/nav_survey_zamboni.xml +++ b/conf/modules/nav_survey_zamboni.xml @@ -11,5 +11,8 @@ + + + diff --git a/conf/modules/nav_vertical_raster.xml b/conf/modules/nav_vertical_raster.xml index d853eae613..808291afae 100644 --- a/conf/modules/nav_vertical_raster.xml +++ b/conf/modules/nav_vertical_raster.xml @@ -11,5 +11,8 @@ + + + diff --git a/conf/modules/radio_control_cc2500_frsky.xml b/conf/modules/radio_control_cc2500_frsky.xml index 4965373b6b..a7c45859b1 100644 --- a/conf/modules/radio_control_cc2500_frsky.xml +++ b/conf/modules/radio_control_cc2500_frsky.xml @@ -67,5 +67,16 @@ include $(CFG_SHARED)/spi_master.makefile + + + + + + + + + + + diff --git a/conf/modules/radio_control_datalink.xml b/conf/modules/radio_control_datalink.xml index 8e622a9dbf..81e8c00ab0 100644 --- a/conf/modules/radio_control_datalink.xml +++ b/conf/modules/radio_control_datalink.xml @@ -29,6 +29,11 @@ + + + + + diff --git a/conf/modules/radio_control_hott.xml b/conf/modules/radio_control_hott.xml index b5d958b640..2487a6cda2 100644 --- a/conf/modules/radio_control_hott.xml +++ b/conf/modules/radio_control_hott.xml @@ -36,6 +36,13 @@ + + + + + + + diff --git a/conf/modules/radio_control_ppm.xml b/conf/modules/radio_control_ppm.xml index a6f3c1fddf..1a6af7b651 100644 --- a/conf/modules/radio_control_ppm.xml +++ b/conf/modules/radio_control_ppm.xml @@ -27,14 +27,19 @@ - + - + + + + + + diff --git a/conf/modules/radio_control_sbus.xml b/conf/modules/radio_control_sbus.xml index a59429b800..a72c561d78 100644 --- a/conf/modules/radio_control_sbus.xml +++ b/conf/modules/radio_control_sbus.xml @@ -38,6 +38,13 @@ + + + + + + + diff --git a/conf/modules/radio_control_sbus_dual.xml b/conf/modules/radio_control_sbus_dual.xml index e57e3bcee1..a39face4d3 100644 --- a/conf/modules/radio_control_sbus_dual.xml +++ b/conf/modules/radio_control_sbus_dual.xml @@ -44,6 +44,15 @@ + + + + + + + + + diff --git a/conf/modules/radio_control_spektrum.xml b/conf/modules/radio_control_spektrum.xml index d890d052b8..8e7bc531f2 100644 --- a/conf/modules/radio_control_spektrum.xml +++ b/conf/modules/radio_control_spektrum.xml @@ -68,12 +68,28 @@ + + + + + + + + + + + + + + + + diff --git a/conf/modules/radio_control_superbitrf_rc.xml b/conf/modules/radio_control_superbitrf_rc.xml index 3936f788ac..3baeaaae77 100644 --- a/conf/modules/radio_control_superbitrf_rc.xml +++ b/conf/modules/radio_control_superbitrf_rc.xml @@ -50,6 +50,22 @@ + + + + + + + + + + + + + + + + diff --git a/conf/modules/range_forcefield.xml b/conf/modules/range_forcefield.xml index 45849d252e..d07cff9ea0 100644 --- a/conf/modules/range_forcefield.xml +++ b/conf/modules/range_forcefield.xml @@ -32,5 +32,7 @@ + + diff --git a/conf/modules/telemetry_ivy.xml b/conf/modules/telemetry_ivy.xml index e3b2319545..c8326a14d7 100644 --- a/conf/modules/telemetry_ivy.xml +++ b/conf/modules/telemetry_ivy.xml @@ -24,6 +24,9 @@ + + + diff --git a/sw/airborne/Makefile b/sw/airborne/Makefile index 262d3ff59e..1e16e1ac6d 100644 --- a/sw/airborne/Makefile +++ b/sw/airborne/Makefile @@ -35,6 +35,11 @@ INCLUDES = -I$(PAPARAZZI_SRC)/sw/include -I$(PAPARAZZI_SRC)/sw/airborne -I$(PAPA VPATH = . +# AND and OR variables to be used in XML module files +AND = && +OR = || +REDIRECT = > + ifneq ($(MAKECMDGOALS),clean) include $(AIRCRAFT_BUILD_DIR)/Makefile.ac $(TARGET).srcs += $($(TARGET).EXTRA_SRCS) diff --git a/sw/airborne/boards/ardrone/actuators.c b/sw/airborne/boards/ardrone/actuators.c index 5186e53e91..2f611969bf 100644 --- a/sw/airborne/boards/ardrone/actuators.c +++ b/sw/airborne/boards/ardrone/actuators.c @@ -71,7 +71,7 @@ static inline void actuators_ardrone_reset_flipflop(void) { gpio_setup_output(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP); gpio_clear(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP); - int32_t stop = sys_time.nb_sec + 2; + uint32_t stop = sys_time.nb_sec + 2; while (sys_time.nb_sec < stop); gpio_set(ARDRONE_GPIO_PORT, ARDRONE_GPIO_PIN_IRQ_FLIPFLOP); } diff --git a/sw/airborne/boards/bebop/mt9f002.c b/sw/airborne/boards/bebop/mt9f002.c index 391da6ed1a..813da9c807 100644 --- a/sw/airborne/boards/bebop/mt9f002.c +++ b/sw/airborne/boards/bebop/mt9f002.c @@ -1108,7 +1108,7 @@ void mt9f002_reset_exposure(struct mt9f002_t *mt) /* Handler for propagating user resolution change so the camera * */ -void mt9f002_setting_update_resolution(float in) +void mt9f002_setting_update_resolution(float in UNUSED) { mt9f002.sensor_width = CFG_MT9F002_PIXEL_ARRAY_WIDTH / mt9f002.set_zoom; mt9f002.sensor_height = CFG_MT9F002_PIXEL_ARRAY_HEIGHT / mt9f002.set_zoom; @@ -1130,12 +1130,12 @@ void mt9f002_setting_update_resolution(float in) isp_request_statistics_yuv_window(0, mt9f002.sensor_width, 0, mt9f002.sensor_height, 1, 1); } -void mt9f002_setting_update_color(float in) +void mt9f002_setting_update_color(float in UNUSED) { mt9f002_set_gains(&mt9f002); } -void mt9f002_setting_update_exposure(float in) +void mt9f002_setting_update_exposure(float in UNUSED) { mt9f002_set_exposure(&mt9f002); } diff --git a/sw/airborne/modules/gps/gps_ubx_i2c.c b/sw/airborne/modules/gps/gps_ubx_i2c.c index 8698ae59d2..c04cd7cf5a 100644 --- a/sw/airborne/modules/gps/gps_ubx_i2c.c +++ b/sw/airborne/modules/gps/gps_ubx_i2c.c @@ -33,6 +33,7 @@ #include "modules/gps/gps_ubx_i2c.h" #include "subsystems/datalink/downlink.h" #include +#include // ublox i2c address #define GPS_I2C_SLAVE_ADDR (0x42 << 1) @@ -55,7 +56,7 @@ uint16_t gps_ubx_i2c_bytes_to_read; ///< ublox bytes to read /** null function * @param p unused */ -void null_function(struct GpsUbxI2C *p); +void null_function(struct GpsUbxI2C *p, uint32_t baudrate); /** Check available space in transmit buffer * @param p unused @@ -120,7 +121,7 @@ void gps_ubx_i2c_init(void) gps_i2c.device.set_baudrate = (set_baudrate_t)null_function; ///< set device baudrate } -void null_function(struct GpsUbxI2C *p __attribute__((unused))) {} +void null_function(struct GpsUbxI2C *p __attribute__((unused)), uint32_t baudrate __attribute__((unused))) {} int gps_i2c_check_free_space(struct GpsUbxI2C *p __attribute__((unused)), long *fd __attribute__((unused)), uint16_t len) { diff --git a/sw/airborne/modules/gsm/gsm.c b/sw/airborne/modules/gsm/gsm.c index bcd0fe39f4..23cd7eaa76 100644 --- a/sw/airborne/modules/gsm/gsm.c +++ b/sw/airborne/modules/gsm/gsm.c @@ -64,6 +64,7 @@ Receiving: #include "subsystems/electrical.h" //#include "subsystems/navigation/common_nav.h" //why is should this be needed? #include "generated/settings.h" +#include "led.h" #ifndef GSM_LINK #define GSM_LINK UART3100 diff --git a/sw/airborne/modules/ins/ins_mekf_wind_wrapper.c b/sw/airborne/modules/ins/ins_mekf_wind_wrapper.c index 1190b89673..38448fd3a4 100644 --- a/sw/airborne/modules/ins/ins_mekf_wind_wrapper.c +++ b/sw/airborne/modules/ins/ins_mekf_wind_wrapper.c @@ -26,6 +26,7 @@ #include "modules/ins/ins_mekf_wind_wrapper.h" #include "modules/ins/ins_mekf_wind.h" +#include "modules/air_data/air_data.h" #include "subsystems/ahrs/ahrs_float_utils.h" #if USE_AHRS_ALIGNER #include "subsystems/ahrs/ahrs_aligner.h" diff --git a/sw/airborne/modules/ins/ins_skeleton.c b/sw/airborne/modules/ins/ins_skeleton.c index 6ccb5ec602..454f9754ec 100644 --- a/sw/airborne/modules/ins/ins_skeleton.c +++ b/sw/airborne/modules/ins/ins_skeleton.c @@ -72,6 +72,76 @@ struct InsModuleInt ins_module; void ins_module_wrapper_init(void); +/** copy position and speed to state interface */ +static void ins_ned_to_state(void) +{ + stateSetPositionNed_i(&ins_module.ltp_pos); + stateSetSpeedNed_i(&ins_module.ltp_speed); + stateSetAccelNed_i(&ins_module.ltp_accel); + +#if defined SITL && USE_NPS + if (nps_bypass_ins) { + sim_overwrite_ins(); + } +#endif +} + +/*********************************************************** + * ABI callback functions + **********************************************************/ + +static void baro_cb(uint8_t __attribute__((unused)) sender_id, __attribute__((unused)) uint32_t stamp, float pressure) +{ + /* call module implementation */ + ins_module_update_baro(pressure); + ins_ned_to_state(); +} + +static void accel_cb(uint8_t sender_id __attribute__((unused)), + uint32_t stamp, struct Int32Vect3 *accel) +{ + /* timestamp in usec when last callback was received */ + static uint32_t last_stamp = 0; + + if (last_stamp > 0) { + float dt = (float)(stamp - last_stamp) * 1e-6; + /* call module implementation */ + ins_module_propagate(accel, dt); + ins_ned_to_state(); + } + last_stamp = stamp; +} + +static void gps_cb(uint8_t sender_id __attribute__((unused)), + uint32_t stamp, struct GpsState *gps_s) +{ + /* timestamp in usec when last callback was received */ + static uint32_t last_stamp = 0; + + if (last_stamp > 0) { + float dt = (float)(stamp - last_stamp) * 1e-6; + + /* copy GPS state */ + ins_module.gps = *gps_s; + + if (!ins_module.ltp_initialized) { + ins_reset_local_origin(); + } + + if (gps_s->fix >= GPS_FIX_3D) { + /* call module implementation */ + ins_module_update_gps(gps_s, dt); + ins_ned_to_state(); + } + } + last_stamp = stamp; +} + +static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), + struct FloatQuat *q_b2i_f) +{ + orientationSetQuat_f(&ins_module.body_to_imu, q_b2i_f); +} /********************************************************************* * weak functions that are used if not implemented in a module ********************************************************************/ @@ -172,73 +242,3 @@ void ins_module_wrapper_init(void) AbiBindMsgBODY_TO_IMU_QUAT(INS_MODULE_IMU_ID, &body_to_imu_ev, body_to_imu_cb); } -/** copy position and speed to state interface */ -static void ins_ned_to_state(void) -{ - stateSetPositionNed_i(&ins_module.ltp_pos); - stateSetSpeedNed_i(&ins_module.ltp_speed); - stateSetAccelNed_i(&ins_module.ltp_accel); - -#if defined SITL && USE_NPS - if (nps_bypass_ins) { - sim_overwrite_ins(); - } -#endif -} - -/*********************************************************** - * ABI callback functions - **********************************************************/ - -static void baro_cb(uint8_t __attribute__((unused)) sender_id, __attribute__((unused)) uint32_t stamp, float pressure) -{ - /* call module implementation */ - ins_module_update_baro(pressure); - ins_ned_to_state(); -} - -static void accel_cb(uint8_t sender_id __attribute__((unused)), - uint32_t stamp, struct Int32Vect3 *accel) -{ - /* timestamp in usec when last callback was received */ - static uint32_t last_stamp = 0; - - if (last_stamp > 0) { - float dt = (float)(stamp - last_stamp) * 1e-6; - /* call module implementation */ - ins_module_propagate(accel, dt); - ins_ned_to_state(); - } - last_stamp = stamp; -} - -static void gps_cb(uint8_t sender_id __attribute__((unused)), - uint32_t stamp, struct GpsState *gps_s) -{ - /* timestamp in usec when last callback was received */ - static uint32_t last_stamp = 0; - - if (last_stamp > 0) { - float dt = (float)(stamp - last_stamp) * 1e-6; - - /* copy GPS state */ - ins_module.gps = *gps_s; - - if (!ins_module.ltp_initialized) { - ins_reset_local_origin(); - } - - if (gps_s->fix >= GPS_FIX_3D) { - /* call module implementation */ - ins_module_update_gps(gps_s, dt); - ins_ned_to_state(); - } - } - last_stamp = stamp; -} - -static void body_to_imu_cb(uint8_t sender_id __attribute__((unused)), - struct FloatQuat *q_b2i_f) -{ - orientationSetQuat_f(&ins_module.body_to_imu, q_b2i_f); -} diff --git a/sw/airborne/modules/ins/ins_xsens.c b/sw/airborne/modules/ins/ins_xsens.c index 09e252c55a..011a1d13ec 100644 --- a/sw/airborne/modules/ins/ins_xsens.c +++ b/sw/airborne/modules/ins/ins_xsens.c @@ -157,7 +157,9 @@ static void handle_ins_msg(void) update_state_interface(); if (xsens.new_attitude) { +#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP new_ins_attitude = true; +#endif xsens.new_attitude = false; } diff --git a/sw/airborne/modules/ins/ins_xsens700.c b/sw/airborne/modules/ins/ins_xsens700.c index cebd3801b1..8c3a280b16 100644 --- a/sw/airborne/modules/ins/ins_xsens700.c +++ b/sw/airborne/modules/ins/ins_xsens700.c @@ -164,7 +164,9 @@ void handle_ins_msg(void) update_state_interface(); if (xsens700.new_attitude) { +#ifdef AHRS_TRIGGERED_ATTITUDE_LOOP new_ins_attitude = true; +#endif xsens700.new_attitude = false; } diff --git a/sw/airborne/modules/nav/nav_survey_disc.c b/sw/airborne/modules/nav/nav_survey_disc.c index b521b02352..a7400db048 100644 --- a/sw/airborne/modules/nav/nav_survey_disc.c +++ b/sw/airborne/modules/nav/nav_survey_disc.c @@ -100,6 +100,7 @@ bool nav_survey_disc_run(uint8_t center_wp, float radius) disc_survey.c2.y = waypoints[center_wp].y - upwind.y * radius; disc_survey.status = SEGMENT; /* No break; */ + /* fallthrough */ case SEGMENT: nav_route_xy(disc_survey.c1.x, disc_survey.c1.y, disc_survey.c2.x, disc_survey.c2.y); diff --git a/sw/airborne/modules/sensors/airspeed_ads1114.c b/sw/airborne/modules/sensors/airspeed_ads1114.c index 7ceea669fc..f8f226aba6 100644 --- a/sw/airborne/modules/sensors/airspeed_ads1114.c +++ b/sw/airborne/modules/sensors/airspeed_ads1114.c @@ -28,6 +28,7 @@ #include "modules/sensors/airspeed_ads1114.h" #include "subsystems/sensors/baro.h" #include "baro_board.h" +#include "peripherals/ads1114.h" void airspeed_periodic(void) { diff --git a/sw/airborne/modules/sensors/airspeed_uADC.c b/sw/airborne/modules/sensors/airspeed_uADC.c index 55a3e3c9b0..ec26b77dac 100644 --- a/sw/airborne/modules/sensors/airspeed_uADC.c +++ b/sw/airborne/modules/sensors/airspeed_uADC.c @@ -34,6 +34,7 @@ #include "subsystems/datalink/downlink.h" #include +#include #if FLIGHTRECORDER_SDLOG #include "subsystems/datalink/telemetry.h" diff --git a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c index 3c15fc9f3e..5fbeaea58b 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c +++ b/sw/airborne/subsystems/ahrs/ahrs_float_dcm.c @@ -172,7 +172,7 @@ void ahrs_dcm_propagate(struct FloatRates *gyro, float dt) compute_ahrs_representations(); } -void ahrs_dcm_update_gps(struct GpsState *gps_s) +void ahrs_dcm_update_gps(struct GpsState *gps_s UNUSED) { static float last_gps_speed_3d = 0; diff --git a/sw/airborne/subsystems/ahrs/ahrs_gx3.c b/sw/airborne/subsystems/ahrs/ahrs_gx3.c index ecf3259974..7c9075ac0e 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_gx3.c +++ b/sw/airborne/subsystems/ahrs/ahrs_gx3.c @@ -35,6 +35,7 @@ // for ahrs_register_impl #include "subsystems/ahrs.h" +#include "subsystems/abi.h" #define GX3_CHKSM(_ubx_payload) (uint16_t)((uint16_t)(*((uint8_t*)_ubx_payload+66+1))|(uint16_t)(*((uint8_t*)_ubx_payload+66+0))<<8) @@ -260,13 +261,13 @@ void gx3_packet_read_message(void) struct FloatRates body_rate; /* compute body rates */ struct FloatRMat *body_to_imu_rmat = orientationGetRMat_f(&imu.body_to_imu); - FLOAT_RMAT_TRANSP_RATEMULT(body_rate, *body_to_imu_rmat, ahrs_gx3.rate); + float_rmat_ratemult(&body_rate, body_to_imu_rmat, &ahrs_gx3.rate); /* Set state */ stateSetBodyRates_f(&body_rate); // Attitude struct FloatRMat ltp_to_body_rmat; - float_rmat_comp(ltp_to_body_rmat, ahrs_gx3.rmat, *body_to_imu_rmat); + float_rmat_comp(<p_to_body_rmat, &ahrs_gx3.rmat, body_to_imu_rmat); #if AHRS_USE_GPS_HEADING && USE_GPS struct FloatEulers ltp_to_body_eulers; diff --git a/sw/airborne/subsystems/ahrs/ahrs_vectornav.c b/sw/airborne/subsystems/ahrs/ahrs_vectornav.c index c0f3255aa0..9cfd517f28 100644 --- a/sw/airborne/subsystems/ahrs/ahrs_vectornav.c +++ b/sw/airborne/subsystems/ahrs/ahrs_vectornav.c @@ -26,7 +26,9 @@ * @author Michal Podhradsky */ #include "subsystems/ahrs/ahrs_vectornav.h" +#include "subsystems/ahrs/ahrs_vectornav_wrapper.h" #include "subsystems/abi.h" +#include "state.h" struct AhrsVectornav ahrs_vn; diff --git a/sw/airborne/subsystems/imu/imu_nps.c b/sw/airborne/subsystems/imu/imu_nps.c index 26b1c7bff4..c9fc29c5b0 100644 --- a/sw/airborne/subsystems/imu/imu_nps.c +++ b/sw/airborne/subsystems/imu/imu_nps.c @@ -22,7 +22,7 @@ #include "subsystems/imu.h" #include "subsystems/abi.h" #include "generated/airframe.h" - +#include "subsystems/imu/imu_nps.h" #include "nps_sensors.h" struct ImuNps imu_nps; diff --git a/sw/airborne/subsystems/radio_control/spektrum.c b/sw/airborne/subsystems/radio_control/spektrum.c index 435628321e..d58db5dd55 100644 --- a/sw/airborne/subsystems/radio_control/spektrum.c +++ b/sw/airborne/subsystems/radio_control/spektrum.c @@ -41,9 +41,6 @@ #error "You must at least define the primary Spektrum satellite receiver." #endif -/* Changed radio control order Notice */ -INFO("Radio-Control now follows PPRZ sign convention: this means you might need to reverese some channels in your transmitter: RollRight / PitchUp / YawRight / FullThrottle / Auto2 are positive deflections") - /* Number of low pulses sent during binding to the satellite receivers * Spektrum documentation recommend that master and slave receivers * should be configured in DSMX 11ms mode, other modes (DSM2, 22ms) will be diff --git a/sw/airborne/subsystems/radio_control/superbitrf_rc.c b/sw/airborne/subsystems/radio_control/superbitrf_rc.c index c804fab4fe..bd1b77aabf 100644 --- a/sw/airborne/subsystems/radio_control/superbitrf_rc.c +++ b/sw/airborne/subsystems/radio_control/superbitrf_rc.c @@ -26,8 +26,6 @@ #include "superbitrf_rc.h" #include "subsystems/radio_control.h" -INFO("Radio-Control now follows PPRZ sign convention: this means you might need to reverese some channels in your transmitter: RollRight / PitchUp / YawRight / FullThrottle / Auto2 are positive deflections") - /** * Initialization */ diff --git a/sw/include/std.h b/sw/include/std.h index a92b57b9ba..6fecdcf727 100644 --- a/sw/include/std.h +++ b/sw/include/std.h @@ -37,6 +37,8 @@ #define _STRINGIFY(s) #s #define STRINGIFY(s) _STRINGIFY(s) +#define PTR(_f) &_f + #ifndef FALSE #define FALSE false #endif diff --git a/sw/lib/ocaml/module.ml b/sw/lib/ocaml/module.ml index 7359c3b90f..a1d88eea8b 100644 --- a/sw/lib/ocaml/module.ml +++ b/sw/lib/ocaml/module.ml @@ -128,7 +128,9 @@ let rec parse_makefile mkf = function | Xml.Element ("file_arch", _, []) as xml -> { mkf with files_arch = parse_file xml :: mkf.files_arch } | Xml.Element ("raw", [], [Xml.PCData raw]) -> - {mkf with raws = raw :: mkf.raws} + { mkf with raws = raw :: mkf.raws } + | Xml.Element ("test", _, _) -> + mkf | _ -> failwith "Module.parse_makefile: unreachable" type autorun = True | False | Lock diff --git a/sw/tools/create_module/files_create.py b/sw/tools/create_module/files_create.py index fcc86da108..2cdb48b355 100644 --- a/sw/tools/create_module/files_create.py +++ b/sw/tools/create_module/files_create.py @@ -181,8 +181,10 @@ class FilesCreate: # set makefile c_file = etree.Element("file") c_file.attrib["name"] = "{}.c".format(self.name) + test = etree.Element("test") makefile = etree.Element("makefile") makefile.append(c_file) + makefile.append(test) self.xml.append(makefile) def build_src(self, licence="GPLv2"): diff --git a/tests/Makefile b/tests/Makefile index 3eb9e7fe3a..c260cc60f6 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -29,6 +29,9 @@ test: $(Q)make -C math test $(Q)$(PERLENV) $(PERL) "-e" "$(RUNTESTS)" +test_modules: + prove -v $(PAPARAZZI_HOME)/tests/modules/test_modules.py + clean: $(Q)rm -rf results/* diff --git a/tests/math/tap.c b/tests/math/tap.c index 24de64eab0..8cecb80d20 100644 --- a/tests/math/tap.c +++ b/tests/math/tap.c @@ -4,7 +4,7 @@ Copyright 2012 Jake Gelbman This file is licensed under the GPLv2 or any later version */ -#define _BSD_SOURCE 1 +#define _DEFAULT_SOURCE 1 #include #include diff --git a/tests/modules/TAP/LICENSE b/tests/modules/TAP/LICENSE new file mode 100644 index 0000000000..6fcd49349a --- /dev/null +++ b/tests/modules/TAP/LICENSE @@ -0,0 +1,23 @@ +The MIT/X11 License + +Copyright (c) 2005-2008 Ricardo Signes + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/tests/modules/TAP/Simple.py b/tests/modules/TAP/Simple.py new file mode 100644 index 0000000000..8558eda457 --- /dev/null +++ b/tests/modules/TAP/Simple.py @@ -0,0 +1,37 @@ + +import TAP +import re + +builder = TAP.Builder() + +def plan(plan, plan_param=None): + builder.set_plan(plan, plan_param) + +ok = builder.ok + +def diag(comment): + print(("# %s" % re.compile("\n(.)").sub(comment, '\n#\1'))) + +def eq_ok(have, want, comment): + okness = have == want + ok(okness, comment) + if not okness: + diag("want: %s" % want) + diag("have: %s" % have) + return okness + +def is_ok(have, want, comment): + okness = have is want + ok(okness, comment) + if not okness: + diag("want id: %s" % id(want)) + diag("have id: %s" % id(have)) + return okness + +def isa_ok(object, cls, object_name="the object"): + okness = isinstance(object, cls) + ok(okness, object_name + " is a " + repr(cls)) + # if not okness: + # diag("want id: %s" % id(want)) + # diag("have id: %s" % id(have)) + return okness diff --git a/tests/modules/TAP/__init__.py b/tests/modules/TAP/__init__.py new file mode 100644 index 0000000000..4d40f69dd2 --- /dev/null +++ b/tests/modules/TAP/__init__.py @@ -0,0 +1,101 @@ +import sys +import atexit + +# todo: make written-to stream passable + +class Plan(object): + def __init__(self, plan, param=None): + self.counter = 0 + self.expected_tests = None + self.ended = False + + if isinstance(plan, int): + self.expected_tests = plan + print(("1..%u" % self.expected_tests)) + elif plan == "no_plan" or plan == None: 1 + elif plan == "skip_all": + print(("1..0 # skip %s" % param)) + raise SystemExit(0) # ??? this is what T::B does, but sucks + else: + raise TestBadPlan(plan) + + def increment_counter(self): + self.counter += 1 + + def __del__(self): + if self.ended: return + self.ended = True + if self.expected_tests is None: + print(("1..%u" % self.counter)) + elif self.counter != self.expected_tests: + print(("# Looks like you planned %u tests but ran %u." \ + % (self.expected_tests, self.counter))) + +class Builder(object): + global_defaults = { + "_plan": None, + "current": 1, + "has_plan": False, + } + global_test_builder = global_defaults.copy() + + def __init__(self, plan=None, plan_param=None): + self.__dict__ = self.global_test_builder + if plan: self.set_plan(plan, plan_param) + + @classmethod + def create(cls, plan=None, plan_param=None): + return Builder(plan, plan_param) + + def set_plan(self, plan, plan_param=None): + if self.get_plan(): raise TestPlannedAlready(plan, plan_param) + self._plan = Plan(plan, plan_param) + atexit.register(self._plan.__del__) + + def get_plan(self): return self._plan + + def ok(self, is_ok, desc=None, skip=None, todo=None): + self.get_plan().increment_counter() + + if skip and todo: raise TestBadDirective(self) + + if is_ok: report = "ok" + else: report = "not ok" + + sys.stdout.write("%s %u" % (report, self.current)) + + if desc: sys.stdout.write(" - %s" % desc) + if skip: sys.stdout.write(" # SKIP %s" % skip) + if todo: sys.stdout.write(" # TODO %s" % todo) + + print("") + + self.current += 1 + + return is_ok + + def reset(self): + self.__dict__.clear() + for key in list(self.global_defaults.keys()): + self.__dict__[key] = self.global_defaults[key] + +class TestPlannedAlready(Exception): + def __init__(self, plan, param=None): + self.plan = plan + self.param = param + def __str__(self): + return "tried to plan twice; second plan: %s, %s" % self.plan, self.param + +class TestWithoutPlan(Exception): + def __str__(self): + return "tried running tests without a plan" + +class TestBadPlan(Exception): + def __init__(self, plan): + self.plan = plan + def __str__(self): + return "didn't understand plan '%s'" % self.plan + +class TestBadDirective(Exception): + def __str__(self): + return "tried running a test with more than one directive" diff --git a/tests/modules/baro_board.h b/tests/modules/baro_board.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/modules/dummy.h b/tests/modules/dummy.h new file mode 100644 index 0000000000..4cd5a20bf9 --- /dev/null +++ b/tests/modules/dummy.h @@ -0,0 +1,7 @@ +#ifndef CONFIG_DUMMY_H +#define CONFIG_DUMMY_H + +//#define BOARD_DUMY +// + +#endif // CONFIG_DUMMY_H diff --git a/tests/modules/generated/airframe.h b/tests/modules/generated/airframe.h new file mode 100644 index 0000000000..9a18c7f74c --- /dev/null +++ b/tests/modules/generated/airframe.h @@ -0,0 +1,89 @@ +#ifndef AIRFRAME_H +#define AIRFRAME_H + +#define AIRFRAME_NAME "DUMMY" +#define AC_ID 42 + +// basic plane +#define COMMAND_THROTTLE 0 +#define COMMAND_ROLL 1 +#define COMMAND_PITCH 2 +#define COMMANDS_NB 3 +#define COMMANDS_FAILSAFE {0,0,0} + +// basic rotorcraft +//#define COMMAND_PITCH 0 +//#define COMMAND_ROLL 1 +#define COMMAND_YAW 2 +#define COMMAND_THRUST 3 + +#define KILL_MODE_DISTANCE (1.5*MAX_DIST_FROM_HOME) +#define DEFAULT_CIRCLE_RADIUS 80. +#define NOMINAL_AIRSPEED 12. +#define CARROT 5. + +#define V_CTL_AUTO_THROTTLE_NOMINAL_CRUISE_THROTTLE 0.4 + +#define SECTION_FAILSAFE 1 +#define FAILSAFE_DELAY_WITHOUT_GPS 2 +#define FAILSAFE_DEFAULT_THROTTLE 0.3 +#define FAILSAFE_DEFAULT_ROLL 0.3 +#define FAILSAFE_DEFAULT_PITCH 0. +#define FAILSAFE_HOME_RADIUS 100 + +#define SECTION_IMU 1 +#define IMU_GYRO_P_SENS 4.359 +#define IMU_GYRO_P_SENS_NUM 4359 +#define IMU_GYRO_P_SENS_DEN 1000 +#define IMU_GYRO_Q_SENS 4.359 +#define IMU_GYRO_Q_SENS_NUM 4359 +#define IMU_GYRO_Q_SENS_DEN 1000 +#define IMU_GYRO_R_SENS 4.359 +#define IMU_GYRO_R_SENS_NUM 4359 +#define IMU_GYRO_R_SENS_DEN 1000 +#define IMU_ACCEL_X_NEUTRAL -85 +#define IMU_ACCEL_Y_NEUTRAL 51 +#define IMU_ACCEL_Z_NEUTRAL -76 +#define IMU_ACCEL_X_SENS 2.44493965424 +#define IMU_ACCEL_X_SENS_NUM 61989 +#define IMU_ACCEL_X_SENS_DEN 25354 +#define IMU_ACCEL_Y_SENS 2.43424121497 +#define IMU_ACCEL_Y_SENS_NUM 61579 +#define IMU_ACCEL_Y_SENS_DEN 25297 +#define IMU_ACCEL_Z_SENS 2.44715908645 +#define IMU_ACCEL_Z_SENS_NUM 4307 +#define IMU_ACCEL_Z_SENS_DEN 1760 +#define IMU_MAG_X_NEUTRAL 0 +#define IMU_MAG_Y_NEUTRAL 0 +#define IMU_MAG_Z_NEUTRAL 0 +#define IMU_MAG_X_SENS 7.28514789391 +#define IMU_MAG_X_SENS_NUM 23888 +#define IMU_MAG_X_SENS_DEN 3279 +#define IMU_MAG_Y_SENS 7.33022132691 +#define IMU_MAG_Y_SENS_NUM 21199 +#define IMU_MAG_Y_SENS_DEN 2892 +#define IMU_MAG_Z_SENS 7.57102035692 +#define IMU_MAG_Z_SENS_NUM 63589 +#define IMU_MAG_Z_SENS_DEN 8399 +#define IMU_BODY_TO_IMU_PHI 0. +#define IMU_BODY_TO_IMU_THETA 0. +#define IMU_BODY_TO_IMU_PSI 0 + + +#define SECTION_AHRS 1 +#define AHRS_H_X 0.3892503 +#define AHRS_H_Y 0.0017972 +#define AHRS_H_Z 0.9211303 + +#define SECTION_INS 1 +#define INS_H_X 0.3892503 +#define INS_H_Y 0.0017972 +#define INS_H_Z 0.9211303 +#define INS_USE_GPS_ALT 1 +#define INS_SONAR_MIN_RANGE 0.0 +#define INS_SONAR_MAX_RANGE 3.5 +#define INS_SONAR_UPDATE_ON_AGL TRUE +#define INS_ROLL_NEUTRAL_DEFAULT 0. +#define INS_PITCH_NEUTRAL_DEFAULT 0. + +#endif // AIRFRAME_H diff --git a/tests/modules/generated/autopilot_core_ap.h b/tests/modules/generated/autopilot_core_ap.h new file mode 100644 index 0000000000..f8a431243b --- /dev/null +++ b/tests/modules/generated/autopilot_core_ap.h @@ -0,0 +1,7 @@ +#ifndef AUTOPILOT_CORE_AP_H +#define AUTOPILOT_CORE_AP_H + +#define AP_MODE_NAV 3 + +#endif + diff --git a/tests/modules/generated/flight_plan.h b/tests/modules/generated/flight_plan.h new file mode 100644 index 0000000000..4347a414a8 --- /dev/null +++ b/tests/modules/generated/flight_plan.h @@ -0,0 +1,63 @@ +#ifndef GENERATED_FLIGHT_PLAN_H +#define GENERATED_FLIGHT_PLAN_H + +#include "std.h" +#include "generated/modules.h" +#include "subsystems/abi.h" +#include "autopilot.h" + +#define NAV_DEFAULT_ALT 260 /* nominal altitude of the flight plan */ +#define NAV_UTM_EAST0 360285 +#define NAV_UTM_NORTH0 4813595 +#define NAV_UTM_ZONE0 31 +#define NAV_LAT0 434622300 /* 1e7deg */ +#define NAV_LON0 12728900 /* 1e7deg */ +#define NAV_ALT0 185000 /* mm above msl */ +#define NAV_MSL0 51850 /* mm, EGM96 geoid-height (msl) over ellipsoid */ +#define QFU 0.0 +#define WP_dummy 0 +#define WP_HOME 1 +#define WAYPOINTS_UTM { \ + {42.0, 42.0, 260},\ + {0.0, 0.0, 260},\ +}; +#define WAYPOINTS_ENU { \ + {41.13, 42.87, 75.00}, /* ENU in meters */ \ + {-0.00, -0.00, 75.00}, /* ENU in meters */ \ +}; +#define WAYPOINTS_LLA { \ + {.lat=434626158, .lon=12733981, .alt=260000}, /* 1e7deg, 1e7deg, mm (above NAV_MSL0, local msl=51.85m) */ \ + {.lat=434622299, .lon=12728900, .alt=260000}, /* 1e7deg, 1e7deg, mm (above NAV_MSL0, local msl=51.85m) */ \ +}; +#define WAYPOINTS_LLA_WGS84 { \ + {.lat=434626158, .lon=12733981, .alt=311850}, /* 1e7deg, 1e7deg, mm (above WGS84 ref ellipsoid) */ \ + {.lat=434622299, .lon=12728900, .alt=311850}, /* 1e7deg, 1e7deg, mm (above WGS84 ref ellipsoid) */ \ +}; +#define WAYPOINTS_GLOBAL { \ + FALSE, \ + FALSE, \ +}; +#define NB_WAYPOINT 2 +#define FP_BLOCKS { \ + "Wait GPS" , \ + "HOME" , \ +} +#define NB_BLOCK 2 + +#define GROUND_ALT 185. +#define GROUND_ALT_CM 18500 +#define SECURITY_HEIGHT 25. +#define SECURITY_ALT 210. +#define HOME_MODE_HEIGHT 25. +#define MAX_DIST_FROM_HOME 1500. + +#ifdef NAV_C + +static inline void auto_nav_init(void) {} + + +static inline void auto_nav(void) {} + +#endif + +#endif // GENERATED_FLIGHT_PLAN_H diff --git a/tests/modules/generated/modules.h b/tests/modules/generated/modules.h new file mode 100644 index 0000000000..24486ce95f --- /dev/null +++ b/tests/modules/generated/modules.h @@ -0,0 +1,12 @@ +#ifndef GENERATED_MODULES_H +#define GENERATED_MODULES_H + +#define MODULES_IDLE 0 +#define MODULES_RUN 1 +#define MODULES_START 2 +#define MODULES_STOP 3 + +// dummy variables +extern int nav_catapult_nav_catapult_highrate_module_status; + +#endif // GENERATED_MODULES_H diff --git a/tests/modules/generated/periodic_telemetry.h b/tests/modules/generated/periodic_telemetry.h new file mode 100644 index 0000000000..d104c8ec4d --- /dev/null +++ b/tests/modules/generated/periodic_telemetry.h @@ -0,0 +1,10 @@ +#ifndef PERIODIC_TELEMETRY_H +#define PERIODIC_TELEMETRY_H + +#include "std.h" +#include "generated/airframe.h" +#include "subsystems/datalink/telemetry_common.h" + +#define TELEMETRY_FREQUENCY 60 + +#endif // PERIODIC_TELEMETRY_H diff --git a/tests/modules/generated/radio.h b/tests/modules/generated/radio.h new file mode 100644 index 0000000000..3a71ab95db --- /dev/null +++ b/tests/modules/generated/radio.h @@ -0,0 +1,133 @@ +/* This file has been generated by gen_radio from /home/gautier/dev/paparazzi/conf/radios/T10CG_SBUS.xml */ +#ifndef RADIO_H +#define RADIO_H + +#define RADIO_NAME Futaba T10CG with SBUS + +#define RADIO_CTL_NB 7 + +#define RADIO_FILTER 7 + +#define RADIO_ROLL 0 +#define RADIO_ROLL_NEUTRAL 1520 +#define RADIO_ROLL_MIN 1107 +#define RADIO_ROLL_MAX 1932 + +#define RADIO_PITCH 1 +#define RADIO_PITCH_NEUTRAL 1520 +#define RADIO_PITCH_MIN 1107 +#define RADIO_PITCH_MAX 1932 + +#define RADIO_THROTTLE 2 +#define RADIO_THROTTLE_NEUTRAL 1932 +#define RADIO_THROTTLE_MIN 1932 +#define RADIO_THROTTLE_MAX 1107 + +#define RADIO_YAW 3 +#define RADIO_YAW_NEUTRAL 1520 +#define RADIO_YAW_MIN 1107 +#define RADIO_YAW_MAX 1932 + +#define RADIO_MODE 4 +#define RADIO_MODE_NEUTRAL 1520 +#define RADIO_MODE_MIN 2072 +#define RADIO_MODE_MAX 966 + +#define RADIO_GAIN1 5 +#define RADIO_GAIN1_NEUTRAL 1520 +#define RADIO_GAIN1_MIN 966 +#define RADIO_GAIN1_MAX 2072 + +#define RADIO_GAIN2 6 +#define RADIO_GAIN2_NEUTRAL 1520 +#define RADIO_GAIN2_MIN 966 +#define RADIO_GAIN2_MAX 2072 + +#define PPM_PULSE_TYPE PPM_PULSE_TYPE_POSITIVE +#define PPM_DATA_MIN_LEN (900ul) +#define PPM_DATA_MAX_LEN (2100ul) +#define PPM_SYNC_MIN_LEN (5000ul) +#define PPM_SYNC_MAX_LEN (15000ul) + +#define NormalizePpmFIR(_ppm, _rc) {\ + static uint8_t avg_cpt = 0; /* Counter for averaging */\ + int16_t tmp_radio;\ + tmp_radio = _ppm[RADIO_ROLL] - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_ROLL] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\ + Bound(_rc.values[RADIO_ROLL], MIN_PPRZ, MAX_PPRZ); \ +\ + tmp_radio = _ppm[RADIO_PITCH] - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_PITCH] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\ + Bound(_rc.values[RADIO_PITCH], MIN_PPRZ, MAX_PPRZ); \ +\ + tmp_radio = _ppm[RADIO_THROTTLE] - RC_PPM_TICKS_OF_USEC(1932);\ + _rc.values[RADIO_THROTTLE] = tmp_radio * (MAX_PPRZ / (float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1932)));\ + Bound(_rc.values[RADIO_THROTTLE], 0, MAX_PPRZ); \ +\ + tmp_radio = _ppm[RADIO_YAW] - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_YAW] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520))));\ + Bound(_rc.values[RADIO_YAW], MIN_PPRZ, MAX_PPRZ); \ +\ + _rc.avg_values[RADIO_MODE] += _ppm[RADIO_MODE];\ + tmp_radio = _ppm[RADIO_GAIN1] - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_GAIN1] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))));\ + Bound(_rc.values[RADIO_GAIN1], MIN_PPRZ, MAX_PPRZ); \ +\ + tmp_radio = _ppm[RADIO_GAIN2] - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_GAIN2] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))));\ + Bound(_rc.values[RADIO_GAIN2], MIN_PPRZ, MAX_PPRZ); \ +\ + avg_cpt++;\ + if (avg_cpt == RC_AVG_PERIOD) {\ + avg_cpt = 0;\ + tmp_radio = _rc.avg_values[RADIO_MODE] / RC_AVG_PERIOD - RC_PPM_TICKS_OF_USEC(1520);\ + _rc.values[RADIO_MODE] = tmp_radio * (tmp_radio >=0 ? (MAX_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(966-1520))) : (MIN_PPRZ/(float)(RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520))));\ + _rc.avg_values[RADIO_MODE] = 0;\ + Bound(_rc.values[RADIO_MODE], MIN_PPRZ, MAX_PPRZ); \ +\ + }\ +} + +#define NormalizePpmIIR(_ppm, _rc) {\ + int32_t tmp_radio;\ + int32_t tmp_value;\ +\ + tmp_radio = _ppm[RADIO_ROLL] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_ROLL] = (pprz_t)(tmp_value);\ +\ + tmp_radio = _ppm[RADIO_PITCH] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_PITCH] = (pprz_t)(tmp_value);\ +\ + tmp_radio = _ppm[RADIO_THROTTLE] - RC_PPM_TICKS_OF_USEC(1932);\ + tmp_value = (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1932));\ + Bound(tmp_value, 0, MAX_PPRZ); \ + _rc.values[RADIO_THROTTLE] = (pprz_t)(tmp_value);\ +\ + tmp_radio = _ppm[RADIO_YAW] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1932-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(1107-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_YAW] = (pprz_t)(tmp_value);\ +\ + tmp_radio = _ppm[RADIO_MODE] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_MODE] = (pprz_t)((RADIO_FILTER * _rc.values[RADIO_MODE] + tmp_value) / (RADIO_FILTER + 1));\ +\ + tmp_radio = _ppm[RADIO_GAIN1] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_GAIN1] = (pprz_t)(tmp_value);\ +\ + tmp_radio = _ppm[RADIO_GAIN2] - RC_PPM_TICKS_OF_USEC(1520);\ + tmp_value = (tmp_radio >=0 ? (tmp_radio * MAX_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(2072-1520)) : (tmp_radio * MIN_PPRZ) / (RC_PPM_SIGNED_TICKS_OF_USEC(966-1520)));\ + Bound(tmp_value, MIN_PPRZ, MAX_PPRZ); \ + _rc.values[RADIO_GAIN2] = (pprz_t)(tmp_value);\ +\ +} + + +#endif // RADIO_H diff --git a/tests/modules/generated/settings.h b/tests/modules/generated/settings.h new file mode 100644 index 0000000000..0ba991f0c7 --- /dev/null +++ b/tests/modules/generated/settings.h @@ -0,0 +1,4 @@ +#ifndef SETTINGS_H +#define SETTINGS_H + +#endif diff --git a/tests/modules/test_arch/baro_MS5534A.h b/tests/modules/test_arch/baro_MS5534A.h new file mode 100644 index 0000000000..97e8f515b0 --- /dev/null +++ b/tests/modules/test_arch/baro_MS5534A.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 ENAC + * + * 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 baro_MS5534A.h + * + * Dummy Handling of the MS5534a pressure sensor for the tests. + * + */ + +#ifndef BARO_MS5534A_H +#define BARO_MS5534A_H + +#include "std.h" + +#if USE_BARO_MS5534A + +extern bool spi_message_received; +extern bool baro_MS5534A_available; +extern uint32_t baro_MS5534A_pressure; +extern uint16_t baro_MS5534A_temp; +extern bool alt_baro_enabled; +extern uint32_t baro_MS5534A_ground_pressure; +extern float baro_MS5534A_r; +extern float baro_MS5534A_sigma2; +extern float baro_MS5534A_z; + + +void baro_MS5534A_init(void); +void baro_MS5534A_reset(void); + +/* To be called not faster than 30Hz */ +void baro_MS5534A_send(void); + +/* Set baro_MS5534A_available when pressure and temp are readable */ +void baro_MS5534A_event_task(void); + +#endif // USE_BARO_MS5534A + +#endif // BARO_MS5534A_H diff --git a/tests/modules/test_arch/led_hw.h b/tests/modules/test_arch/led_hw.h new file mode 100644 index 0000000000..b6c987db68 --- /dev/null +++ b/tests/modules/test_arch/led_hw.h @@ -0,0 +1,20 @@ +#ifndef LED_HW_H +#define LED_HW_H + +#include +#include +#include +#include + +extern value *leds_closure; +extern bool led_disable; + +#define LED_INIT(i) { led_disable = false; } +#define LED_ON(i) { if (leds_closure && !led_disable) callback2(*leds_closure, Val_int(i), Val_int(1)); } +#define LED_OFF(i) { if (leds_closure && !led_disable) callback2(*leds_closure, Val_int(i), Val_int(0)); } +#define LED_TOGGLE(i) { if (leds_closure && !led_disable) callback2(*leds_closure, Val_int(i), Val_int(2)); } +#define LED_DISABLE(i) { LED_OFF(i); led_disable = true; } + +#define LED_PERIODIC() {} + +#endif /* LED_HW_H */ diff --git a/tests/modules/test_arch/max1167_hw.h b/tests/modules/test_arch/max1167_hw.h new file mode 100644 index 0000000000..3cb6a65f77 --- /dev/null +++ b/tests/modules/test_arch/max1167_hw.h @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 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. + * + */ + +#ifndef MAX1167_HW_H +#define MAX1167_HW_H + +/* + test max1167 external ADC +*/ + +#include "std.h" +#include + +extern void max1167_hw_feed_value(VEC *gyro, VEC *accel); + +#endif /* MAX1167_WH */ diff --git a/tests/modules/test_arch/mcu_arch.h b/tests/modules/test_arch/mcu_arch.h new file mode 100644 index 0000000000..288a1fc8fa --- /dev/null +++ b/tests/modules/test_arch/mcu_arch.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 The Paparazzi Team + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef TEST_MCU_ARCH_H +#define TEST_MCU_ARCH_H + +extern void mcu_arch_init(void); + +#define mcu_int_enable() {} +#define mcu_int_disable() {} + +#endif /* TEST_MCU_ARCH_H */ + diff --git a/tests/modules/test_arch/mcu_periph/adc_arch.h b/tests/modules/test_arch/mcu_periph/adc_arch.h new file mode 100644 index 0000000000..93704ae345 --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/adc_arch.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 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/adc_arch.h + * Dummy header for handling of ADC hardware in test. + */ + +#ifndef ADC_ARCH_H +#define ADC_ARCH_H + +/* Dummy definitions */ +#define AdcBank1(x) x +#define AdcBank0(x) x + +#endif /* ADC_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/gpio_arch.h b/tests/modules/test_arch/mcu_periph/gpio_arch.h new file mode 100644 index 0000000000..dcaa70f6d0 --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/gpio_arch.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2013 Felix Ruess + * + * 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/gpio_arch.h + * + * GPIO dummy function/macros to compile in tests + * + */ + +#ifndef GPIO_ARCH_H +#define GPIO_ARCH_H + +typedef uint32_t gpio_port_t; + +#define GPIOA 0 +#define GPIOB 0 +#define GPIOC 0 +#define GPIOD 0 +#define GPIOE 0 +#define GPIOF 0 +#define GPIOG 0 +#define GPIOH 0 + +#define GPIO0 0 +#define GPIO1 0 +#define GPIO2 0 +#define GPIO3 0 +#define GPIO4 0 +#define GPIO5 0 +#define GPIO6 0 +#define GPIO7 0 +#define GPIO8 0 +#define GPIO9 0 +#define GPIO10 0 +#define GPIO11 0 +#define GPIO12 0 +#define GPIO13 0 +#define GPIO14 0 +#define GPIO15 0 +// on LCP21xx we have 32bit wide ports +#define GPIO16 0 +#define GPIO17 0 +#define GPIO18 0 +#define GPIO19 0 +#define GPIO20 0 +#define GPIO21 0 +#define GPIO22 0 +#define GPIO23 0 +#define GPIO24 0 +#define GPIO25 0 +#define GPIO26 0 +#define GPIO27 0 +#define GPIO28 0 +#define GPIO29 0 +#define GPIO30 0 +#define GPIO31 0 + +static inline void gpio_setup_output(gpio_port_t port __attribute__((unused)), uint16_t pin __attribute__((unused))) {} +static inline void gpio_setup_input(gpio_port_t port __attribute__((unused)), uint16_t pin __attribute__((unused))) {} +static inline void gpio_set(gpio_port_t port __attribute__((unused)), uint16_t pin __attribute__((unused))) {} +static inline void gpio_clear(gpio_port_t port __attribute__((unused)), uint16_t pin __attribute__((unused))) {} +static inline void gpio_toggle(gpio_port_t port __attribute__((unused)), uint16_t pin __attribute__((unused))) {} +static inline uint16_t gpio_get(gpio_port_t gpioport __attribute__((unused)), uint16_t gpios __attribute__((unused))) { return FALSE; } +static inline void gpio_setup_input_pullup(gpio_port_t gpioport __attribute__((unused)), uint16_t gpios __attribute__((unused))) {} +#endif /* GPIO_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/i2c_arch.h b/tests/modules/test_arch/mcu_periph/i2c_arch.h new file mode 100644 index 0000000000..f06124b47a --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/i2c_arch.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 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/i2c_arch.h + * Dummy header for handling of I2C hardware in test. + */ + + +#ifndef TEST_MCU_PERIPH_I2C_ARCH_H +#define TEST_MCU_PERIPH_I2C_ARCH_H + +#define I2cSendStart() {} + + +#if USE_I2C0 + +extern void i2c0_hw_init(void); + +#endif /* USE_I2C0 */ + + +#if USE_I2C1 + +extern void i2c1_hw_init(void); + +#endif /* USE_I2C1 */ + + +#if USE_I2C2 + +extern void i2c2_hw_init(void); + +#endif /* USE_I2C2 */ + + +#endif /* TEST_MCU_PERIPH_I2C_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/pipe_arch.h b/tests/modules/test_arch/mcu_periph/pipe_arch.h new file mode 100644 index 0000000000..14bea8260a --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/pipe_arch.h @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2018 Kirk Scheper + * + * 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 arch/linux/mcu_periph/pipe_arch.h + * linux named pipe handling + */ + +#ifndef PIPE_ARCH_H +#define PIPE_ARCH_H + +// default pipe buffer sizes on linux +#ifndef PIPE_RX_BUFFER_SIZE +#define PIPE_RX_BUFFER_SIZE 1024 +#endif +#ifndef PIPE_TX_BUFFER_SIZE +#define PIPE_TX_BUFFER_SIZE 1024 +#endif + +#endif /* PIPE_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/pwm_sysfs.h b/tests/modules/test_arch/mcu_periph/pwm_sysfs.h new file mode 100644 index 0000000000..20be9d38d6 --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/pwm_sysfs.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2017 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, see + * . + */ + +/** @file arch/linux/mcu_periph/pwm_sysfs.h + * PWM servos handling using Linux sysfs + * + * Based on PWM_Sysfs driver from ardupilot released under GPL v3 + */ + +#ifndef PWM_SYSFS_H +#define PWM_SYSFS_H + +#include "std.h" + +#define PWM_SYSFS_PATH_LEN 64 + +/** PWM structure + */ +struct PWM_Sysfs { + uint32_t duty_cycle_nsec; ///< current duty cycle (in nsec) + uint32_t period_nsec; ///< current period (in nsec) + bool enabled; ///< true if pwm is enabled + int duty_cycle_fd; ///< file descriptor to write/update duty cycle + char enable_path[PWM_SYSFS_PATH_LEN]; ///< path to enable file + char duty_path[PWM_SYSFS_PATH_LEN]; ///< path to duty file + char period_path[PWM_SYSFS_PATH_LEN]; ///< path to period file +}; + +extern int pwm_sysfs_init(struct PWM_Sysfs *pwm, char *base_path, + char *_export, char *_enable, + char *_duty, char *_period, + uint8_t channel); +extern void pwm_sysfs_set_period(struct PWM_Sysfs *pwm, uint32_t period); +extern void pwm_sysfs_set_duty(struct PWM_Sysfs *pwm, uint32_t duty); +extern void pwm_sysfs_enable(struct PWM_Sysfs *pwm, bool enable); + +#endif + diff --git a/tests/modules/test_arch/mcu_periph/spi_arch.h b/tests/modules/test_arch/mcu_periph/spi_arch.h new file mode 100644 index 0000000000..a33fb9e51a --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/spi_arch.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012 Felix Ruess + * + * 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/spi_arch.h + * Dummy header for handling of SPI hardware in tests. + */ + +#ifndef SPI_ARCH_H +#define SPI_ARCH_H + + +#endif /* SPI_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/sys_time_arch.h b/tests/modules/test_arch/mcu_periph/sys_time_arch.h new file mode 100644 index 0000000000..0f6ac23912 --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/sys_time_arch.h @@ -0,0 +1,58 @@ +/* + * + * Copyright (C) 2009-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/sys_time_arch.h + * test timing functions. + */ + +#ifndef SYS_TIME_ARCH_H +#define SYS_TIME_ARCH_H + +#include "std.h" + +extern void sys_tick_handler(void); + +/** + * Get the time in microseconds since startup. + * @return microseconds since startup as uint32_t + */ +static inline uint32_t get_sys_time_usec(void) +{ + return sys_time.nb_sec * 1000000 + + usec_of_cpu_ticks(sys_time.nb_sec_rem); +} + +/** + * Get the time in milliseconds since startup. + * @return milliseconds since startup as uint32_t + */ +static inline uint32_t get_sys_time_msec(void) +{ + return sys_time.nb_sec * 1000 + + msec_of_cpu_ticks(sys_time.nb_sec_rem); +} + + +static inline void sys_time_usleep(uint32_t us __attribute__((unused))) {} + +#endif /* SYS_TIME_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/uart_arch.h b/tests/modules/test_arch/mcu_periph/uart_arch.h new file mode 100644 index 0000000000..2351fc179f --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/uart_arch.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 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. + */ + +/** @file arch/linux/mcu_periph/uart_arch.h + * linux uart handling + */ + +#ifndef UART_ARCH_H +#define UART_ARCH_H + +// higher default uart buffer sizes on linux +#ifndef UART_RX_BUFFER_SIZE +#define UART_RX_BUFFER_SIZE 512 +#endif +#ifndef UART_TX_BUFFER_SIZE +#define UART_TX_BUFFER_SIZE 512 +#endif + +#include "mcu_periph/uart.h" + +// for definition of baud rates +#if !USE_ARBITRARY_BAUDRATE +#include +#else +#include +#endif + +// strange speed for SBUS +#ifndef B100000 +#define B100000 100000 +#endif + +// for conversion between linux baud rate definition and actual speed +static inline int uart_speed(int def) +{ + switch (def) { + case B1200: return 1200; + case B2400: return 2400; + case B4800: return 4800; + case B9600: return 9600; + case B19200: return 19200; + case B38400: return 38400; + case B57600: return 57600; + case B100000: return 100000; + case B115200: return 115200; + case B230400: return 230400; +#ifdef B921600 + case B921600: return 921600; +#endif + default: return 9600; + } +} +#define UART_SPEED(_def) uart_speed(_def) + +#endif /* UART_ARCH_H */ diff --git a/tests/modules/test_arch/mcu_periph/udp_arch.h b/tests/modules/test_arch/mcu_periph/udp_arch.h new file mode 100644 index 0000000000..827c078894 --- /dev/null +++ b/tests/modules/test_arch/mcu_periph/udp_arch.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2014 Freek van Tienen + * + * 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 arch/linux/mcu_periph/udp_arch.h + * linux UDP handling + */ + +#ifndef UDP_ARCH_H +#define UDP_ARCH_H + +#include "mcu_periph/udp.h" +#include "udp_socket.h" + +extern void udp_arch_init(void); + +#endif /* UDP_ARCH_H */ diff --git a/tests/modules/test_arch/modules/core/booz_pwm_arch.h b/tests/modules/test_arch/modules/core/booz_pwm_arch.h new file mode 100644 index 0000000000..fe0ef1f070 --- /dev/null +++ b/tests/modules/test_arch/modules/core/booz_pwm_arch.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2007 ENAC + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef BOOZ_PWM_ARCH_H +#define BOOZ_PWM_ARCH_H + +extern void booz_pwm_init_arch(void); + +// Default PWM is PWM0 +#define BoozSetPwmValue(_v) BoozSetPwm0Value(_v) + +#define BoozSetPwm0Value(_v) {} +#define BoozSetPwm1Value(_v) {} + +#endif /* BOOZ_PWM_ARCH_H */ diff --git a/tests/modules/test_arch/modules/core/trigger_ext_hw.h b/tests/modules/test_arch/modules/core/trigger_ext_hw.h new file mode 100644 index 0000000000..084a128cf5 --- /dev/null +++ b/tests/modules/test_arch/modules/core/trigger_ext_hw.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2010 Martin Mueller + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef TRIGGER_EXT_HW_H +#define TRIGGER_EXT_HW_H + +#include "core/trigger_ext.h" + +#endif /* TRIGGER_EXT_HW_H */ + diff --git a/tests/modules/test_arch/peripherals/hmc5843_arch.h b/tests/modules/test_arch/peripherals/hmc5843_arch.h new file mode 100644 index 0000000000..ae78c5cccf --- /dev/null +++ b/tests/modules/test_arch/peripherals/hmc5843_arch.h @@ -0,0 +1,32 @@ +/* + * 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. + */ + +/* + * + * test plug for hmc5843 + * + */ + +#ifndef HMC5843_HW_H +#define HMC5843_HW_H + + +#endif /* HMC5843_HW_H */ diff --git a/tests/modules/test_arch/peripherals/max1168_arch.h b/tests/modules/test_arch/peripherals/max1168_arch.h new file mode 100644 index 0000000000..a893cb9ae7 --- /dev/null +++ b/tests/modules/test_arch/peripherals/max1168_arch.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008-2009 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. + */ + +/* + * + * test plug for max1168 SPI Analog to Digital converter + * + */ + +#ifndef MAX1168_HW_H +#define MAX1168_HW_H + + +#endif /* MAX1168_HW_H */ diff --git a/tests/modules/test_arch/servos_nil.h b/tests/modules/test_arch/servos_nil.h new file mode 100644 index 0000000000..426f33ba95 --- /dev/null +++ b/tests/modules/test_arch/servos_nil.h @@ -0,0 +1,9 @@ +#ifndef SERVOS_NIL_H +#define SERVOS_NIL_H + +#define SERVOS_TICS_OF_USEC(s) cpu_ticks_of_usec(s) +#define ClipServo(x,a,b) Clip(x, a, b) +#define Actuator(i) actuators[i] +#define ActuatorsCommit() {} + +#endif /* SERVOS_NIL_H */ diff --git a/tests/modules/test_arch/subsystems/actuators/actuators_dualpwm_arch.h b/tests/modules/test_arch/subsystems/actuators/actuators_dualpwm_arch.h new file mode 100644 index 0000000000..2d2bd24311 --- /dev/null +++ b/tests/modules/test_arch/subsystems/actuators/actuators_dualpwm_arch.h @@ -0,0 +1,36 @@ +/* + * 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 subsystems/actuators/actuators_dualpwm_arch.h + * dummy servos handling for test + */ + +#ifndef ACTUATORS_DUALPWM_ARCH_H +#define ACTUATORS_DUALPWM_ARCH_H + +#define SERVOS_TICS_OF_USEC(_v) (_v) + +#define ActuatorDualpwmSet(_i, _v) {} +#define ActuatorsDualPwmCommit() {} + +extern void actuators_dualpwm_arch_init(void); + +#endif /* ACTUATORS_DUALPWM_ARCH_H */ diff --git a/tests/modules/test_arch/subsystems/actuators/actuators_pwm_arch.h b/tests/modules/test_arch/subsystems/actuators/actuators_pwm_arch.h new file mode 100644 index 0000000000..225c3ba13e --- /dev/null +++ b/tests/modules/test_arch/subsystems/actuators/actuators_pwm_arch.h @@ -0,0 +1,36 @@ +/* + * 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 subsystems/actuators/actuators_pwm_arch.h + * dummy servos handling for test + */ + +#ifndef ACTUATORS_PWM_ARCH_H +#define ACTUATORS_PWM_ARCH_H + +#define SERVOS_TICS_OF_USEC(_v) (_v) + +#define ActuatorPwmSet(_i, _v) {} +#define ActuatorsPwmCommit() {} + +extern void actuators_pwm_arch_init(void); + +#endif /* ACTUATORS_PWM_ARCH_H */ diff --git a/tests/modules/test_arch/subsystems/actuators/servos_4015_MAT_hw.h b/tests/modules/test_arch/subsystems/actuators/servos_4015_MAT_hw.h new file mode 100644 index 0000000000..f3e00e1822 --- /dev/null +++ b/tests/modules/test_arch/subsystems/actuators/servos_4015_MAT_hw.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 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. + * + */ + +#ifndef SERVOS_4015_HW_H +#define SERVOS_4015_HW_H + +#define SERVOS_TICS_OF_USEC(_v) (_v) + +#define Actuator4015Set(_i, _v) {} +#define Actuators4015Init() {} +#define Actuators4015Commit() {} + +#endif + diff --git a/tests/modules/test_arch/subsystems/actuators/servos_4017_hw.h b/tests/modules/test_arch/subsystems/actuators/servos_4017_hw.h new file mode 100644 index 0000000000..fad3ed1c7f --- /dev/null +++ b/tests/modules/test_arch/subsystems/actuators/servos_4017_hw.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 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. + * + */ + +#ifndef SERVOS_4017_HW_H +#define SERVOS_4017_HW_H + +#define SERVOS_TICS_OF_USEC(_v) (_v) + +#define Actuator4017Set(_i, _v) {} +#define Actuators4017Init() {} +#define Actuators4017Commit() {} + +#endif + + diff --git a/tests/modules/test_arch/subsystems/actuators/servos_ppm_hw.h b/tests/modules/test_arch/subsystems/actuators/servos_ppm_hw.h new file mode 100644 index 0000000000..63f8d5eeda --- /dev/null +++ b/tests/modules/test_arch/subsystems/actuators/servos_ppm_hw.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 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. + * + */ + +#ifndef SERVOS_PPM_HW_H +#define SERVOS_PPM_HW_H + +#define SERVOS_TICS_OF_USEC(_v) (_v) + +#define ActuatorPpmSet(_i, _v) {} +#define ActuatorsPpmInit() {} +#define ActuatorsPpmCommit() {} + +#endif + + diff --git a/tests/modules/test_arch/subsystems/datalink/superbitrf.h b/tests/modules/test_arch/subsystems/datalink/superbitrf.h new file mode 100644 index 0000000000..330f6ffd45 --- /dev/null +++ b/tests/modules/test_arch/subsystems/datalink/superbitrf.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2013 Freek van Tienen + * + * 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 subsystems/datalink/superbitrf.h + * DSM2 and DSMX datalink implementation for the cyrf6936 2.4GHz radio chip trough SPI + * + * Dummy for tests so you don't have to remove the superbitrf.xml settings file. + */ + +#ifndef DATALINK_SUPERBITRF_H +#define DATALINK_SUPERBITRF_H + +/* The different protocols a transmitter can send */ +enum dsm_protocol { + DSM_DSM2_1 = 0x01, /**< The original DSM2 protocol with 1 packet of data */ + DSM_DSM2_2 = 0x02, /**< The original DSM2 protocol with 2 packets of data */ + DSM_DSM2P = 0x10, /**< Our own DSM2 Paparazzi protocol */ + DSM_DSMXP = 0x11, /**< Our own DSMX Paparazzi protocol */ + DSM_DSMX_1 = 0xA2, /**< The original DSMX protocol with 1 packet of data */ + DSM_DSMX_2 = 0xB2, /**< The original DSMX protocol with 2 packets of data */ +}; + +/* The superbitrf structure */ +struct SuperbitRF { + uint8_t bind_mfg_id[4]; /**< The MFG id where the receiver is bound to */ + uint32_t bind_mfg_id32; /**< The MFG id where the receiver is bound to in uint32 */ + uint8_t num_channels; /**< The number of channels the transmitter has */ + volatile enum dsm_protocol protocol; /**< The protocol the transmitter uses */ +}; + +/* The superbitrf functions and structures */ +extern struct SuperbitRF superbitrf; +extern void superbitrf_set_mfg_id(uint32_t id); +extern void superbitrf_set_protocol(uint8_t protocol); + +#endif /* DATALINK_SUPERBITRF_H */ diff --git a/tests/modules/test_arch/subsystems/radio_control/ppm_arch.h b/tests/modules/test_arch/subsystems/radio_control/ppm_arch.h new file mode 100644 index 0000000000..ada3a5750d --- /dev/null +++ b/tests/modules/test_arch/subsystems/radio_control/ppm_arch.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010-2014 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, see + * . + */ + +/** + * @file subsystems/radio_control/ppm_arch.h + * + * PPM radio control, test specific. + * + */ + +#ifndef PPM_ARCH_H +#define PPM_ARCH_H + + +/** + * On tiny (and booz) the ppm counter is running at the same speed as + * the systic counter. There is no reason for this to be true. + * Let's add a pair of macros to make it possible for them to be different. + * + */ +#define RC_PPM_TICKS_OF_USEC(_x) (_x) +#define RC_PPM_SIGNED_TICKS_OF_USEC(_x) (_x) +#define USEC_OF_RC_PPM_TICKS(_x) (_x) + +#if USE_NPS +extern void radio_control_feed(void); +#endif + +#endif /* PPM_ARCH_H */ diff --git a/tests/modules/test_arch/subsystems/radio_control/spektrum_arch.h b/tests/modules/test_arch/subsystems/radio_control/spektrum_arch.h new file mode 100644 index 0000000000..ffdc9f964a --- /dev/null +++ b/tests/modules/test_arch/subsystems/radio_control/spektrum_arch.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2010 Eric Parsonage + * + * This file is part of paparazzi. + * + * paparazzi is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * paparazzi is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with paparazzi; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * + */ + +#ifndef RADIO_CONTROL_SPEKTRUM_ARCH_H +#define RADIO_CONTROL_SPEKTRUM_ARCH_H + +#include "subsystems/radio_control/spektrum_radio.h" + +extern void spektrum_event(void (*_received_frame_handler)(void)); +#define RadioControlEventImp spektrum_event +extern void spektrum_try_bind(void); + +#if USE_NPS +extern void radio_control_feed(void); +#endif + +#endif /* RADIO_CONTROL_SPEKTRUM_ARCH_H */ diff --git a/tests/modules/test_modules.py b/tests/modules/test_modules.py new file mode 100755 index 0000000000..c1fbdde5da --- /dev/null +++ b/tests/modules/test_modules.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2021 Fabien Bonneval +# 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, see +# . +# + +from lxml import etree +from typing import List, Optional, Tuple, Dict +import re +from os import path, getenv +import os +import argparse +import subprocess +import shlex + +import TAP + +PPRZ_HOME = getenv("PAPARAZZI_HOME", path.normpath(path.join(path.dirname(path.abspath(__file__)), '../../'))) + +ARCHS = ["chibios", "linux", "sim", "stm32"] + +ALT_DIRS = ["../../var/share", "../ext"] + +GCC_PARAMS: List[str] = ["-c", "-o", "/dev/null", "-W", "-Wall"] +OTHER_PARAMS: List[str] = [ + "-I./", "-I../include", + "-I../../var/include", + "-I../../tests/modules", + "-Imodules", "-DPERIODIC_TELEMETRY", + "-DDOWNLINK", + "-DBOARD_CONFIG=\"../../tests/modules/dummy.h\""] + + +class Test: + def __init__(self, tst, files, files_arch, test_name): + self.configure_regex = re.compile(r"(\$\([a-zA-Z_][a-zA-Z_0-9]*\))") + self.files = files # type: List[str] + self.files_arch = files_arch # type: List[str] + self.firmware = None # type: Optional[str] + self.archs = [] # type: List[str] + self.defines = [] # type: List[Tuple[str,str, str]] + self.configures = {} # type: Dict[str:str] + self.includes = [] # type: List[str] + self.shells = [] # type: List[str] + self.test_name = test_name + + self.parse(tst) + + def parse(self, tst): + self.firmware = tst.attrib.get("firmware") + archs = tst.attrib.get("arch") + if archs is None: + # self.archs = ARCHS + self.archs = [] + else: + self.archs = archs.split("|") + if len(self.archs) == 1: + if self.archs[0] == "": + self.archs = [] + elif self.archs[0][0] == "!": + excluded = self.archs[0][1:] + self.archs = ARCHS + self.archs.remove(excluded) + print(f"archs : {self.archs}") + + for define in tst.findall("define"): + def_name = define.attrib["name"] + def_val = define.attrib.get("value") + def_type = define.attrib.get("type") + self.defines.append((def_name, def_val, def_type)) + + for configure in tst.findall("configure"): + conf_name = configure.attrib["name"] + conf_value = configure.attrib["value"] + self.configures[conf_name] = conf_value + + for include in tst.findall("include"): + self.includes.append(include.attrib["name"]) + + for shell in tst.findall("shell"): + self.shells.append(shell.attrib["cmd"]) + + if self.firmware is not None: + self.configures["SRC_FIRMWARE"] = f"firmwares/{self.firmware}" + self.includes.append(f"firmwares/{self.firmware}") + + def substitute_configures(self): + def substitute(string: str): + if string is None: + return None + for m in re.findall(self.configure_regex, string): + if m[2:-1] in self.configures.keys(): + string = string.replace(m, self.configures[m[2:-1]]) + return string + self.files = map(substitute, self.files) + self.files_arch = map(substitute, self.files_arch) + self.defines = map(lambda x: (substitute(x[0]), substitute(x[1]), x[2]), self.defines) + self.includes = map(substitute, self.includes) + + def make_commands(self) -> List[List[str]]: + self.substitute_configures() + self.files = list(self.files) + self.files_arch = list(self.files_arch) + + gcc = "gcc" + for f in self.files + self.files_arch: + if re.match("cpp$", f) is not None: + gcc = "g++" + + defines = list(map(self.define_str, self.defines)) + includes = list((map(self.include_str, self.includes))) + shells = [] + for shell in self.shells: + shell_args = shlex.split(shell) + p = subprocess.run(shell_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + if p.returncode == 0: + shells += shlex.split(p.stdout) + else: + print(p.stderr) + return [["exit", "1"]] + + cmds = [] + for file in self.files: + # build with the "test" arch. + arch_include = f"-I../../tests/modules/test_arch" + cmd_args = [gcc] + GCC_PARAMS + [file] + OTHER_PARAMS + defines + includes + [arch_include] + shells + cmds.append(cmd_args) + + for file in self.files_arch: + for arch in self.archs: + file_path = f"arch/{arch}/{file}" + arch_include = f"-Iarch/{arch}" + cmd_args = [gcc] + GCC_PARAMS + [file_path] + OTHER_PARAMS + defines + includes + [arch_include] + shells + # TODO: uncomment to build files. + # cmds.append(cmd_args) + return cmds + + def run(self): + cmds = self.make_commands() + diagnostic = [] + returncode = 0 + for cmd_args in cmds: + p = subprocess.run(cmd_args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True) + if p.stderr != "": + # diagnostic.append(str(cmd_args)) + diagnostic.append(p.stderr) + + if p.returncode != 0: + returncode = 1 + return returncode, self.test_name, diagnostic + + + @staticmethod + def define_str(define: Tuple[str, Optional[str], Optional[str]]) -> str: + name, value, _type = define + if value is not None: + if _type is not None and _type == "string": + return f'-D{name}="{value}"' + else: + return f"-D{name}={value}" + else: + return f"-D{name}" + + @staticmethod + def include_str(name: str) -> str: + return f"-I{name}" + + def __repr__(self): + res = "" + res += "Test{\n" + res += "\tdefines: " + for define in self.defines: + res += define[0] + "=" + (define[1] if define[1] is not None else "None") + " " + res += "\n\tconfigures: " + for key, value in self.configures.items(): + res += key + "=" + (value if value is not None else "None") + " " + res += "\n\tincludes: " + " ".join(self.includes) + res += "\n\tfiles: " + res += " ".join(self.files) + res += "}" + return res + + +class Module: + + def __init__(self, filename): + m_tree = etree.parse(filename) + mod_elt = m_tree.getroot() + self.name = mod_elt.attrib["name"] + # if dir is not specified, the name of the module is used as default directory name + self.dir = mod_elt.attrib.get("dir", self.name) + self.tests = [] + + for mkf in mod_elt.findall("makefile"): + files = self.get_files(mkf) + files_arch = self.get_files_arch(mkf) + for i, tst in enumerate(mkf.findall("test")): + test = Test(tst, files, files_arch, f"{self.name}_{i}") + self.tests.append(test) + + def get_files(self, mkf): + files = [] + for file in mkf.findall("file"): + name = file.attrib["name"] + dir = file.attrib.get("dir") + if dir is None: + file_path = "/".join(["modules", self.dir, name]) + else: + file_path = "/".join([dir, name]) + if not path.exists(file_path): + for alt_dir in ALT_DIRS: + alt_path = f"{alt_dir}/{file_path}" + if path.exists(alt_path): + file_path = alt_path + break + + files.append(file_path) + return files + + def get_files_arch(self, mkf): + files = [] + for file in mkf.findall("file_arch"): + name = file.attrib["name"] + dir = file.attrib.get("dir") + if dir is None: + file_path = "/".join(["modules", self.dir, name]) + else: + file_path = "/".join([dir, name]) + files.append(file_path) + return files + + +def get_modules(): + files = os.listdir(PPRZ_HOME+"/conf/modules") + + def is_xml(filename): + filename, extension = os.path.splitext(filename) + return extension == ".xml" + + files = filter(is_xml, files) + return files + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="test modules") + parser.add_argument('--file', '-f', default=None, help="module to be tested") + parser.add_argument('-w', action='store_false') + args = parser.parse_args() + + def is_xml(filename): + filename, extension = os.path.splitext(filename) + return extension == ".xml" + + if args.file is None: + files = os.listdir(PPRZ_HOME+"/conf/modules") + files = map(lambda name: PPRZ_HOME+"/conf/modules/"+name, files) + else: + files = [args.file] + + files = filter(is_xml, files) + + all_tests = [] + os.chdir(f"{PPRZ_HOME}/sw/airborne") + for f in files: + mod = Module(f) + all_tests += mod.tests + + ok = TAP.Builder.create(len(all_tests)).ok + for test in all_tests: + returncode, comment, diagnotics = test.run() + ok(not returncode, comment) + if args.w or returncode: + for d in diagnotics: + lines = d.split("\n") + for line in lines: + print(f"# {line}")