From ebbfcfb56bb101feaea4bbc1d194b6557c0b5243 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Thu, 30 Apr 2020 23:26:54 +0530 Subject: [PATCH 1/3] drivers/l3g4200d : Add CONFIG_ Add CONFIG_ prefix to L3G4200D_DEFAULT_ADDRESS --- drivers/include/l3g4200d.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/include/l3g4200d.h b/drivers/include/l3g4200d.h index 27d40c2d84..6f8f4ac556 100644 --- a/drivers/include/l3g4200d.h +++ b/drivers/include/l3g4200d.h @@ -49,8 +49,8 @@ * For more information on SerialBus Address, refer Section 5.1.1 * I2C Operation on datasheet. */ -#ifndef L3G4200D_DEFAULT_ADDRESS -#define L3G4200D_DEFAULT_ADDRESS 0x68 +#ifndef CONFIG_L3G4200D_DEFAULT_ADDRESS +#define CONFIG_L3G4200D_DEFAULT_ADDRESS 0x68 #endif /** @} */ From 5782c3bb0dbe0b02b589307a32b51c4762ba5b58 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Thu, 30 Apr 2020 23:27:51 +0530 Subject: [PATCH 2/3] drivers/l3g4200d : Make ADR configurable Make L3G4200D_PARAM_ADDR configurable --- drivers/l3g4200d/include/l3g4200d_params.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/l3g4200d/include/l3g4200d_params.h b/drivers/l3g4200d/include/l3g4200d_params.h index 3c279b99ae..7c0f051fb0 100644 --- a/drivers/l3g4200d/include/l3g4200d_params.h +++ b/drivers/l3g4200d/include/l3g4200d_params.h @@ -35,7 +35,7 @@ extern "C" { #define L3G4200D_PARAM_I2C I2C_DEV(0) #endif #ifndef L3G4200D_PARAM_ADDR -#define L3G4200D_PARAM_ADDR (0x68) +#define L3G4200D_PARAM_ADDR (CONFIG_L3G4200D_DEFAULT_ADDRESS) #endif #ifndef L3G4200D_PARAM_INT1 #define L3G4200D_PARAM_INT1 (GPIO_PIN(0, 0)) From 21dd8f755533b5f807dae509b7e348b527d204b3 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Thu, 30 Apr 2020 23:35:11 +0530 Subject: [PATCH 3/3] drivers/l3g4200d : Expose to Kconfig Expose configurations to Kconfig. --- drivers/Kconfig | 1 + drivers/include/l3g4200d.h | 8 ++++---- drivers/l3g4200d/Kconfig | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 drivers/l3g4200d/Kconfig diff --git a/drivers/Kconfig b/drivers/Kconfig index 40f11c8218..04c582a482 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -19,6 +19,7 @@ rsource "ads101x/Kconfig" rsource "bmx055/Kconfig" rsource "fxos8700/Kconfig" rsource "hdc1000/Kconfig" +rsource "l3g4200d/Kconfig" rsource "lpsxxx/Kconfig" rsource "mag3110/Kconfig" rsource "mma8x5x/Kconfig" diff --git a/drivers/include/l3g4200d.h b/drivers/include/l3g4200d.h index 6f8f4ac556..0a6f9d0385 100644 --- a/drivers/include/l3g4200d.h +++ b/drivers/include/l3g4200d.h @@ -44,10 +44,10 @@ /** * @brief Default address * - * The address depends on the status of SDO Pin. - * Default address corresponds to SD0 connected to GND. - * For more information on SerialBus Address, refer Section 5.1.1 - * I2C Operation on datasheet. + * The address depends on the status of SDO Pin. Default + * address corresponds to SDO connected to GND. For more + * information refer to the section 'I2C Operation' in + * the datasheet. */ #ifndef CONFIG_L3G4200D_DEFAULT_ADDRESS #define CONFIG_L3G4200D_DEFAULT_ADDRESS 0x68 diff --git a/drivers/l3g4200d/Kconfig b/drivers/l3g4200d/Kconfig new file mode 100644 index 0000000000..d9417d2b55 --- /dev/null +++ b/drivers/l3g4200d/Kconfig @@ -0,0 +1,25 @@ +# Copyright (c) 2020 Freie Universitaet Berlin +# +# This file is subject to the terms and conditions of the GNU Lesser +# General Public License v2.1. See the file LICENSE in the top level +# directory for more details. +# +menuconfig KCONFIG_MODULE_L3G4200D + bool "Configure L3G4200D driver" + depends on MODULE_L3G4200D + help + Configure the L3G4200D driver using Kconfig. + +if KCONFIG_MODULE_L3G4200D + +config L3G4200D_DEFAULT_ADDRESS + hex "Default I2C address" + range 0x68 0x69 + default 0x68 + help + The address depends on the status of SDO Pin. Default + address corresponds to SDO connected to GND. For more + information refer to the section 'I2C Operation' in + the datasheet. + +endif # KCONFIG_MODULE_L3G4200D