From 501fa46740cc1735b5fe5f27b4b9c1a21c56a6b7 Mon Sep 17 00:00:00 2001 From: Rocco Marco Guglielmi Date: Mon, 7 Feb 2022 10:40:22 +0000 Subject: [PATCH] Updated L3GD20 demos in testex demos to be close to the pattern used in testhal demos. Minor changes to field names in L3GD20. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15434 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/ex/devices/ST/l3gd20.c | 6 +++--- os/ex/devices/ST/l3gd20.h | 10 +++++----- testex/STM32/STM32F3xx/SPI-L3GD20/main.c | 24 ++++++++++++------------ testex/STM32/STM32F4xx/SPI-L3GD20/main.c | 24 ++++++++++++------------ testex/STM32/STM32L4xx/SPI-L3GD20/main.c | 24 ++++++++++++------------ 5 files changed, 44 insertions(+), 44 deletions(-) diff --git a/os/ex/devices/ST/l3gd20.c b/os/ex/devices/ST/l3gd20.c index 7ac57aa05..aee9797b8 100644 --- a/os/ex/devices/ST/l3gd20.c +++ b/os/ex/devices/ST/l3gd20.c @@ -501,7 +501,7 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) { { cr[0] = L3GD20_CTRL_REG1_XEN | L3GD20_CTRL_REG1_YEN | L3GD20_CTRL_REG1_ZEN | L3GD20_CTRL_REG1_PD | - devp->config->gyrooutputdatarate; + devp->config->gyroodr; #if L3GD20_USE_ADVANCED || defined(__DOXYGEN__) cr[0] |= devp->config->gyrobandwidth; #endif @@ -511,7 +511,7 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) { { #if L3GD20_USE_ADVANCED || defined(__DOXYGEN__) if(devp->config->gyrohpmode != L3GD20_HPM_BYPASSED) - cr[1] = devp->config->gyrohpmode | devp->config->gyrohpconfiguration; + cr[1] = devp->config->gyrohpmode | devp->config->gyrohpcfg; #endif } @@ -519,7 +519,7 @@ void l3gd20Start(L3GD20Driver *devp, const L3GD20Config *config) { { cr[3] = devp->config->gyrofullscale; #if L3GD20_USE_ADVANCED || defined(__DOXYGEN__) - cr[3] |= devp->config->gyroblockdataupdate | + cr[3] |= devp->config->gyrobdu | devp->config->gyroendianness; #endif } diff --git a/os/ex/devices/ST/l3gd20.h b/os/ex/devices/ST/l3gd20.h index 5528ecc05..72a5a70d5 100644 --- a/os/ex/devices/ST/l3gd20.h +++ b/os/ex/devices/ST/l3gd20.h @@ -42,7 +42,7 @@ /** * @brief L3GD20 driver version string. */ -#define EX_L3GD20_VERSION "1.1.2" +#define EX_L3GD20_VERSION "1.1.3" /** * @brief L3GD20 driver version major number. @@ -57,7 +57,7 @@ /** * @brief L3GD20 driver version patch number. */ -#define EX_L3GD20_PATCH 2 +#define EX_L3GD20_PATCH 3 /** @} */ /** @@ -470,12 +470,12 @@ typedef struct { /** * @brief L3GD20 gyroscope system output data rate selection. */ - l3gd20_odr_t gyrooutputdatarate; + l3gd20_odr_t gyroodr; #if L3GD20_USE_ADVANCED || defined(__DOXYGEN__) /** * @brief L3GD20 gyroscope system block data update. */ - l3gd20_bdu_t gyroblockdataupdate; + l3gd20_bdu_t gyrobdu; /** * @brief L3GD20 gyroscope system endianness. */ @@ -491,7 +491,7 @@ typedef struct { /** * @brief L3GD20 gyroscope system HP configuration. */ - l3gd20_hpcf_t gyrohpconfiguration; + l3gd20_hpcf_t gyrohpcfg; /** * @brief L3GD20 gyroscope system LP2 filter mode. * @details To activate LP2 HP should be active diff --git a/testex/STM32/STM32F3xx/SPI-L3GD20/main.c b/testex/STM32/STM32F3xx/SPI-L3GD20/main.c index f853811ee..a2961f200 100644 --- a/testex/STM32/STM32F3xx/SPI-L3GD20/main.c +++ b/testex/STM32/STM32F3xx/SPI-L3GD20/main.c @@ -45,19 +45,19 @@ static const SPIConfig spicfg = { }; static L3GD20Config l3gd20cfg = { - &SPID1, - &spicfg, - NULL, - NULL, - L3GD20_FS_250DPS, - L3GD20_ODR_760HZ, + .spip = &SPID1, + .spicfg = &spicfg, + .gyrosensitivity = NULL, + .gyrobias = NULL, + .gyrofullscale = L3GD20_FS_250DPS, + .gyroodr = L3GD20_ODR_760HZ, #if L3GD20_USE_ADVANCED - L3GD20_BDU_CONTINUOUS, - L3GD20_END_LITTLE, - L3GD20_BW3, - L3GD20_HPM_REFERENCE, - L3GD20_HPCF_8, - L3GD20_LP2M_ON, + .gyrobdu = L3GD20_BDU_CONTINUOUS, + .gyroendianness = L3GD20_END_LITTLE, + .gyrobandwidth = L3GD20_BW3, + .gyrohpmode = L3GD20_HPM_REFERENCE, + .gyrohpcfg = L3GD20_HPCF_8, + .gyrolp2mode = L3GD20_LP2M_ON #endif }; diff --git a/testex/STM32/STM32F4xx/SPI-L3GD20/main.c b/testex/STM32/STM32F4xx/SPI-L3GD20/main.c index 328e28edc..fe03585f7 100644 --- a/testex/STM32/STM32F4xx/SPI-L3GD20/main.c +++ b/testex/STM32/STM32F4xx/SPI-L3GD20/main.c @@ -46,19 +46,19 @@ static const SPIConfig spicfg = { }; static L3GD20Config l3gd20cfg = { - &SPID1, - &spicfg, - NULL, - NULL, - L3GD20_FS_250DPS, - L3GD20_ODR_760HZ, + .spip = &SPID1, + .spicfg = &spicfg, + .gyrosensitivity = NULL, + .gyrobias = NULL, + .gyrofullscale = L3GD20_FS_250DPS, + .gyroodr = L3GD20_ODR_760HZ, #if L3GD20_USE_ADVANCED - L3GD20_BDU_CONTINUOUS, - L3GD20_END_LITTLE, - L3GD20_BW3, - L3GD20_HPM_REFERENCE, - L3GD20_HPCF_8, - L3GD20_LP2M_ON, + .gyrobdu = L3GD20_BDU_CONTINUOUS, + .gyroendianness = L3GD20_END_LITTLE, + .gyrobandwidth = L3GD20_BW3, + .gyrohpmode = L3GD20_HPM_REFERENCE, + .gyrohpcfg = L3GD20_HPCF_8, + .gyrolp2mode = L3GD20_LP2M_ON #endif }; diff --git a/testex/STM32/STM32L4xx/SPI-L3GD20/main.c b/testex/STM32/STM32L4xx/SPI-L3GD20/main.c index 224210814..616df87c4 100644 --- a/testex/STM32/STM32L4xx/SPI-L3GD20/main.c +++ b/testex/STM32/STM32L4xx/SPI-L3GD20/main.c @@ -45,19 +45,19 @@ static const SPIConfig spicfg = { }; static L3GD20Config l3gd20cfg = { - &SPID2, - &spicfg, - NULL, - NULL, - L3GD20_FS_250DPS, - L3GD20_ODR_760HZ, + .spip = &SPID2, + .spicfg = &spicfg, + .gyrosensitivity = NULL, + .gyrobias = NULL, + .gyrofullscale = L3GD20_FS_250DPS, + .gyroodr = L3GD20_ODR_760HZ, #if L3GD20_USE_ADVANCED - L3GD20_BDU_CONTINUOUS, - L3GD20_END_LITTLE, - L3GD20_BW3, - L3GD20_HPM_REFERENCE, - L3GD20_HPCF_8, - L3GD20_LP2M_ON, + .gyrobdu = L3GD20_BDU_CONTINUOUS, + .gyroendianness = L3GD20_END_LITTLE, + .gyrobandwidth = L3GD20_BW3, + .gyrohpmode = L3GD20_HPM_REFERENCE, + .gyrohpcfg = L3GD20_HPCF_8, + .gyrolp2mode = L3GD20_LP2M_ON #endif };