1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/adcxx1c: use pseudomodules for device variants

This commit is contained in:
smlng 2017-06-20 10:11:27 +02:00 committed by Vincent Dupont
parent 35056fd647
commit f1f80c0098
5 changed files with 23 additions and 3 deletions

View File

@ -240,7 +240,8 @@ ifneq (,$(filter lsm6dsl,$(USEMODULE)))
USEMODULE += xtimer
endif
ifneq (,$(filter adcxx1c,$(USEMODULE)))
ifneq (,$(filter adc%1c,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_i2c
USEMODULE += adcxx1c
endif

View File

@ -38,7 +38,7 @@ extern "C" {
#define ADCXX1C_PARAM_ADDR (ADCXX1C_I2C_ADDRESS)
#endif
#ifndef ADCXX1C_PARAM_BITS
#define ADCXX1C_PARAM_BITS (ADCXX1C_RES_8BITS)
#define ADCXX1C_PARAM_BITS (ADCXX1C_RES_DEFAULT)
#endif
#ifndef ADCXX1C_PARAM_CYCLE
#define ADCXX1C_PARAM_CYCLE (ADCXX1C_CYCLE_DISABLED)

View File

@ -41,6 +41,20 @@ enum {
ADCXX1C_RES_12BITS = 12, /**< 12 bits resolution (ADC121C family) */
};
/**
* @brief ADC default resolution for device variants
*/
#if defined(MODULE_ADC081C)
#define ADCXX1C_RES_DEFAULT ADCXX1C_RES_8BITS
#elif defined(MODULE_ADC101C)
#define ADCXX1C_RES_DEFAULT ADCXX1C_RES_10BITS
#elif defined(MODULE_ADC121C)
#define ADCXX1C_RES_DEFAULT ADCXX1C_RES_12BITS
#else
#define ADCXX1C_RES_DEFAULT (-1)
#error "ADCXX1C: Failed to select resolution: unknown ADCXX1C device variant!"
#endif
/**
* @brief Conversion interval configuration value
*/

View File

@ -64,5 +64,10 @@ PSEUDOMODULES += at86rf21%
PSEUDOMODULES += bmp280
PSEUDOMODULES += bme280
# variants of TI ADCXX1C
PSEUDOMODULES += adc081c
PSEUDOMODULES += adc101c
PSEUDOMODULES += adc121c
# add all pseudo random number generator variants as pseudomodules
PSEUDOMODULES += prng_%

View File

@ -3,7 +3,7 @@ include ../Makefile.tests_common
FEATURES_REQUIRED = periph_i2c
USEMODULE += adcxx1c
USEMODULE += adc081c
USEMODULE += xtimer
# set alert parameters in case they are undefined