diff --git a/boards/sensebox_samd21/Makefile.features b/boards/sensebox_samd21/Makefile.features index 23f79a2aaa8c54c86cb09b211515cc7a0420d692..48701b5bc39b98c43c9c74e07b4dd060e28ab37d 100644 --- a/boards/sensebox_samd21/Makefile.features +++ b/boards/sensebox_samd21/Makefile.features @@ -1,4 +1,5 @@ # Put defined MCU peripherals here (in alphabetical order) +FEATURES_PROVIDED += periph_adc FEATURES_PROVIDED += periph_gpio periph_gpio_irq FEATURES_PROVIDED += periph_i2c FEATURES_PROVIDED += periph_rtc diff --git a/boards/sensebox_samd21/include/periph_conf.h b/boards/sensebox_samd21/include/periph_conf.h index eb754234bcdcf5a09c1aaf8342f1d5be08955e6a..e0c844e1e16d73d4a265794244ff609457f82558 100644 --- a/boards/sensebox_samd21/include/periph_conf.h +++ b/boards/sensebox_samd21/include/periph_conf.h @@ -186,6 +186,38 @@ static const i2c_conf_t i2c_config[] = { /** @} */ +/** + * @name ADC configuration + * @{ + */ +#define ADC_0_EN 1 +/* ADC 0 device configuration */ +#define ADC_0_DEV ADC +#define ADC_0_IRQ ADC_IRQn + +/* ADC 0 Default values */ +#define ADC_0_CLK_SOURCE 0 /* GCLK_GENERATOR_0 */ +#define ADC_0_PRESCALER ADC_CTRLB_PRESCALER_DIV512 + +#define ADC_0_NEG_INPUT ADC_INPUTCTRL_MUXNEG_GND +#define ADC_0_GAIN_FACTOR_DEFAULT ADC_INPUTCTRL_GAIN_1X +#define ADC_0_REF_DEFAULT ADC_REFCTRL_REFSEL_INT1V + +/* Digital pins (1 to 6) on the board can be configured as analog inputs */ +static const adc_conf_chan_t adc_channels[] = { + /* port, pin, muxpos */ + { GPIO_PIN(PA, 4), ADC_INPUTCTRL_MUXPOS_PIN4 }, /* Digital 1 */ + { GPIO_PIN(PA, 5), ADC_INPUTCTRL_MUXPOS_PIN5 }, /* Digital 2 */ + { GPIO_PIN(PA, 6), ADC_INPUTCTRL_MUXPOS_PIN6 }, /* Digital 3 */ + { GPIO_PIN(PA, 7), ADC_INPUTCTRL_MUXPOS_PIN7 }, /* Digital 4 */ + { GPIO_PIN(PA, 3), ADC_INPUTCTRL_MUXPOS_PIN1 }, /* Digital 5 */ + { GPIO_PIN(PA, 2), ADC_INPUTCTRL_MUXPOS_PIN0 }, /* Digital 6 */ +}; + +#define ADC_0_CHANNELS (6U) +#define ADC_NUMOF ADC_0_CHANNELS +/** @} */ + #ifdef __cplusplus } #endif