From dd525d05dbf985837da4616ee52ffb1b732df607 Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Thu, 22 Sep 2016 16:01:28 +0000 Subject: Updated LSM6DS0 driver and related STM32 Nucleo F401RE demo git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@9770 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile | 2 +- ...F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch | 52 ---------------------- testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h | 2 +- testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c | 12 +++-- testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h | 2 +- testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile | 4 +- 6 files changed, 10 insertions(+), 64 deletions(-) delete mode 100644 testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch (limited to 'testhal') diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile index 9882b4a32..31b3ede4c 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/Makefile @@ -203,7 +203,7 @@ CPPWARN = -Wall -Wextra -Wundef UDEFS = -DCHPRINTF_USE_FLOAT=1 -DSHELL_CMD_TEST_ENABLED=0 \ -DLSM6DS0_USE_ADVANCED=0 -DLSM6DS0_GYRO_USE_ADVANCED=0 \ -DLSM6DS0_ACC_USE_ADVANCED=0 - + # Define ASM defines here UADEFS = diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch deleted file mode 100644 index 21c597ad1..000000000 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/debug/STM32F4xx-SPI-L3GD20 (OpenOCD, Flash and Run).launch +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h index 82602b403..07b0143bd 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/halconf.h @@ -76,7 +76,7 @@ * @brief Enables the I2C subsystem. */ #if !defined(HAL_USE_I2C) || defined(__DOXYGEN__) -#define HAL_USE_I2C FALSE +#define HAL_USE_I2C TRUE #endif /** diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c index fdf0199f4..196e2d8d7 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/main.c @@ -38,11 +38,9 @@ static char axisID[LSM6DS0_ACC_NUMBER_OF_AXES] = {'X', 'Y', 'Z'}; static uint32_t i; static const I2CConfig i2ccfg = { - STM32_TIMINGR_PRESC(15U) | - STM32_TIMINGR_SCLDEL(4U) | STM32_TIMINGR_SDADEL(2U) | - STM32_TIMINGR_SCLH(15U) | STM32_TIMINGR_SCLL(21U), - 0, - 0 + OPMODE_I2C, + 400000, + FAST_DUTY_CYCLE_2, }; static const LSM6DS0AccConfig lsm6ds0acccfg = { @@ -301,8 +299,8 @@ int main(void) { halInit(); chSysInit(); - palSetLineMode(LINE_ARD_D14, PAL_MODE_ALTERNATE(4) | PAL_STM32_OSPEED_HIGH); - palSetLineMode(LINE_ARD_D15, PAL_MODE_ALTERNATE(4) | PAL_STM32_OSPEED_HIGH); + palSetLineMode(LINE_ARD_D14, PAL_MODE_ALTERNATE(4)); + palSetLineMode(LINE_ARD_D15, PAL_MODE_ALTERNATE(4)); /* * Activates the serial driver 2 using the driver default configuration. diff --git a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h index 2c62a87f2..166f04112 100644 --- a/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h +++ b/testhal/STM32/STM32F4xx/I2C-LSM6DS0/mcuconf.h @@ -111,7 +111,7 @@ /* * I2C driver system settings. */ -#define STM32_I2C_USE_I2C1 FALSE +#define STM32_I2C_USE_I2C1 TRUE #define STM32_I2C_USE_I2C2 FALSE #define STM32_I2C_USE_I2C3 FALSE #define STM32_I2C_BUSY_TIMEOUT 50 diff --git a/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile b/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile index bdfbb5c70..0a74c53b4 100644 --- a/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile +++ b/testhal/STM32/STM32L4xx/I2C-LSM6DS0/Makefile @@ -5,7 +5,7 @@ # Compiler options here. ifeq ($(USE_OPT),) - USE_OPT = -O0 -ggdb -fomit-frame-pointer -falign-functions=16 + USE_OPT = -O2 -ggdb -fomit-frame-pointer -falign-functions=16 endif # C specific options here (added to USE_OPT). @@ -203,7 +203,7 @@ CPPWARN = -Wall -Wextra -Wundef UDEFS = -DCHPRINTF_USE_FLOAT=1 -DSHELL_CMD_TEST_ENABLED=0 \ -DLSM6DS0_USE_ADVANCED=0 -DLSM6DS0_GYRO_USE_ADVANCED=0 \ -DLSM6DS0_ACC_USE_ADVANCED=0 - + # Define ASM defines here UADEFS = -- cgit v1.2.3