diff --git a/drivers/Kconfig b/drivers/Kconfig index ed6bac1d24e31..67e7368d03dbc 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -7,4 +7,9 @@ menu "Drivers" rsource "Kconfig.net" rsource "periph_common/Kconfig" + +menu "Sensor Device Drivers" +rsource "tmp00x/Kconfig" +endmenu # Sensor Device Drivers + endmenu # Drivers diff --git a/drivers/include/tmp00x.h b/drivers/include/tmp00x.h index 8036cb9b8ab84..cdb961934f92c 100644 --- a/drivers/include/tmp00x.h +++ b/drivers/include/tmp00x.h @@ -101,8 +101,11 @@ extern "C" /** * @brief Default Address * - * I2C Address depends on the state of ADR0 and ADR1 Pins - * For more information, please refer to section 7.3.6.2 of TMP007 datasheet (SBOS685B). + * TMP006/TMP007 allows for upto 8 devices on a single bus. + * The address value depends on the state of ADR0 and ADR1 + * pins. Default value (0x40) corresponds to ADR0 and ADR1 + * pins tied to GND. For more information refer Serial Bus + * Address section in Datasheet. */ #ifndef CONFIG_TMP00X_I2C_ADDRESS #define CONFIG_TMP00X_I2C_ADDRESS (0x40) @@ -110,7 +113,23 @@ extern "C" /** * @brief Default Conversion Time in us + * + * The duration of the analog-to-digital(A/D) conversion is + * determined by the conversion rate bits CR0, CR1 and CR2. + * For more information refer datasheet. */ +#if IS_ACTIVE(CONFIG_TMP00X_CONVERSION_TIME_0_25s) +#define CONFIG_TMP00X_CONVERSION_TIME (25E4) +#elif IS_ACTIVE(CONFIG_TMP00X_CONVERSION_TIME_0_5s) +#define CONFIG_TMP00X_CONVERSION_TIME (5E5) +#elif IS_ACTIVE(CONFIG_TMP00X_CONVERSION_TIME_1s) +#define CONFIG_TMP00X_CONVERSION_TIME (1E6) +#elif IS_ACTIVE(CONFIG_TMP00X_CONVERSION_TIME_2s) +#define CONFIG_TMP00X_CONVERSION_TIME (2E6) +#elif IS_ACTIVE(CONFIG_TMP00X_CONVERSION_TIME_4s) +#define CONFIG_TMP00X_CONVERSION_TIME (4E6) +#endif + #ifndef CONFIG_TMP00X_CONVERSION_TIME #define CONFIG_TMP00X_CONVERSION_TIME (1E6) #endif diff --git a/drivers/tmp00x/Kconfig b/drivers/tmp00x/Kconfig new file mode 100644 index 0000000000000..24a8e88f173b8 --- /dev/null +++ b/drivers/tmp00x/Kconfig @@ -0,0 +1,66 @@ +# 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_TMP00X + bool "Configure TMP00X driver" + depends on MODULE_TMP00X + help + Configure the TMP00X driver using Kconfig. + +if KCONFIG_MODULE_TMP00X + +config TMP00X_I2C_ADDRESS + hex "Default I2C Address" + range 0x40 0x47 + default 0x40 + help + TMP006/TMP007 allows for upto 8 devices on a single bus. + The address value depends on the state of ADR0 and ADR1 + pins. Default value (0x40) corresponds to ADR0 and ADR1 + pins tied to GND. For more information refer Serial Bus + Address section in Datasheet. + +choice + bool "Conversion time" + default TMP00X_CONVERSION_TIME_1s + help + The duration of the analog-to-digital(A/D) conversion is + determined by the conversion rate bits CR0, CR1 and CR2. + For more information refer datasheet. + +config TMP00X_CONVERSION_TIME_0_25s + bool "0.25 s" + +config TMP00X_CONVERSION_TIME_0_5s + bool "0.5 s" + +config TMP00X_CONVERSION_TIME_1s + bool "1 s" + +config TMP00X_CONVERSION_TIME_2s + bool "2 s" + +config TMP00X_CONVERSION_TIME_4s + bool "4 s" + +endchoice + +config TMP00X_USE_LOW_POWER + bool "Enable low power mode" + help + Enable this to put the device in low power mode + between measurements. By default the device will + always be on. Enabling this also adds a delay + based on "Conversion time" to each measurement + call for bringing the device out of standby. + +config TMP00X_USE_RAW_VALUES + bool "Enable raw ADC readings" + help + Enable this to return raw ADC readings. + By default measurements are converted to Celsius. + +endif # KCONFIG_MODULE_TMP00X