From 547342ca50e5a2f94259c4e2243d18b47ff43241 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Tue, 27 Feb 2024 08:50:25 +0100 Subject: [PATCH] sensors/bmi160: fix compilation errors fix compilation errors about undefined reference to `bmi160_configspi' --- drivers/sensors/CMakeLists.txt | 7 ++++++- drivers/sensors/bmi160_base.c | 19 +++++++++++++++++++ drivers/sensors/bmi160_base.h | 18 ------------------ 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/drivers/sensors/CMakeLists.txt b/drivers/sensors/CMakeLists.txt index d803163b64..34010f349e 100644 --- a/drivers/sensors/CMakeLists.txt +++ b/drivers/sensors/CMakeLists.txt @@ -137,7 +137,12 @@ if(CONFIG_SENSORS) endif() if(CONFIG_SENSORS_BMI160) - list(APPEND SRCS bmi160.c) + list(APPEND SRCS bmi160_base.c) + if(CONFIG_SENSORS_BMI160_UORB) + list(APPEND SRCS bmi160_uorb.c) + else() + list(APPEND SRCS bmi160.c) + endif() endif() if(CONFIG_SENSORS_BMP180) diff --git a/drivers/sensors/bmi160_base.c b/drivers/sensors/bmi160_base.c index 95600d8988..41b40b3120 100644 --- a/drivers/sensors/bmi160_base.c +++ b/drivers/sensors/bmi160_base.c @@ -38,6 +38,25 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: bmi160_configspi + * + * Description: + * + ****************************************************************************/ + +#ifdef CONFIG_SENSORS_BMI160_SPI +static void bmi160_configspi(FAR struct spi_dev_s *spi) +{ + /* Configure SPI for the BMI160 */ + + SPI_SETMODE(spi, SPIDEV_MODE0); + SPI_SETBITS(spi, 8); + SPI_HWFEATURES(spi, 0); + SPI_SETFREQUENCY(spi, BMI160_SPI_MAXFREQUENCY); +} +#endif + /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/drivers/sensors/bmi160_base.h b/drivers/sensors/bmi160_base.h index 4b91fa39b9..130233c9ee 100644 --- a/drivers/sensors/bmi160_base.h +++ b/drivers/sensors/bmi160_base.h @@ -240,22 +240,4 @@ void bmi160_getregs(FAR struct bmi160_dev_s *priv, uint8_t regaddr, int bmi160_checkid(FAR struct bmi160_dev_s *priv); -/**************************************************************************** - * Name: bmi160_configspi - * - * Description: - * - ****************************************************************************/ - -#ifdef CONFIG_SENSORS_BMI160_SPI -inline void bmi160_configspi(FAR struct spi_dev_s *spi) -{ - /* Configure SPI for the BMI160 */ - - SPI_SETMODE(spi, SPIDEV_MODE0); - SPI_SETBITS(spi, 8); - SPI_HWFEATURES(spi, 0); - SPI_SETFREQUENCY(spi, BMI160_SPI_MAXFREQUENCY); -} -#endif #endif /* __INCLUDE_NUTTX_SENSORS_BMI160_COMMOM_H */