From c9bf7a841e46d6c9c2a002e4f7bb9aa302bb1fa9 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Wed, 1 May 2024 18:55:46 +0200 Subject: [PATCH] sensors/bh1749nuc: configure I2C frequency --- drivers/sensors/Kconfig | 4 ++++ drivers/sensors/bh1749nuc.c | 2 +- drivers/sensors/bh1749nuc_base.h | 2 -- drivers/sensors/bh1749nuc_uorb.c | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/sensors/Kconfig b/drivers/sensors/Kconfig index 195367a084..71f08706a1 100644 --- a/drivers/sensors/Kconfig +++ b/drivers/sensors/Kconfig @@ -143,6 +143,10 @@ config SENSORS_BH1749NUC if SENSORS_BH1749NUC +config BH1749NUC_I2C_FREQUENCY + int "BH1749NUC I2C frequency" + default 400000 + config SENSORS_BH1749NUC_UORB bool "BH1749NUC UORB Interface" default n diff --git a/drivers/sensors/bh1749nuc.c b/drivers/sensors/bh1749nuc.c index 8e5940b4da..d9405fb1d8 100644 --- a/drivers/sensors/bh1749nuc.c +++ b/drivers/sensors/bh1749nuc.c @@ -203,7 +203,7 @@ int bh1749nuc_register(FAR const char *devpath, FAR struct i2c_master_s *i2c, priv->i2c = i2c; priv->addr = addr; - priv->freq = BH1749NUC_I2C_FREQ; + priv->freq = CONFIG_BH1749NUC_I2C_FREQUENCY; /* Check Device ID */ diff --git a/drivers/sensors/bh1749nuc_base.h b/drivers/sensors/bh1749nuc_base.h index 0292538275..838ceff125 100644 --- a/drivers/sensors/bh1749nuc_base.h +++ b/drivers/sensors/bh1749nuc_base.h @@ -41,8 +41,6 @@ * Pre-processor Definitions ****************************************************************************/ -#define BH1749NUC_I2C_FREQ 400000 - #define BH1749NUC_MANUFACTID 0xE0 /* Manufact ID */ #define BH1749NUC_PARTID 0x0D /* Part ID */ diff --git a/drivers/sensors/bh1749nuc_uorb.c b/drivers/sensors/bh1749nuc_uorb.c index 1e9b1e1ea1..53f3debb84 100644 --- a/drivers/sensors/bh1749nuc_uorb.c +++ b/drivers/sensors/bh1749nuc_uorb.c @@ -450,7 +450,7 @@ int bh1749nuc_register_uorb(int devno, FAR struct bh1749nuc_config_s *config) dev->dev.i2c = config->i2c; dev->dev.addr = config->addr; - dev->dev.freq = BH1749NUC_I2C_FREQ; + dev->dev.freq = CONFIG_BH1749NUC_I2C_FREQUENCY; /* Check Device ID */