easytimer-v1: Switch back to real ao_flight, enable BMX160
authorKeith Packard <keithp@keithp.com>
Thu, 9 Apr 2020 00:21:26 +0000 (17:21 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 9 Apr 2020 00:25:16 +0000 (17:25 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/easytimer-v1/Makefile
src/easytimer-v1/ao_easytimer.c
src/easytimer-v1/ao_pins.h
src/easytimer-v1/ao_timer_flight.c [deleted file]

index d17e6878bfab9e92db67c375a8b801426f8071a1..e53795b68f24c94cf5b93d54a2b2abf2111850d5 100644 (file)
@@ -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)
index 71191572d088cf5ba3e5b1e3283f72180e14d89d..fe1299fad46eb98619bd37019e28bde8c0786fff 100644 (file)
@@ -56,7 +56,9 @@ main(void)
 
 //     ao_storage_init();
 
-       // ao_flight_init();
+       ao_bmx160_init();
+
+       ao_flight_init();
        // ao_log_init();
        ao_report_init();
 
index e60153ebee5db932803501e4e1fd2a49c232e0cd..e6c2755ab10e27a700045b7b710420fec860e1b8 100644 (file)
 #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 (file)
index 23e2e90..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright © 2020 Keith Packard <keithp@keithp.com>
- *
- * 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 <ao_flight.h>
-#include <ao_sample.h>
-
-enum ao_flight_state   ao_flight_state;        /* current flight state */