Created
April 3, 2019 13:04
-
-
Save kaspar030/98402b82ba7b871bc23cd4f5736b598f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/boards/arduino-zero/Makefile.features b/boards/arduino-zero/Makefile.features | |
index a3ae65d5af..b3bee779a8 100644 | |
--- a/boards/arduino-zero/Makefile.features | |
+++ b/boards/arduino-zero/Makefile.features | |
@@ -1,4 +1,5 @@ | |
# Put defined MCU peripherals here (in alphabetical order) | |
+FEATURES_PROVIDED += periph_adc | |
FEATURES_PROVIDED += periph_i2c | |
FEATURES_PROVIDED += periph_pwm | |
FEATURES_PROVIDED += periph_rtc | |
diff --git a/boards/arduino-zero/include/periph_conf.h b/boards/arduino-zero/include/periph_conf.h | |
index b3a64798ce..1454280aae 100644 | |
--- a/boards/arduino-zero/include/periph_conf.h | |
+++ b/boards/arduino-zero/include/periph_conf.h | |
@@ -169,10 +169,31 @@ static const pwm_conf_t pwm_config[] = { | |
/** @} */ | |
/** | |
- * @name ADC configuration | |
+ * @name ADC Configuration | |
* @{ | |
*/ | |
-#define ADC_NUMOF (0) | |
+#define ADC_0_EN 1 | |
+#define ADC_MAX_CHANNELS 14 | |
+/* 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 | |
+ | |
+static const adc_conf_chan_t adc_channels[] = { | |
+ /* port, pin, muxpos */ | |
+ {GPIO_PIN(PA, 6), ADC_INPUTCTRL_MUXPOS_PIN6}, /* EXT1, pin 3 */ | |
+ {GPIO_PIN(PA, 7), ADC_INPUTCTRL_MUXPOS_PIN7}, /* EXT1, pin 4 */ | |
+}; | |
+ | |
+#define ADC_0_CHANNELS (2U) | |
+#define ADC_NUMOF ADC_0_CHANNELS | |
/** @} */ | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment