From: Keith Packard Date: Thu, 26 Apr 2012 06:29:20 +0000 (-0700) Subject: altos: Add hmc5883 and mpu6000 drivers to megametrum build X-Git-Tag: 1.0.9.5~27 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=7b0b6bcc40891d8dd106d091d3af8107b2941c66 altos: Add hmc5883 and mpu6000 drivers to megametrum build Signed-off-by: Keith Packard --- diff --git a/src/megametrum-v0.1/Makefile b/src/megametrum-v0.1/Makefile index 37832d16..5d73c1d0 100644 --- a/src/megametrum-v0.1/Makefile +++ b/src/megametrum-v0.1/Makefile @@ -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 diff --git a/src/megametrum-v0.1/ao_megametrum.c b/src/megametrum-v0.1/ao_megametrum.c index d93480f2..8283f533 100644 --- a/src/megametrum-v0.1/ao_megametrum.c +++ b/src/megametrum-v0.1/ao_megametrum.c @@ -16,6 +16,7 @@ */ #include +#include #include 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(); diff --git a/src/megametrum-v0.1/ao_pins.h b/src/megametrum-v0.1/ao_pins.h index 2e83de8a..cd270739 100644 --- a/src/megametrum-v0.1/ao_pins.h +++ b/src/megametrum-v0.1/ao_pins.h @@ -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_ */