diff --git a/Hello_World/Makefile b/Hello_World/Makefile index 9c06e0fbc40c180b0bed0365a98498558550b748..7ed25360650add0d09d04c8149cfa5a628ee0293 100644 --- a/Hello_World/Makefile +++ b/Hello_World/Makefile @@ -68,6 +68,7 @@ CMSIS_ROOT=$(LIBS_DIR)/CMSIS SRCS = main.c SRCS += ../lib/card10/oled96.c SRCS += ../lib/card10/fonts.c +SRCS += bhy_support.c bhy_uc_driver.c bhy.c # Where to find source files for this test VPATH = . @@ -78,6 +79,10 @@ IPATH = . IPATH += ../lib/card10 VPATH += ../lib/card10 +IPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/driver/inc +IPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/ +VPATH += ../lib/bosch/BHy1_driver_and_MCU_solution/driver/src + # Enable assertion checking for development PROJ_CFLAGS+=-DMXC_ASSERT_ENABLE diff --git a/Hello_World/main.c b/Hello_World/main.c index 6a225e645b89d0b1f3a6dfc93dd4fc7f5f504703..201aaa4bfe65b90990e32694aea92a4bb6c0fcb8 100644 --- a/Hello_World/main.c +++ b/Hello_World/main.c @@ -52,6 +52,9 @@ #include "rtc.h" #include "spi.h" #include "oled96.h" +#include "bhy.h" +#include "Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h" +#include "bhy_uc_driver.h" /***** Definitions *****/ @@ -102,6 +105,10 @@ int main(void) //Setup the I2CM I2C_Shutdown(I2C_DEVICE); I2C_Init(I2C_DEVICE, I2C_FAST_MODE, NULL); + + I2C_Shutdown(MXC_I2C1_BUS0); + I2C_Init(MXC_I2C1_BUS0, I2C_FAST_MODE, NULL); + #if 0 NVIC_EnableIRQ(I2C0_IRQn); // Not sure if we actually need this when not doing async requests #endif @@ -120,6 +127,11 @@ int main(void) oledFill(0x00); oledWriteString(0, 0, " card10", 1); + if(bhy_driver_init(bhy1_fw)) { + printf("Failed to init bhy\n"); + } + + // Enable 32 kHz output RTC_SquareWave(MXC_RTC, SQUARE_WAVE_ENABLED, F_32KHZ, NOISE_IMMUNE_MODE, NULL); diff --git a/lib/bosch/BHy1_driver_and_MCU_solution/driver/src/bhy_support.c b/lib/bosch/BHy1_driver_and_MCU_solution/driver/src/bhy_support.c index 13513d35037ddf0cb7dec1a1b775fe90a14eb0a7..c7c0e000d270a8483e9153337071c6abd042ce21 100644 --- a/lib/bosch/BHy1_driver_and_MCU_solution/driver/src/bhy_support.c +++ b/lib/bosch/BHy1_driver_and_MCU_solution/driver/src/bhy_support.c @@ -67,7 +67,7 @@ static struct bhy_t bhy; static char *version = BHY_MCU_REFERENCE_VERSION; -#define I2C_DEVICE MXC_I2C0_BUS0 +#define I2C_DEVICE MXC_I2C1_BUS0 /********************************************************************************/ /* EXTERN FUNCTION DECLARATIONS */ /********************************************************************************/ diff --git a/lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h b/lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h index b1880e506c96efac6140a23c05ac097f2b9ccee0..3baca8215c2f6bea1f5411fa931a8a7622396b70 100644 --- a/lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h +++ b/lib/bosch/BHy1_driver_and_MCU_solution/examples/firmware/Bosch_PCB_7183_di03_BMI160_BMM150-7183_di03.2.1.11696_170103.h @@ -1,4 +1,5 @@ -const unsigned char bhy1_fw[] = { +#include <stdint.h> +const uint8_t bhy1_fw[] = { 0x2a, 0x65, 0x00, 0x1a, 0x9a, 0x31, 0x1b, 0xe7, 0x00, 0x00, 0x00, 0x00, 0x74, 0x28, 0x00, 0x00, 0xe8, 0x99, 0x7f, 0x00, 0x44, 0x19, 0x00, 0x00, 0x68, 0x8d, 0x7f, 0x00, 0x4a, 0x26, 0x00, 0x70, 0x4a, 0x26, 0x00, 0x70,