Skip to content
Snippets Groups Projects
Commit f1f80c00 authored by Sebastian Meiling's avatar Sebastian Meiling Committed by Vincent Dupont
Browse files

drivers/adcxx1c: use pseudomodules for device variants

parent 35056fd6
No related branches found
No related tags found
No related merge requests found
...@@ -240,7 +240,8 @@ ifneq (,$(filter lsm6dsl,$(USEMODULE))) ...@@ -240,7 +240,8 @@ ifneq (,$(filter lsm6dsl,$(USEMODULE)))
USEMODULE += xtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter adcxx1c,$(USEMODULE))) ifneq (,$(filter adc%1c,$(USEMODULE)))
FEATURES_REQUIRED += periph_gpio FEATURES_REQUIRED += periph_gpio
FEATURES_REQUIRED += periph_i2c FEATURES_REQUIRED += periph_i2c
USEMODULE += adcxx1c
endif endif
...@@ -38,7 +38,7 @@ extern "C" { ...@@ -38,7 +38,7 @@ extern "C" {
#define ADCXX1C_PARAM_ADDR (ADCXX1C_I2C_ADDRESS) #define ADCXX1C_PARAM_ADDR (ADCXX1C_I2C_ADDRESS)
#endif #endif
#ifndef ADCXX1C_PARAM_BITS #ifndef ADCXX1C_PARAM_BITS
#define ADCXX1C_PARAM_BITS (ADCXX1C_RES_8BITS) #define ADCXX1C_PARAM_BITS (ADCXX1C_RES_DEFAULT)
#endif #endif
#ifndef ADCXX1C_PARAM_CYCLE #ifndef ADCXX1C_PARAM_CYCLE
#define ADCXX1C_PARAM_CYCLE (ADCXX1C_CYCLE_DISABLED) #define ADCXX1C_PARAM_CYCLE (ADCXX1C_CYCLE_DISABLED)
......
...@@ -41,6 +41,20 @@ enum { ...@@ -41,6 +41,20 @@ enum {
ADCXX1C_RES_12BITS = 12, /**< 12 bits resolution (ADC121C family) */ 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 * @brief Conversion interval configuration value
*/ */
......
...@@ -64,5 +64,10 @@ PSEUDOMODULES += at86rf21% ...@@ -64,5 +64,10 @@ PSEUDOMODULES += at86rf21%
PSEUDOMODULES += bmp280 PSEUDOMODULES += bmp280
PSEUDOMODULES += bme280 PSEUDOMODULES += bme280
# variants of TI ADCXX1C
PSEUDOMODULES += adc081c
PSEUDOMODULES += adc101c
PSEUDOMODULES += adc121c
# add all pseudo random number generator variants as pseudomodules # add all pseudo random number generator variants as pseudomodules
PSEUDOMODULES += prng_% PSEUDOMODULES += prng_%
...@@ -3,7 +3,7 @@ include ../Makefile.tests_common ...@@ -3,7 +3,7 @@ include ../Makefile.tests_common
FEATURES_REQUIRED = periph_i2c FEATURES_REQUIRED = periph_i2c
USEMODULE += adcxx1c USEMODULE += adc081c
USEMODULE += xtimer USEMODULE += xtimer
# set alert parameters in case they are undefined # set alert parameters in case they are undefined
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment