drivers/sensors: fix various coding style issues

fix various coding style issues for drivers/sensors:

- remove redundant `#define CONFIG_XXX` that should be provided from Kconfig
- correct section banners
- remove empty section banners
- fix some function banners

Signed-off-by: raiden00pl <raiden00@railab.me>
This commit is contained in:
raiden00pl
2025-05-22 16:10:12 +02:00
committed by Alan C. Assis
parent 442bc1c041
commit d68476796a
78 changed files with 128 additions and 353 deletions
+31 -4
View File
@@ -143,6 +143,11 @@ config SENSORS_AS726X
---help---
Enable driver support for the AS726X Spectral Sensor.
config AS726X_I2C_FREQUENCY
int "AS726X I2C frequency"
default 100000
depends on SENSORS_AS726X
config SENSORS_BH1749NUC
bool "Rohm BH1749NUC Color Sensor support"
default n
@@ -201,6 +206,20 @@ config SENSORS_NAU7802
---help---
Enable driver support for the Adafruit NAU7802 sensor.
if SENSORS_NAU7802
config NAU7802_I2C_FREQUENCY
int "NAU7802 I2C frequency"
default 100000
config SENSORS_NAU7802_THREAD_STACKSIZE
int "NAU7802 worker thread stack size"
default 1024
---help---
The stack size for the worker threads that perform measurements.
endif # SENSORS_NAU7802
config BH1750FVI_I2C_FREQUENCY
int "BH1750FVI I2C frequency"
default 400000
@@ -979,6 +998,11 @@ config SENSORS_MSA301
---help---
Enable driver support for the MSA301.
config MSA301_I2C_FREQUENCY
int "MSA301 I2C frequency"
default 400000
depends on SENSORS_MSA301
config LSM9DS1_I2C_FREQUENCY
int "LSM9DS1 I2C frequency"
default 400000
@@ -1587,7 +1611,7 @@ config SENSORS_LIS2MDL
if SENSORS_LIS2MDL
config SENSORS_LIS2MDL_FREQUENCY
config SENSORS_LIS2MDL_I2C_FREQUENCY
int "LIS2MDL I2C frequency"
default 1000000
range 1 3400000
@@ -1737,14 +1761,12 @@ config SENSORS_AHT10
---help---
Enable driver support for the ASAIR AHT10 temperature and humidity sensors.
if SENSORS_AHT10
config AHT10_I2C_FREQUENCY
int "AHT10 I2C frequency"
depends on SENSORS_AHT10
default 400000
range 1 400000
endif # SENSORS_AHT10
config SENSORS_SHT21
bool "Sensirion SHT21 temperature and humidity sensor"
default n
@@ -1938,6 +1960,11 @@ config SENSORS_ADT7320
---help---
Enables support for the ADT7320 Driver
config ADT7320_SPI_FREQUENCY
int "ADT7320 SPI frequency"
depends on SENSORS_ADT7320
default 1000000
config SENSORS_HDC1008
bool "TI HDC1008 temperature and humidity sensor"
default n
+1 -5
View File
@@ -46,10 +46,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_ADT7320_SPI_FREQUENCY
# define CONFIG_ADT7320_SPI_FREQUENCY 1000000
#endif
#define ADT7320_SPI_MODE (SPIDEV_MODE3) /* SPI Mode 3: CPOL=1,CPHA=1 */
/* Centigrade to Fahrenheit conversion: F = 9*C/5 + 32 */
@@ -58,7 +54,7 @@
#define B16_32 (32 * 65536)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct adt7320_dev_s
+1 -5
View File
@@ -42,11 +42,7 @@
#if defined(CONFIG_SENSORS_ADXL345)
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Functions
* Private Functions Prototypes
****************************************************************************/
/* Character driver methods */
+1 -1
View File
@@ -47,7 +47,7 @@
#define ADXL372_INITIAL_CR_SIZE 7
/****************************************************************************
* Private structure definitions
* Private Types
****************************************************************************/
struct sensor_data_s
+1 -5
View File
@@ -44,10 +44,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_AHT10_I2C_FREQUENCY
# define CONFIG_AHT10_I2C_FREQUENCY 400000
#endif
/* I2C command bytes */
#define AHT10_SOFT_INIT 0xe1
@@ -56,7 +52,7 @@
#define AHT10_NORMAL_CMD 0xa8
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct aht10_dev_s
+1 -1
View File
@@ -129,7 +129,7 @@ do { \
((low & 0xff) | ((high << 8) & ~0xff))
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
/* Structure for compensating data. */
+2
View File
@@ -195,6 +195,7 @@ static const struct file_operations g_amg88xx_fops =
* Write to an amg88xx register transaction pattern:
* Write COMMAND at REGISTER
* Sensor Address / W - Register Address - Command
*
****************************************************************************/
static inline int amg88xx_i2c_write_addr(FAR struct amg88xx_dev_s *priv,
@@ -230,6 +231,7 @@ static inline int amg88xx_i2c_write_addr(FAR struct amg88xx_dev_s *priv,
* Read to an amg88xx register transaction pattern:
* Read COMMAND from REGISTER
* Sensor Address / W - Register Address - Sensor Address / R - Command
*
****************************************************************************/
static inline int amg88xx_i2c_read_addr(FAR struct amg88xx_dev_s *priv,
-12
View File
@@ -49,18 +49,6 @@
* Pre-process Definitions
****************************************************************************/
#ifndef CONFIG_APDS9922_I2C_FREQUENCY
# define CONFIG_APDS9922_I2C_FREQUENCY 400000
#endif
#ifndef CONFIG_APDS9922_ALS_NPOLLWAITERS
# define CONFIG_APDS9922_ALS_NPOLLWAITERS 2
#endif
#ifndef CONFIG_APDS9922_PS_NPOLLWAITERS
# define CONFIG_APDS9922_PS_NPOLLWAITERS 2
#endif
/* Helper macros */
#ifdef CONFIG_ENDIAN_BIG
-8
View File
@@ -48,14 +48,6 @@
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_APDS9960)
/****************************************************************************
* Pre-process Definitions
****************************************************************************/
#ifndef CONFIG_APDS9960_I2C_FREQUENCY
# define CONFIG_APDS9960_I2C_FREQUENCY 400000
#endif
/****************************************************************************
* Private Types
****************************************************************************/
-4
View File
@@ -60,10 +60,6 @@
* Pre-process Definitions
****************************************************************************/
#ifndef CONFIG_AS726X_I2C_FREQUENCY
# define CONFIG_AS726X_I2C_FREQUENCY 100000
#endif
#define AS726X_INTEGRATION_TIME 50
#define AS726X_GAIN 0b01 /* Set gain to 64x */
#define AS726X_MEASURMENT_MODE 0b10 /* One-shot reading of VBGYOR or RSTUVW */
-4
View File
@@ -28,10 +28,6 @@
#include "bh1749nuc_base.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
+1 -9
View File
@@ -37,15 +37,7 @@
#include "bh1749nuc_base.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
enum bh1749nuc_idx_e
-8
View File
@@ -41,14 +41,6 @@
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BH1750FVI)
/****************************************************************************
* Pre-process Definitions
****************************************************************************/
#ifndef CONFIG_BH1750FVI_I2C_FREQUENCY
# define CONFIG_BH1750FVI_I2C_FREQUENCY 400000
#endif
/****************************************************************************
* Private Types
****************************************************************************/
+1 -1
View File
@@ -270,7 +270,7 @@ const float const_array2[16] =
((type) >= BME680_OS_SKIPPED && (type) <= BME680_OS_16X)
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
struct bme680_data_s
+1 -1
View File
@@ -218,7 +218,7 @@
((type) >= BME688_OS_SKIPPED && (type) <= BME688_OS_16X)
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
struct bme688_data_s
+1 -1
View File
@@ -42,7 +42,7 @@
#if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_BMG160)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct bmg160_sensor_data_s
-4
View File
@@ -30,10 +30,6 @@
#if defined(CONFIG_SENSORS_BMI088)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
-12
View File
@@ -28,14 +28,6 @@
#if defined(CONFIG_SENSORS_BMI088)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -59,10 +51,6 @@ static void bmi088_configspi(FAR struct spi_dev_s *spi)
}
#endif
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
-8
View File
@@ -28,14 +28,6 @@
#if defined(CONFIG_SENSORS_BMI160)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
-8
View File
@@ -28,14 +28,6 @@
#if defined(CONFIG_SENSORS_BMI160)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
+1 -1
View File
@@ -108,7 +108,7 @@
#define INTCFG_EN_Z (1 << 5)
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
struct bmm150_trim_s
-8
View File
@@ -30,14 +30,6 @@
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BMP180)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Type Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+1 -19
View File
@@ -20,8 +20,6 @@
*
****************************************************************************/
/* Character driver for the Freescale BMP1801 Barometer Sensor */
/****************************************************************************
* Included Files
****************************************************************************/
@@ -31,23 +29,7 @@
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_BMP180)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Type Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
* Public Functions
****************************************************************************/
/****************************************************************************
+1 -1
View File
@@ -94,7 +94,7 @@
#define CURRENT_OSS (BMP180_OVERSAMPLE8X)
/****************************************************************************
* Private Type Definitions
* Private Type
****************************************************************************/
struct bmp180_dev_s
+2 -1
View File
@@ -40,7 +40,7 @@
#define BMP180_MIN_INTERVAL 30000
/****************************************************************************
* Private Type Definitions
* Private Type
****************************************************************************/
struct bmp180_dev_uorb_s
@@ -52,6 +52,7 @@ struct bmp180_dev_uorb_s
uint32_t interval; /* Sensor acquisition interval. */
struct bmp180_dev_s dev;
};
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+1 -1
View File
@@ -125,7 +125,7 @@
#define COMBINE(d) (((int)(d)[0] << 12) | ((int)(d)[1] << 4) | ((int)(d)[2] >> 4))
/****************************************************************************
* Private Type Definitions
* Private Type
****************************************************************************/
struct bmp280_dev_s
+1 -1
View File
@@ -71,7 +71,7 @@
#define DHT22_MAX_TEMP 80.0F
/****************************************************************************
* Private Type Definitions
* Private Type
****************************************************************************/
struct dhtxx_dev_s
+5 -1
View File
@@ -48,7 +48,7 @@
#define FS3000_ADDR 0x28
/****************************************************************************
* Private Type Definitions
* Private Type
****************************************************************************/
struct fs3000_dev_s
@@ -96,6 +96,7 @@ static const struct sensor_ops_s g_sensor_ops =
*
* Return value:
* Zero (OK) on success; a negated errno value on failure
*
****************************************************************************/
static int fs3000_get_data(FAR struct fs3000_dev_s *priv,
@@ -136,6 +137,7 @@ static int fs3000_get_data(FAR struct fs3000_dev_s *priv,
*
* Return value:
* Zero (OK) on success; a negated errno value on failure
*
****************************************************************************/
static int fs3000_get_velocity(FAR struct fs3000_dev_s *priv, uint8_t *data,
@@ -181,6 +183,7 @@ static int fs3000_get_velocity(FAR struct fs3000_dev_s *priv, uint8_t *data,
*
* Return value:
* Zero (OK) on success; a negated errno value on failure
*
****************************************************************************/
static int fs3000_thread(int argc, char** argv)
@@ -233,6 +236,7 @@ thread_sleep:
*
* Return value:
* Zero (OK) on success; a negated errno value on failure
*
****************************************************************************/
int fs3000_register(FAR struct i2c_master_s *i2c)
+1 -1
View File
@@ -46,7 +46,7 @@
#include <arch/irq.h>
/****************************************************************************
* Private Type Definitions
* Private Types
****************************************************************************/
/* This structure describes the state of the upper half driver */
+1 -5
View File
@@ -52,10 +52,6 @@
# define hdc1008_dbg(x, ...) sninfo(x, ##__VA_ARGS__)
#endif
#ifndef CONFIG_SHT21_I2C_FREQUENCY
# define CONFIG_SHT21_I2C_FREQUENCY 400000
#endif
/* Macros to convert raw temperature and humidity to real values. Temperature
* is scaled by 100, humidity by 10.
*/
@@ -99,7 +95,7 @@
#define HDC1008_CONFIGURATION_RST (1 << 15) /* Bit 15: Software reset bit */
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct hdc1008_dev_s
-4
View File
@@ -54,10 +54,6 @@
# define hts221_dbg(x, ...) sninfo(x, ##__VA_ARGS__)
#endif
#ifndef CONFIG_HTS221_I2C_FREQUENCY
# define CONFIG_HTS221_I2C_FREQUENCY 400000
#endif
#define HTS221_WHO_AM_I 0x0f
#define HTS221_AV_CONF 0x10
#define HTS221_CTRL_REG1 0x20
-4
View File
@@ -65,10 +65,6 @@
#define INA219_CONFIG_OPMODE_BCONT (6 << INA219_CONFIG_OPMODE_SHIFT)
#define INA219_CONFIG_OPMODE_SBCONT (7 << INA219_CONFIG_OPMODE_SHIFT)
#ifndef CONFIG_INA219_I2C_FREQUENCY
# define CONFIG_INA219_I2C_FREQUENCY 400000
#endif
#define I2C_NOSTARTSTOP_MSGS 2
#define I2C_NOSTARTSTOP_ADDRESS_MSG_INDEX 0
#define I2C_NOSTARTSTOP_DATA_MSG_INDEX 1
-4
View File
@@ -44,10 +44,6 @@
# error i2c support required
#endif
#ifndef CONFIG_INA226_I2C_FREQUENCY
# define CONFIG_INA226_I2C_FREQUENCY 400000
#endif
#define I2C_NOSTARTSTOP_MSGS 2
#define I2C_NOSTARTSTOP_ADDRESS_MSG_INDEX 0
#define I2C_NOSTARTSTOP_DATA_MSG_INDEX 1
-4
View File
@@ -68,10 +68,6 @@
#define INA3221_CONFIG_RST (1 << 15)
#ifndef CONFIG_INA3221_I2C_FREQUENCY
# define CONFIG_INA3221_I2C_FREQUENCY 400000
#endif
#define I2C_NOSTARTSTOP_MSGS 2
#define I2C_NOSTARTSTOP_ADDRESS_MSG_INDEX 0
#define I2C_NOSTARTSTOP_DATA_MSG_INDEX 1
-4
View File
@@ -45,10 +45,6 @@
* Pre-Processor Definitions
****************************************************************************/
#ifndef CONFIG_ISL29023_I2C_FREQUENCY
# define CONFIG_ISL29023_I2C_FREQUENCY 400000
#endif
/* Registers definitions */
#define ISL29023_COMMAND_1 0x00
-6
View File
@@ -45,12 +45,6 @@
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_KXTJ9_I2C_BUS_SPEED
# define CONFIG_KXTJ9_I2C_BUS_SPEED 400000
#endif
/* Register Definitions *****************************************************/
/* Output registers */
-4
View File
@@ -46,10 +46,6 @@
#if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_L3GD20)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Types
****************************************************************************/
+1 -5
View File
@@ -51,10 +51,6 @@
# define lis2dh_dbg(x, ...) sninfo(x, ##__VA_ARGS__)
#endif
#ifndef CONFIG_LIS2DH_I2C_FREQUENCY
# define CONFIG_LIS2DH_I2C_FREQUENCY 400000
#endif
#ifdef CONFIG_LIS2DH_DRIVER_SELFTEST
# define LSB_AT_10BIT_RESOLUTION 4
# define LSB_AT_12BIT_RESOLUTION 1
@@ -74,7 +70,7 @@
#define LIS2DH_COUNT_INTS
/****************************************************************************
* Private Data Types
* Private Types
****************************************************************************/
enum interrupts
-6
View File
@@ -49,12 +49,6 @@
* Pre-processor Definitions
****************************************************************************/
/* The LIS2MDL supports up to 3.4MHz bus speeds */
#ifndef CONFIG_SENSORS_LIS2MDL_I2C_FREQUENCY
#define CONFIG_SENSORS_LIS2MDL_I2C_FREQUENCY 1000000
#endif
/* The value that should be in the "who am I" register */
#define WHO_AM_I_VAL 0x40
+1 -5
View File
@@ -42,10 +42,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LIS331DL_I2C_FREQUENCY
# define CONFIG_LIS331DL_I2C_FREQUENCY 100000
#endif
/* LIS331DL Internal Registers **********************************************/
#define ST_LIS331DL_WHOAMI 0x0F /* who am I register */
@@ -80,7 +76,7 @@
#define ST_LIS331DL_OUT_Z 0x2D
/****************************************************************************
* Private Data Types
* Private Types
****************************************************************************/
struct lis331dl_dev_s
+1 -1
View File
@@ -42,7 +42,7 @@
#if defined(CONFIG_SPI) && defined(CONFIG_LIS3DSH)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct lis3dsh_sensor_data_s
+1 -1
View File
@@ -42,7 +42,7 @@
#if defined(CONFIG_SPI) && defined(CONFIG_SENSORS_LIS3MDL)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct lis3mdl_sensor_data_s
+1 -5
View File
@@ -45,17 +45,13 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LM75_I2C_FREQUENCY
# define CONFIG_LM75_I2C_FREQUENCY 100000
#endif
/* Centigrade to Fahrenheit conversion: F = 9*C/5 + 32 */
#define B16_9DIV5 (9 * 65536 / 5)
#define B16_32 (32 * 65536)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct lm75_dev_s
+1 -5
View File
@@ -44,17 +44,13 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LM92_I2C_FREQUENCY
# define CONFIG_LM92_I2C_FREQUENCY 400000
#endif
/* Centigrade to Fahrenheit conversion: F = 9*C/5 + 32 */
#define B16_9DIV5 (9 * 65536 / 5)
#define B16_32 (32 * 65536)
/****************************************************************************
* Private
* Private Types
****************************************************************************/
struct lm92_dev_s
-4
View File
@@ -48,10 +48,6 @@
# define lps25h_dbg(x, ...) sninfo(x, ##__VA_ARGS__)
#endif
#ifndef CONFIG_LPS25H_I2C_FREQUENCY
# define CONFIG_LPS25H_I2C_FREQUENCY 400000
#endif
#define LPS25H_PRESSURE_INTERNAL_DIVIDER 4096
/* 'AN4450 - Hardware and software guidelines for use of LPS25H pressure
-8
View File
@@ -58,14 +58,6 @@
#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_LSM303AGR)
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LSM303AGR_I2C_FREQUENCY
# define CONFIG_LSM303AGR_I2C_FREQUENCY 400000
#endif
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
+1 -1
View File
@@ -48,7 +48,7 @@
#define LSM330_INITIAL_GYROCR_SIZE 5
/****************************************************************************
* Private structure definitions
* Private Types
****************************************************************************/
struct sensor_data_s
-4
View File
@@ -63,10 +63,6 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_LSM6DSL_I2C_FREQUENCY
# define CONFIG_LSM6DSL_I2C_FREQUENCY 400000
#endif
/* Self test limits. */
#define LSM6DSL_MIN_ST_LIMIT_MG 50.0f /* Accelerator min limit */
-4
View File
@@ -58,10 +58,6 @@
#define MDPS_TO_RADS (3.141592653f / (180.0f * 1000.0f))
#ifndef CONFIG_SENSORS_LSM6DSO32_I2C_FREQUENCY
#define CONFIG_SENSORS_LSM6DSO32_I2C_FREQUENCY 400000
#endif /* CONFIG_SENSORS_LSM6DSO32_I2C_FREQUENCY */
/* Number of measurement rounds for gyro self test */
#define GYRO_SELFTEST_ROUNDS 5
-4
View File
@@ -26,10 +26,6 @@
#include "lsm9ds1_base.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/

Some files were not shown because too many files have changed in this diff Show More