From 7e3096eae17cd09bcf234bcc278722c894243057 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Wed, 22 Apr 2020 20:10:45 +0530 Subject: [PATCH 1/2] drivers/mma8x5x : Add CONFIG_ Add CONFIG_ Prefix for CONFIG_MMA8X5X_I2C_ADDRESS --- drivers/include/mma8x5x.h | 4 ++-- drivers/mma8x5x/include/mma8x5x_params.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/include/mma8x5x.h b/drivers/include/mma8x5x.h index 4bbd38d446..60fbb2dcab 100644 --- a/drivers/include/mma8x5x.h +++ b/drivers/include/mma8x5x.h @@ -51,8 +51,8 @@ extern "C" { * The address value depends on the state of SA0 Address Pin in the case of MMA845x series. * For more details refer Table 1 in datasheet (MMA8451Q/MMA8452Q/MMA8453Q) */ -#ifndef MMA8X5X_I2C_ADDRESS -#define MMA8X5X_I2C_ADDRESS 0x1D +#ifndef CONFIG_MMA8X5X_I2C_ADDRESS +#define CONFIG_MMA8X5X_I2C_ADDRESS 0x1D #endif /** @} */ diff --git a/drivers/mma8x5x/include/mma8x5x_params.h b/drivers/mma8x5x/include/mma8x5x_params.h index e2bc239691..2c9e4ab031 100644 --- a/drivers/mma8x5x/include/mma8x5x_params.h +++ b/drivers/mma8x5x/include/mma8x5x_params.h @@ -35,7 +35,7 @@ extern "C" { #define MMA8X5X_PARAM_I2C (I2C_DEV(0)) #endif #ifndef MMA8X5X_PARAM_ADDR -#define MMA8X5X_PARAM_ADDR (MMA8X5X_I2C_ADDRESS) +#define MMA8X5X_PARAM_ADDR (CONFIG_MMA8X5X_I2C_ADDRESS) #endif #ifndef MMA8X5X_PARAM_RATE #define MMA8X5X_PARAM_RATE (MMA8X5X_RATE_200HZ) From ec98054bea2e6cd57a35724215cd8b30736330b6 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Wed, 22 Apr 2020 20:41:49 +0530 Subject: [PATCH 2/2] drivers/mma8x5x : Expose to Kconfig Expose Configurations to Kconfig --- drivers/Kconfig.net | 1 + drivers/mma8x5x/Kconfig | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 drivers/mma8x5x/Kconfig diff --git a/drivers/Kconfig.net b/drivers/Kconfig.net index 8a0e81d515..eca8b162da 100644 --- a/drivers/Kconfig.net +++ b/drivers/Kconfig.net @@ -13,4 +13,5 @@ endmenu # Network Device Drivers menu "Sensor Device Drivers" rsource "ads101x/Kconfig" rsource "hdc1000/Kconfig" +rsource "mma8x5x/Kconfig" endmenu # Sensor Device Drivers diff --git a/drivers/mma8x5x/Kconfig b/drivers/mma8x5x/Kconfig new file mode 100644 index 0000000000..aa83d7883a --- /dev/null +++ b/drivers/mma8x5x/Kconfig @@ -0,0 +1,26 @@ +# 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_MMA8X5X + bool "Configure MMA8X5X driver" + depends on MODULE_MMA8X5X + help + Configure the MMA8X5X driver using Kconfig. + +if KCONFIG_MODULE_MMA8X5X + +config MMA8X5X_I2C_ADDRESS + hex "Default I2C address" + range 0x1C 0x1D + default 0x1D + help + The address value depends on the state of SA0 Address Pin + in the case of MMA845x series sensors. + For more details refer Table 1 in datasheet + (MMA8451Q/MMA8452Q/MMA8453Q) + Default value corresponds to SA0 connected to VCC. + +endif # KCONFIG_MODULE_MMA8X5X