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

boards/arduino-nano-33-iot: add ADC configuration

This commit is contained in:
Ichiro Kuroki 2021-04-10 14:01:10 +03:00
parent a8e9a985d5
commit 068f029cc8
3 changed files with 29 additions and 0 deletions

View File

@ -11,6 +11,7 @@ config BOARD_ARDUINO_NANO_33_IOT
bool
default y
select CPU_MODEL_SAMD21G18A
select HAS_PERIPH_ADC
select HAS_PERIPH_I2C
select HAS_PERIPH_PWM
select HAS_PERIPH_RTC

View File

@ -2,6 +2,7 @@ CPU = samd21
CPU_MODEL = samd21g18a
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_rtc

View File

@ -179,6 +179,33 @@ static const pwm_conf_t pwm_config[] = {
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
/** @} */
/**
* @name ADC configuration
* @{
*/
/* ADC Default values */
#define ADC_PRESCALER ADC_CTRLB_PRESCALER_DIV512
#define ADC_NEG_INPUT ADC_INPUTCTRL_MUXNEG_GND
#define ADC_GAIN_FACTOR_DEFAULT ADC_INPUTCTRL_GAIN_1X
#define ADC_REF_DEFAULT ADC_REFCTRL_REFSEL_INT1V
static const adc_conf_chan_t adc_channels[] = {
/* port, pin, muxpos */
{GPIO_PIN(PA, 2), ADC_INPUTCTRL_MUXPOS_PIN0}, /* A0 */
{GPIO_PIN(PB, 2), ADC_INPUTCTRL_MUXPOS_PIN10}, /* A1 */
{GPIO_PIN(PA, 11), ADC_INPUTCTRL_MUXPOS_PIN19}, /* A2 */
{GPIO_PIN(PA, 10), ADC_INPUTCTRL_MUXPOS_PIN18}, /* A3 */
{GPIO_PIN(PB, 8), ADC_INPUTCTRL_MUXPOS_PIN2}, /* A4 */
{GPIO_PIN(PB, 9), ADC_INPUTCTRL_MUXPOS_PIN3}, /* A5 */
{GPIO_PIN(PA, 9), ADC_INPUTCTRL_MUXPOS_PIN17}, /* A6 */
{GPIO_PIN(PB, 3), ADC_INPUTCTRL_MUXPOS_PIN11}, /* A7 */
};
#define ADC_NUMOF ARRAY_SIZE(adc_channels)
/** @} */
/**
* @name I2C configuration
* @{