diff --git a/conf/airframes/examples/setup_apogee.xml b/conf/airframes/examples/setup_apogee.xml new file mode 100644 index 0000000000..6934ed4fd8 --- /dev/null +++ b/conf/airframes/examples/setup_apogee.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/conf/firmwares/test_progs.makefile b/conf/firmwares/test_progs.makefile index cd6d1a4d85..17ba451ab9 100644 --- a/conf/firmwares/test_progs.makefile +++ b/conf/firmwares/test_progs.makefile @@ -378,6 +378,9 @@ include $(CFG_SHARED)/baro_board.makefile endif test_baro_board.CFLAGS += $(BARO_BOARD_CFLAGS) test_baro_board.srcs += $(BARO_BOARD_SRCS) +ifeq ($(IMU_INIT),1) +test_baro_board.srcs += test/test_baro_board_imu.c +endif # diff --git a/sw/airborne/test/test_baro_board.c b/sw/airborne/test/test_baro_board.c index b1dfd2efb3..6c59483494 100644 --- a/sw/airborne/test/test_baro_board.c +++ b/sw/airborne/test/test_baro_board.c @@ -39,10 +39,32 @@ #define ABI_C #include "subsystems/abi.h" +#include "test_baro_board_imu.h" + static inline void main_init(void); static inline void main_periodic_task(void); static inline void main_event_task(void); + + +__attribute__((weak)) void test_baro_board_imu_init(void) +{ + /* Optionally, to be overriden by board specific code */ +} + + +__attribute__((weak)) void test_baro_board_imu_periodic_task(void) +{ + /* Optionally, to be overriden by board specific code */ +} + + +__attribute__((weak)) void test_baro_board_imu_event_task(void) +{ + /* Optionally, to be overriden by board specific code */ +} + + #ifndef BARO_PERIODIC_FREQUENCY #define BARO_PERIODIC_FREQUENCY 50 #endif @@ -90,6 +112,7 @@ static inline void main_init(void) mcu_init(); sys_time_register_timer((1. / PERIODIC_FREQUENCY), NULL); downlink_init(); + test_baro_board_imu_init(); baro_init(); baro_tid = sys_time_register_timer(1. / BARO_PERIODIC_FREQUENCY, NULL); @@ -101,10 +124,12 @@ static inline void main_periodic_task(void) { LED_PERIODIC(); RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);}); + test_baro_board_imu_periodic_task(); } static inline void main_event_task(void) { mcu_event(); + test_baro_board_imu_event_task(); BaroEvent(); } diff --git a/sw/airborne/test/test_baro_board_imu.c b/sw/airborne/test/test_baro_board_imu.c new file mode 100644 index 0000000000..8234d10a88 --- /dev/null +++ b/sw/airborne/test/test_baro_board_imu.c @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2015 Braiins Systems + * + * 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. + */ + +/* + * + * IMU initialization functions for boards where barometer is an I2C + * slave of IMU chip. + * + */ + +#include BOARD_CONFIG + +#include "mcu_periph/sys_time.h" + +#include "subsystems/imu.h" +#include "test_baro_board_imu.h" + +void test_baro_board_imu_init(void) +{ + imu_init(); +} + + +void test_baro_board_imu_periodic_task(void) +{ + if (sys_time.nb_sec > 1) { + imu_periodic(); + } +} + + +void test_baro_board_imu_event_task(void) +{ + ImuEvent(); +} diff --git a/sw/airborne/test/test_baro_board_imu.h b/sw/airborne/test/test_baro_board_imu.h new file mode 100644 index 0000000000..e43faea715 --- /dev/null +++ b/sw/airborne/test/test_baro_board_imu.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2015 Braiins Systems + * + * 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. + */ + + +/** + * Initializes the IMU when baro board is IMU slave + */ +void test_baro_board_imu_init(void); + +/** + * Periodic task for IMU subsystem + */ +void test_baro_board_imu_periodic_task(void); + +/** + * Event task for IMU subsystem + */ +void test_baro_board_imu_event_task(void);