From c04722d211b526bd70ffc38b8ac46c6ca5f7a9d5 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Wed, 8 Apr 2020 17:21:26 -0700 Subject: [PATCH] easytimer-v1: Switch back to real ao_flight, enable BMX160 Signed-off-by: Keith Packard --- src/easytimer-v1/Makefile | 2 +- src/easytimer-v1/ao_easytimer.c | 4 +++- src/easytimer-v1/ao_pins.h | 26 +++++++++++++++++++++++++- src/easytimer-v1/ao_timer_flight.c | 23 ----------------------- 4 files changed, 29 insertions(+), 26 deletions(-) delete mode 100644 src/easytimer-v1/ao_timer_flight.c diff --git a/src/easytimer-v1/Makefile b/src/easytimer-v1/Makefile index d17e6878..e53795b6 100644 --- a/src/easytimer-v1/Makefile +++ b/src/easytimer-v1/Makefile @@ -62,7 +62,7 @@ ALTOS_SRC = \ ao_sample.c \ ao_kalman.c \ ao_pyro.c \ - ao_timer_flight.c \ + ao_flight.c \ $(PROFILE) \ $(SAMPLE_PROFILE) \ $(STACK_GUARD) diff --git a/src/easytimer-v1/ao_easytimer.c b/src/easytimer-v1/ao_easytimer.c index 71191572..fe1299fa 100644 --- a/src/easytimer-v1/ao_easytimer.c +++ b/src/easytimer-v1/ao_easytimer.c @@ -56,7 +56,9 @@ main(void) // ao_storage_init(); - // ao_flight_init(); + ao_bmx160_init(); + + ao_flight_init(); // ao_log_init(); ao_report_init(); diff --git a/src/easytimer-v1/ao_pins.h b/src/easytimer-v1/ao_pins.h index e60153eb..e6c2755a 100644 --- a/src/easytimer-v1/ao_pins.h +++ b/src/easytimer-v1/ao_pins.h @@ -108,7 +108,7 @@ #define LEDS_AVAILABLE 0 #define HAS_GPS 0 -#define HAS_FLIGHT 0 +#define HAS_FLIGHT 1 #define HAS_ADC 1 #define HAS_ADC_TEMP 1 #define HAS_LOG 0 @@ -223,4 +223,28 @@ struct ao_adc { #define AO_MONITOR_LED 0 #define HAS_RSSI 0 +/* + * bmx160 + */ + +#define HAS_BMX160 1 +#define AO_BMX160_INT_PORT (&stm_gpioc) +#define AO_BMX160_INT_PIN 15 +#define AO_BMX160_SPI_BUS (AO_SPI_2_PB13_PB14_PB15 | AO_SPI_MODE_0) +#define AO_BMX160_SPI_CS_PORT (&stm_gpioc) +#define AO_BMX160_SPI_CS_PIN 13 +#define HAS_IMU 1 + +#define ao_data_along(packet) ((packet)->bmx160.acc_x) +#define ao_data_across(packet) (-(packet)->bmx160.acc_y) +#define ao_data_through(packet) ((packet)->bmx160.acc_z) + +#define ao_data_roll(packet) ((packet)->bmx160.gyr_x) +#define ao_data_pitch(packet) (-(packet)->bmx160.gyr_y) +#define ao_data_yaw(packet) ((packet)->bmx160.gyr_z) + +#define ao_data_mag_along(packet) ((packet)->bmx160.mag_x) +#define ao_data_mag_across(packet) (-(packet)->bmx160.mag_y) +#define ao_data_mag_through(packet) ((packet)->bmx160.mag_z) + #endif /* _AO_PINS_H_ */ diff --git a/src/easytimer-v1/ao_timer_flight.c b/src/easytimer-v1/ao_timer_flight.c deleted file mode 100644 index 23e2e90d..00000000 --- a/src/easytimer-v1/ao_timer_flight.c +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright © 2020 Keith Packard - * - * This program 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 of the License, or - * (at your option) any later version. - * - * This program 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 this program; if not, write to the Free Software Foundation, Inc., - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - */ - -#include "ao.h" -#include -#include - -enum ao_flight_state ao_flight_state; /* current flight state */ -- 2.47.2