From 04bdd405d225c3032109b94a97850d824b181b7f Mon Sep 17 00:00:00 2001 From: Akshai M Date: Tue, 28 Apr 2020 22:21:30 +0530 Subject: [PATCH 1/2] drivers/tcs37727 : Add CONFIG_ Add CONFIG_ prefix to TCS37727_ATIME_DEFAULT and update documentation for doxygen. --- drivers/include/tcs37727.h | 8 +++++--- drivers/tcs37727/include/tcs37727_params.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/include/tcs37727.h b/drivers/include/tcs37727.h index a9b228bce3ca..a435f4578beb 100644 --- a/drivers/include/tcs37727.h +++ b/drivers/include/tcs37727.h @@ -47,10 +47,12 @@ extern "C" * @{ */ /** - * @brief Default RGBC integration time. + * @brief Default RGBC integration time in microseconds. + * + * Refer section "RGBC Time Register" in datasheet for more information. */ -#ifndef TCS37727_ATIME_DEFAULT -#define TCS37727_ATIME_DEFAULT 200000 +#ifndef CONFIG_TCS37727_ATIME_DEFAULT +#define CONFIG_TCS37727_ATIME_DEFAULT 200000 #endif /** @} */ diff --git a/drivers/tcs37727/include/tcs37727_params.h b/drivers/tcs37727/include/tcs37727_params.h index a3a6a9ba847d..664481caaecc 100644 --- a/drivers/tcs37727/include/tcs37727_params.h +++ b/drivers/tcs37727/include/tcs37727_params.h @@ -38,7 +38,7 @@ extern "C" { #define TCS37727_PARAM_ADDR (TCS37727_I2C_ADDRESS) #endif #ifndef TCS37727_PARAM_ATIME -#define TCS37727_PARAM_ATIME (TCS37727_ATIME_DEFAULT) +#define TCS37727_PARAM_ATIME (CONFIG_TCS37727_ATIME_DEFAULT) #endif #ifndef TCS37727_PARAMS From b4a23b8899dd14c62adfb6f2e2046d69113f9b24 Mon Sep 17 00:00:00 2001 From: Akshai M Date: Wed, 29 Apr 2020 09:19:05 +0530 Subject: [PATCH 2/2] drivers/tcs37727 : Expose to Kconfig Co-authored-by: Leandro Lanzieri --- drivers/Kconfig | 1 + drivers/include/tcs37727.h | 4 +++- drivers/tcs37727/Kconfig | 24 ++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 drivers/tcs37727/Kconfig diff --git a/drivers/Kconfig b/drivers/Kconfig index 04c582a482ce..d5d68e958d96 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -25,6 +25,7 @@ rsource "mag3110/Kconfig" rsource "mma8x5x/Kconfig" rsource "opt3001/Kconfig" rsource "sps30/Kconfig" +rsource "tcs37727/Kconfig" endmenu # Sensor Device Drivers menu "Storage Device Drivers" diff --git a/drivers/include/tcs37727.h b/drivers/include/tcs37727.h index a435f4578beb..f54734c182b7 100644 --- a/drivers/include/tcs37727.h +++ b/drivers/include/tcs37727.h @@ -49,7 +49,9 @@ extern "C" /** * @brief Default RGBC integration time in microseconds. * - * Refer section "RGBC Time Register" in datasheet for more information. + * RGBC integration time impacts both the resolution and the sensitivity of the + * RGBC reading. Refer to the section "RGBC Time Register" in the datasheet for + * more information. */ #ifndef CONFIG_TCS37727_ATIME_DEFAULT #define CONFIG_TCS37727_ATIME_DEFAULT 200000 diff --git a/drivers/tcs37727/Kconfig b/drivers/tcs37727/Kconfig new file mode 100644 index 000000000000..ab6f2d81677e --- /dev/null +++ b/drivers/tcs37727/Kconfig @@ -0,0 +1,24 @@ +# 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_TCS37727 + bool "Configure TCS37727 driver" + depends on MODULE_TCS37727 + help + Configure the TCS37727 driver using Kconfig. + +if KCONFIG_MODULE_TCS37727 + +config TCS37727_ATIME_DEFAULT + int "RGBC integration time in microseconds" + range 2400 614000 + default 200000 + help + RGBC integration time impacts both the resolution and the sensitivity + of the RGBC reading. Refer to the section "RGBC Time Register" in the + datasheet for more information. + +endif # KCONFIG_MODULE_TCS37727