altos: Add hmc5883 and mpu6000 drivers to megametrum build
authorKeith Packard <keithp@keithp.com>
Thu, 26 Apr 2012 06:29:20 +0000 (23:29 -0700)
committerKeith Packard <keithp@keithp.com>
Thu, 26 Apr 2012 06:29:20 +0000 (23:29 -0700)
Signed-off-by: Keith Packard <keithp@keithp.com>
src/megametrum-v0.1/Makefile
src/megametrum-v0.1/ao_megametrum.c
src/megametrum-v0.1/ao_pins.h

index 37832d16e6e9856dcfa79bf20833c79df7ec1a60..5d73c1d064ed061311ef849fee541d97ced707bd 100644 (file)
@@ -13,7 +13,10 @@ INC = \
        altitude.h \
        ao_kalman.h \
        ao_product.h \
-       ao_ms5607.h
+       ao_ms5607.h \
+       ao_hmc5883.h \
+       ao_mpu6000.h \
+       stm32l.h
 
 #
 # Common AltOS sources
@@ -44,13 +47,16 @@ ALTOS_SRC = \
        ao_usb_stm.c \
        ao_exti_stm.c \
        ao_packet.c \
-       ao_packet_slave.c
+       ao_packet_slave.c \
+       ao_i2c_stm.c \
+       ao_hmc5883.c \
+       ao_mpu6000.c
 
 PRODUCT=MegaMetrum-v0.1
 PRODUCT_DEF=-DMEGAMETRUM
 IDPRODUCT=0x000a
 
-CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -Os -g
+CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -O0 -g
 
 PROG=megametrum-v0.1-$(VERSION).elf
 
index d93480f2b87379a9c18527c30ea2a6b05b2b018c..8283f5332372476f60c608be16c52cf524b744ea 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <ao.h>
+#include <ao_hmc5883.h>
 #include <ao_exti.h>
 
 void
@@ -54,6 +55,9 @@ main(void)
        ao_usb_init();
        ao_exti_init();
        ao_radio_init();
+       ao_i2c_init();
+       ao_hmc5883_init();
+       ao_mpu6000_init();
        
        ao_cmd_register(&ao_mm_cmds[0]);
        ao_start_scheduler();
index 2e83de8a35e67f73126d214d5d6af229bda95d60..cd2707397d8024532c8fa86575d97ea32a6ee14f 100644 (file)
@@ -42,7 +42,7 @@
 #define AO_RCC_CFGR_PPRE2_DIV  STM_RCC_CFGR_PPRE2_DIV_2
 
 #define HAS_SERIAL_1           1
-#define USE_SERIAL_1_STDIN     1
+#define USE_SERIAL_1_STDIN     0
 #define SERIAL_1_PB6_PB7       0
 #define SERIAL_1_PA9_PA10      1
 
@@ -206,4 +206,20 @@ struct ao_adc {
 
 #define AO_CC1120_INT_GPIO     2
 
+/*
+ * Mag sensor (hmc5883)
+ */
+
+#define AO_HMC5883_INT_PORT    stm_gpioc
+#define AO_HMC5883_INT_PIN     12
+#define AO_HMC5883_I2C_INDEX   STM_SPI_INDEX(1)
+
+/*
+ * mpu6000
+ */
+
+#define AO_MPU6000_INT_PORT    stm_gpioc
+#define AO_MPU6000_INT_PIN     13
+#define AO_MPU6000_I2C_INDEX   STM_SPI_INDEX(1)
+
 #endif /* _AO_PINS_H_ */