From ec8a4003770aebd0caf366980ca3d9596d5445c2 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 22 Apr 2015 13:14:09 +0200 Subject: [PATCH] [test] update bbb and test_imu --- conf/airframes/examples/beagle_bone_black.xml | 21 ++++++++----- conf/firmwares/test_progs.makefile | 1 + sw/airborne/test/subsystems/test_imu.c | 31 ++++++++++++++++++- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/conf/airframes/examples/beagle_bone_black.xml b/conf/airframes/examples/beagle_bone_black.xml index befef82146..a22fa72b60 100644 --- a/conf/airframes/examples/beagle_bone_black.xml +++ b/conf/airframes/examples/beagle_bone_black.xml @@ -5,17 +5,11 @@ - - - - - - @@ -27,10 +21,23 @@ + + + + + + + + + + + + + - + diff --git a/conf/firmwares/test_progs.makefile b/conf/firmwares/test_progs.makefile index 0a2c927772..cd6d1a4d85 100644 --- a/conf/firmwares/test_progs.makefile +++ b/conf/firmwares/test_progs.makefile @@ -413,6 +413,7 @@ test_imu.srcs += $(COMMON_TEST_SRCS) test_imu.CFLAGS += $(COMMON_TELEMETRY_CFLAGS) test_imu.srcs += $(COMMON_TELEMETRY_SRCS) test_imu.srcs += mcu_periph/i2c.c $(SRC_ARCH)/mcu_periph/i2c_arch.c +test_imu.srcs += state.c test_imu.srcs += test/subsystems/test_imu.c test_imu.srcs += math/pprz_geodetic_int.c math/pprz_geodetic_float.c math/pprz_geodetic_double.c math/pprz_trig_int.c math/pprz_orientation_conversion.c math/pprz_algebra_int.c math/pprz_algebra_float.c math/pprz_algebra_double.c diff --git a/sw/airborne/test/subsystems/test_imu.c b/sw/airborne/test/subsystems/test_imu.c index 264ac524f5..6865c7decc 100644 --- a/sw/airborne/test/subsystems/test_imu.c +++ b/sw/airborne/test/subsystems/test_imu.c @@ -98,6 +98,34 @@ static inline void main_periodic_task(void) led_toggle(); DOWNLINK_SEND_ALIVE(DefaultChannel, DefaultDevice, 16, MD5SUM); }); + +#if USE_I2C1 + RunOnceEvery(111, { + uint16_t i2c1_queue_full_cnt = i2c1.errors->queue_full_cnt; + uint16_t i2c1_ack_fail_cnt = i2c1.errors->ack_fail_cnt; + uint16_t i2c1_miss_start_stop_cnt = i2c1.errors->miss_start_stop_cnt; + uint16_t i2c1_arb_lost_cnt = i2c1.errors->arb_lost_cnt; + uint16_t i2c1_over_under_cnt = i2c1.errors->over_under_cnt; + uint16_t i2c1_pec_recep_cnt = i2c1.errors->pec_recep_cnt; + uint16_t i2c1_timeout_tlow_cnt = i2c1.errors->timeout_tlow_cnt; + uint16_t i2c1_smbus_alert_cnt = i2c1.errors->smbus_alert_cnt; + uint16_t i2c1_unexpected_event_cnt = i2c1.errors->unexpected_event_cnt; + uint32_t i2c1_last_unexpected_event = i2c1.errors->last_unexpected_event; + uint8_t _bus1 = 1; + DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice, + &i2c1_queue_full_cnt, + &i2c1_ack_fail_cnt, + &i2c1_miss_start_stop_cnt, + &i2c1_arb_lost_cnt, + &i2c1_over_under_cnt, + &i2c1_pec_recep_cnt, + &i2c1_timeout_tlow_cnt, + &i2c1_smbus_alert_cnt, + &i2c1_unexpected_event_cnt, + &i2c1_last_unexpected_event, + &_bus1); + }); +#endif #if USE_I2C2 RunOnceEvery(111, { uint16_t i2c2_queue_full_cnt = i2c2.errors->queue_full_cnt; @@ -110,7 +138,7 @@ static inline void main_periodic_task(void) uint16_t i2c2_smbus_alert_cnt = i2c2.errors->smbus_alert_cnt; uint16_t i2c2_unexpected_event_cnt = i2c2.errors->unexpected_event_cnt; uint32_t i2c2_last_unexpected_event = i2c2.errors->last_unexpected_event; - const uint8_t _bus2 = 2; + uint8_t _bus2 = 2; DOWNLINK_SEND_I2C_ERRORS(DefaultChannel, DefaultDevice, &i2c2_queue_full_cnt, &i2c2_ack_fail_cnt, @@ -125,6 +153,7 @@ static inline void main_periodic_task(void) &_bus2); }); #endif + if (sys_time.nb_sec > 1) { imu_periodic(); } RunOnceEvery(10, { LED_PERIODIC();}); }