summaryrefslogtreecommitdiff
path: root/src/telemega-v0.1
diff options
context:
space:
mode:
authorBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
committerBdale Garbee <bdale@gag.com>2013-12-19 01:38:40 -0700
commit575bbaf976c5840fd0e308549c45a466fdec1352 (patch)
tree11bfb498348bf7687bffc24699c4b1a998988ee4 /src/telemega-v0.1
parentb825116df173b77e2cab217a7b76112c742f9279 (diff)
parentbc3610d8cecbfed40c62d4dcb93fc9a4d2a7c9e3 (diff)
Merge branch 'branch-1.3' into debian
Conflicts: ChangeLog altoslib/AltosRecordMM.java altosui/Makefile.am altosui/altos-windows.nsi.in configure.ac debian/changelog debian/control doc/Makefile doc/altusmetrum.xsl doc/release-notes-1.2.1.xsl doc/release-notes-1.2.xsl
Diffstat (limited to 'src/telemega-v0.1')
-rw-r--r--src/telemega-v0.1/Makefile26
-rw-r--r--src/telemega-v0.1/ao_pins.h99
-rw-r--r--src/telemega-v0.1/ao_telemega.c2
3 files changed, 74 insertions, 53 deletions
diff --git a/src/telemega-v0.1/Makefile b/src/telemega-v0.1/Makefile
index a72d08f2..0145f49c 100644
--- a/src/telemega-v0.1/Makefile
+++ b/src/telemega-v0.1/Makefile
@@ -25,6 +25,8 @@ INC = \
ao_task.h \
ao_whiten.h \
ao_sample_profile.h \
+ ao_quaternion.h \
+ math.h \
ao_mpu.h \
stm32l.h \
Makefile
@@ -44,6 +46,20 @@ INC = \
#STACK_GUARD=ao_mpu_stm.c
#STACK_GUARD_DEF=-DHAS_STACK_GUARD=1
+MATH_SRC=\
+ ef_acos.c \
+ ef_sqrt.c \
+ ef_rem_pio2.c \
+ kf_cos.c \
+ kf_sin.c \
+ kf_rem_pio2.c \
+ sf_copysign.c \
+ sf_cos.c \
+ sf_sin.c \
+ sf_fabs.c \
+ sf_floor.c \
+ sf_scalbn.c
+
ALTOS_SRC = \
ao_boot_chain.c \
ao_interrupt.c \
@@ -59,6 +75,7 @@ ALTOS_SRC = \
ao_mutex.c \
ao_serial_stm.c \
ao_gps_skytraq.c \
+ ao_gps_show.c \
ao_gps_report_mega.c \
ao_ignite.c \
ao_freq.c \
@@ -73,6 +90,7 @@ ALTOS_SRC = \
ao_hmc5883.c \
ao_adc_stm.c \
ao_beep_stm.c \
+ ao_eeprom_stm.c \
ao_storage.c \
ao_m25.c \
ao_usb_stm.c \
@@ -92,6 +110,7 @@ ALTOS_SRC = \
ao_companion.c \
ao_pyro.c \
ao_aprs.c \
+ $(MATH_SRC) \
$(PROFILE) \
$(SAMPLE_PROFILE) \
$(STACK_GUARD)
@@ -104,14 +123,15 @@ CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) $(PROFILE_DEF) $(SAMPLE_PROFILE_DEF) $(STA
PROGNAME=telemega-v0.1
PROG=$(PROGNAME)-$(VERSION).elf
+HEX=$(PROGNAME)-$(VERSION).ihx
SRC=$(ALTOS_SRC) ao_telemega.c
OBJ=$(SRC:.c=.o)
-all: $(PROG)
+all: $(PROG) $(HEX)
$(PROG): Makefile $(OBJ) altos.ld
- $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(SAT_CLIB) -lgcc
+ $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
../altitude-pa.h: make-altitude-pa
nickle $< > $@
@@ -124,7 +144,7 @@ ao_product.h: ao-make-product.5c ../Version
distclean: clean
clean:
- rm -f *.o $(PROGNAME)-*.elf
+ rm -f *.o $(PROGNAME)-*.elf $(PROGNAME)-*.ihx
rm -f ao_product.h
install:
diff --git a/src/telemega-v0.1/ao_pins.h b/src/telemega-v0.1/ao_pins.h
index 4c645871..daeb9f17 100644
--- a/src/telemega-v0.1/ao_pins.h
+++ b/src/telemega-v0.1/ao_pins.h
@@ -64,8 +64,11 @@
#define ao_gps_set_speed ao_serial3_set_speed
#define ao_gps_fifo (ao_stm_usart3.rx_fifo)
+#define AO_CONFIG_DEFAULT_FLIGHT_LOG_MAX (1024 * 1024)
#define HAS_EEPROM 1
#define USE_INTERNAL_FLASH 0
+#define USE_EEPROM_CONFIG 1
+#define USE_STORAGE_CONFIG 0
#define HAS_USB 1
#define HAS_BEEP 1
#define HAS_RADIO 1
@@ -111,6 +114,7 @@
#define HAS_GPS 1
#define HAS_FLIGHT 1
#define HAS_ADC 1
+#define HAS_ADC_TEMP 1
#define HAS_LOG 1
/*
@@ -120,28 +124,35 @@
#define HAS_IGNITE 1
#define HAS_IGNITE_REPORT 1
-#define AO_SENSE_DROGUE(p) ((p)->adc.sense[0])
-#define AO_SENSE_MAIN(p) ((p)->adc.sense[1])
+#define AO_SENSE_PYRO(p,n) ((p)->adc.sense[n])
+#define AO_SENSE_DROGUE(p) ((p)->adc.sense[4])
+#define AO_SENSE_MAIN(p) ((p)->adc.sense[5])
#define AO_IGNITER_CLOSED 400
#define AO_IGNITER_OPEN 60
-#define AO_IGNITER_DROGUE_PORT (&stm_gpiod)
-#define AO_IGNITER_DROGUE_PIN 6
+/* Pyro A */
+#define AO_PYRO_PORT_0 (&stm_gpiod)
+#define AO_PYRO_PIN_0 6
-#define AO_IGNITER_MAIN_PORT (&stm_gpiod)
-#define AO_IGNITER_MAIN_PIN 7
+/* Pyro B */
+#define AO_PYRO_PORT_1 (&stm_gpiod)
+#define AO_PYRO_PIN_1 7
-#define AO_PYRO_PORT_0 (&stm_gpiob)
-#define AO_PYRO_PIN_0 5
+/* Pyro C */
+#define AO_PYRO_PORT_2 (&stm_gpiob)
+#define AO_PYRO_PIN_2 5
-#define AO_PYRO_PORT_1 (&stm_gpioe)
-#define AO_PYRO_PIN_1 4
+/* Pyro D */
+#define AO_PYRO_PORT_3 (&stm_gpioe)
+#define AO_PYRO_PIN_3 4
-#define AO_PYRO_PORT_2 (&stm_gpioe)
-#define AO_PYRO_PIN_2 6
+/* Drogue */
+#define AO_IGNITER_DROGUE_PORT (&stm_gpioe)
+#define AO_IGNITER_DROGUE_PIN 6
-#define AO_PYRO_PORT_3 (&stm_gpioe)
-#define AO_PYRO_PIN_3 5
+/* Main */
+#define AO_IGNITER_MAIN_PORT (&stm_gpioe)
+#define AO_IGNITER_MAIN_PIN 5
/* Number of general purpose pyro channels available */
#define AO_PYRO_NUM 4
@@ -159,11 +170,16 @@ struct ao_adc {
int16_t sense[AO_ADC_NUM_SENSE];
int16_t v_batt;
int16_t v_pbatt;
- int16_t accel_ref;
- int16_t accel;
int16_t temp;
};
+#define AO_ADC_DUMP(p) \
+ printf("tick: %5u A: %5d B: %5d C: %5d D: %5d drogue: %5d main: %5d batt: %5d pbatt: %5d temp: %5d\n", \
+ (p)->tick, \
+ (p)->adc.sense[0], (p)->adc.sense[1], (p)->adc.sense[2], \
+ (p)->adc.sense[3], (p)->adc.sense[4], (p)->adc.sense[5], \
+ (p)->adc.v_batt, (p)->adc.v_pbatt, (p)->adc.temp)
+
#define AO_ADC_SENSE_A 0
#define AO_ADC_SENSE_A_PORT (&stm_gpioa)
#define AO_ADC_SENSE_A_PIN 0
@@ -180,13 +196,13 @@ struct ao_adc {
#define AO_ADC_SENSE_D_PORT (&stm_gpioa)
#define AO_ADC_SENSE_D_PIN 3
-#define AO_ADC_SENSE_E 4
-#define AO_ADC_SENSE_E_PORT (&stm_gpioa)
-#define AO_ADC_SENSE_E_PIN 4
+#define AO_ADC_SENSE_DROGUE 4
+#define AO_ADC_SENSE_DROGUE_PORT (&stm_gpioa)
+#define AO_ADC_SENSE_DROGUE_PIN 4
-#define AO_ADC_SENSE_F 22
-#define AO_ADC_SENSE_F_PORT (&stm_gpioe)
-#define AO_ADC_SENSE_F_PIN 7
+#define AO_ADC_SENSE_MAIN 22
+#define AO_ADC_SENSE_MAIN_PORT (&stm_gpioe)
+#define AO_ADC_SENSE_MAIN_PIN 7
#define AO_ADC_V_BATT 8
#define AO_ADC_V_BATT_PORT (&stm_gpiob)
@@ -196,22 +212,13 @@ struct ao_adc {
#define AO_ADC_V_PBATT_PORT (&stm_gpiob)
#define AO_ADC_V_PBATT_PIN 1
-#define AO_ADC_ACCEL_REF 10
-#define AO_ADC_ACCEL_REF_PORT (&stm_gpioc)
-#define AO_ADC_ACCEL_REF_PIN 0
-
-#define AO_ADC_ACCEL 11
-#define AO_ADC_ACCEL_PORT (&stm_gpioc)
-#define AO_ADC_ACCEL_PIN 1
-
#define AO_ADC_TEMP 16
#define AO_ADC_RCC_AHBENR ((1 << STM_RCC_AHBENR_GPIOAEN) | \
(1 << STM_RCC_AHBENR_GPIOEEN) | \
- (1 << STM_RCC_AHBENR_GPIOBEN) | \
- (1 << STM_RCC_AHBENR_GPIOCEN))
+ (1 << STM_RCC_AHBENR_GPIOBEN))
-#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 4)
+#define AO_NUM_ADC_PIN (AO_ADC_NUM_SENSE + 2)
#define AO_ADC_PIN0_PORT AO_ADC_SENSE_A_PORT
#define AO_ADC_PIN0_PIN AO_ADC_SENSE_A_PIN
@@ -221,32 +228,26 @@ struct ao_adc {
#define AO_ADC_PIN2_PIN AO_ADC_SENSE_C_PIN
#define AO_ADC_PIN3_PORT AO_ADC_SENSE_D_PORT
#define AO_ADC_PIN3_PIN AO_ADC_SENSE_D_PIN
-#define AO_ADC_PIN4_PORT AO_ADC_SENSE_E_PORT
-#define AO_ADC_PIN4_PIN AO_ADC_SENSE_E_PIN
-#define AO_ADC_PIN5_PORT AO_ADC_SENSE_F_PORT
-#define AO_ADC_PIN5_PIN AO_ADC_SENSE_F_PIN
+#define AO_ADC_PIN4_PORT AO_ADC_SENSE_DROGUE_PORT
+#define AO_ADC_PIN4_PIN AO_ADC_SENSE_DROGUE_PIN
+#define AO_ADC_PIN5_PORT AO_ADC_SENSE_MAIN_PORT
+#define AO_ADC_PIN5_PIN AO_ADC_SENSE_MAIN_PIN
#define AO_ADC_PIN6_PORT AO_ADC_V_BATT_PORT
#define AO_ADC_PIN6_PIN AO_ADC_V_BATT_PIN
#define AO_ADC_PIN7_PORT AO_ADC_V_PBATT_PORT
#define AO_ADC_PIN7_PIN AO_ADC_V_PBATT_PIN
-#define AO_ADC_PIN8_PORT AO_ADC_ACCEL_REF_PORT
-#define AO_ADC_PIN8_PIN AO_ADC_ACCEL_REF_PIN
-#define AO_ADC_PIN9_PORT AO_ADC_ACCEL_PORT
-#define AO_ADC_PIN9_PIN AO_ADC_ACCEL_PIN
-#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 5)
+#define AO_NUM_ADC (AO_ADC_NUM_SENSE + 3)
#define AO_ADC_SQ1 AO_ADC_SENSE_A
#define AO_ADC_SQ2 AO_ADC_SENSE_B
#define AO_ADC_SQ3 AO_ADC_SENSE_C
#define AO_ADC_SQ4 AO_ADC_SENSE_D
-#define AO_ADC_SQ5 AO_ADC_SENSE_E
-#define AO_ADC_SQ6 AO_ADC_SENSE_F
+#define AO_ADC_SQ5 AO_ADC_SENSE_DROGUE
+#define AO_ADC_SQ6 AO_ADC_SENSE_MAIN
#define AO_ADC_SQ7 AO_ADC_V_BATT
#define AO_ADC_SQ8 AO_ADC_V_PBATT
-#define AO_ADC_SQ9 AO_ADC_ACCEL_REF
-#define AO_ADC_SQ10 AO_ADC_ACCEL
-#define AO_ADC_SQ11 AO_ADC_TEMP
+#define AO_ADC_SQ9 AO_ADC_TEMP
/*
* Pressure sensor settings
@@ -296,7 +297,6 @@ struct ao_adc {
#define AO_CC1120_MARC_GPIO 3
#define AO_CC1120_MARC_GPIO_IOCFG CC1120_IOCFG3
-
#define HAS_BOOT_RADIO 0
/*
@@ -316,8 +316,7 @@ struct ao_adc {
#define AO_MPU6000_INT_PORT (&stm_gpioc)
#define AO_MPU6000_INT_PIN 13
#define AO_MPU6000_I2C_INDEX STM_I2C_INDEX(1)
-
-#define HAS_HIGHG_ACCEL 0
+#define HAS_IMU 1
/*
* mma655x
diff --git a/src/telemega-v0.1/ao_telemega.c b/src/telemega-v0.1/ao_telemega.c
index fbdab64a..7b035269 100644
--- a/src/telemega-v0.1/ao_telemega.c
+++ b/src/telemega-v0.1/ao_telemega.c
@@ -24,6 +24,7 @@
#include <ao_packet.h>
#include <ao_companion.h>
#include <ao_profile.h>
+#include <ao_eeprom.h>
#if HAS_SAMPLE_PROFILE
#include <ao_sample_profile.h>
#endif
@@ -71,6 +72,7 @@ main(void)
ao_mma655x_init();
#endif
+ ao_eeprom_init();
ao_storage_init();
ao_flight_init();