[tests] cleanup test_baro_board

This commit is contained in:
Felix Ruess
2014-08-02 16:39:15 +02:00
parent b050bda005
commit ddd7129c8b
5 changed files with 35 additions and 102 deletions
@@ -43,6 +43,9 @@
<target name="test_sys_time_timer" board="lisa_mx_2.0"/>
<target name="test_adc" board="lisa_mx_2.0"/>
<target name="test_telemetry" board="lisa_mx_2.0"/>
<target name="test_baro_board" board="lisa_mx_2.0">
<configure name="BARO_LED" value="5"/>
</target>
<target name="test_radio_control" board="lisa_mx_2.0">
<subsystem name="radio_control" type="spektrum">
<define name="RADIO_MODE" value="RADIO_AUX1"/>
+5 -1
View File
@@ -28,7 +28,11 @@
</target>
<target name="test_esc_mkk_simple" board="lisa_m_2.0"/>
<target name="test_esc_asctecv1_simple" board="lisa_m_2.0"/>
<target name="test_baro" board="lisa_m_2.0"/>
<target name="test_baro_board" board="lisa_m_2.0">
<configure name="BARO_LED" value="5"/>
<!-- baro board options for Lisa/M: BARO_BOARD_BMP085 (default), BARO_MS5611_I2C, BARO_MS5611_SPI -->
<configure name="LISA_M_BARO" value="BARO_BOARD_BMP085"/>
</target>
<target name="test_adc" board="lisa_m_2.0"/>
<target name="test_can" board="lisa_m_2.0"/>
<target name="test_uart" board="lisa_m_2.0">
-1
View File
@@ -286,7 +286,6 @@ test_baro_board.CFLAGS += $(COMMON_TEST_CFLAGS)
test_baro_board.srcs += $(COMMON_TEST_SRCS)
test_baro_board.CFLAGS += $(COMMON_TELEMETRY_CFLAGS)
test_baro_board.srcs += $(COMMON_TELEMETRY_SRCS)
test_baro_board.srcs += subsystems/air_data.c
test_baro_board.srcs += test/test_baro_board.c
test_baro_board.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c
ifeq ($(TARGET),test_baro_board)
-87
View File
@@ -1,87 +0,0 @@
/*
* Copyright (C) 2009 Antoine Drouin <poinix@gmail.com>
*
* 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 baro using interrupts
*
*/
#include BOARD_CONFIG
#include "mcu.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/downlink.h"
#include "subsystems/sensors/baro.h"
static inline void main_init( void );
static inline void main_periodic_task( void );
static inline void main_event_task( void );
static inline void main_on_baro_diff(void);
static inline void main_on_baro_abs(void);
int main(void) {
main_init();
while(1) {
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
main_event_task();
}
return 0;
}
static inline void main_init( void ) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
booz2_analog_init();
baro_init();
mcu_int_enable();
}
static inline void main_periodic_task( void ) {
RunOnceEvery(2, {baro_periodic();});
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
LED_PERIODIC();
}
static inline void main_event_task( void ) {
BaroEvent(main_on_baro_abs, main_on_baro_diff);
}
static inline void main_on_baro_diff(void) {
}
static inline void main_on_baro_abs(void) {
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &baro.absolute, &baro.differential);});
}
+27 -13
View File
@@ -35,7 +35,6 @@
#include "subsystems/datalink/downlink.h"
#include "subsystems/sensors/baro.h"
#include "subsystems/air_data.h"
#define ABI_C
#include "subsystems/abi.h"
@@ -44,9 +43,23 @@ static inline void main_init( void );
static inline void main_periodic_task( void );
static inline void main_event_task( void );
static inline void main_on_baro_diff(void);
static inline void main_on_baro_abs(void);
#ifndef BARO_PERIODIC_FREQUENCY
#define BARO_PERIODIC_FREQUENCY 50
#endif
PRINT_CONFIG_VAR(BARO_PERIODIC_FREQUENCY)
#ifdef BARO_LED
PRINT_CONFIG_VAR(BARO_LED)
#endif
/** ABI bindings
*/
#ifndef BARO_ABS_ID
#define BARO_ABS_ID ABI_BROADCAST
#endif
static abi_event pressure_abs_ev;
tid_t baro_tid;
int main(void) {
main_init();
@@ -54,21 +67,30 @@ int main(void) {
while(1) {
if (sys_time_check_and_ack_timer(0))
main_periodic_task();
if (sys_time_check_and_ack_timer(baro_tid))
baro_periodic();
main_event_task();
}
return 0;
}
static void pressure_abs_cb(uint8_t __attribute__((unused)) sender_id, const float * pressure) {
float foo = 42.;
DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, pressure, &foo);
}
static inline void main_init( void ) {
mcu_init();
sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL);
baro_init();
baro_tid = sys_time_register_timer(1./BARO_PERIODIC_FREQUENCY, NULL);
AbiBindMsgBARO_ABS(BARO_ABS_ID, &pressure_abs_ev, pressure_abs_cb);
}
static inline void main_periodic_task( void ) {
RunOnceEvery(2, {baro_periodic();});
LED_PERIODIC();
RunOnceEvery(256, {DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM);});
}
@@ -76,11 +98,3 @@ static inline void main_periodic_task( void ) {
static inline void main_event_task( void ) {
BaroEvent();
}
static inline void main_on_baro_diff(void) {
}
static inline void main_on_baro_abs(void) {
RunOnceEvery(5,{DOWNLINK_SEND_BARO_RAW(DefaultChannel, DefaultDevice, &air_data.pressure, &air_data.differential);});
}