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

boards/sodaq-autonomo: add ADC configuration

This commit is contained in:
Kees Bakker 2019-09-19 21:41:03 +02:00
parent 67f82cdf6a
commit 9974ec2231
2 changed files with 37 additions and 0 deletions

View File

@ -2,6 +2,7 @@ CPU = samd21
CPU_MODEL = samd21j18a
# 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

@ -176,6 +176,42 @@ static const uart_conf_t uart_config[] = {
#define UART_NUMOF ARRAY_SIZE(uart_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_DIV2
#define ADC_REF_DEFAULT ADC_REFCTRL_REFSEL_INTVCC1
static const adc_conf_chan_t adc_channels[] = {
/* port, muxpos/pin */
/* Use the Arduino pin number order */
{GPIO_PIN(PA, 2), ADC_INPUTCTRL_MUXPOS_PIN0}, /* ADC/AIN[0], A0 */
{GPIO_PIN(PA, 6), ADC_INPUTCTRL_MUXPOS_PIN6}, /* ADC/AIN[6], A1 */
{GPIO_PIN(PA, 5), ADC_INPUTCTRL_MUXPOS_PIN5}, /* ADC/AIN[5], A2 */
{GPIO_PIN(PA, 4), ADC_INPUTCTRL_MUXPOS_PIN4}, /* ADC/AIN[4], A3 */
{GPIO_PIN(PB, 9), ADC_INPUTCTRL_MUXPOS_PIN3}, /* ADC/AIN[3], A4 */
{GPIO_PIN(PB, 8), ADC_INPUTCTRL_MUXPOS_PIN2}, /* ADC/AIN[2], A5 */
{GPIO_PIN(PB, 7), ADC_INPUTCTRL_MUXPOS_PIN15}, /* ADC/AIN[15], A6 */
{GPIO_PIN(PB, 6), ADC_INPUTCTRL_MUXPOS_PIN14}, /* ADC/AIN[14], A7 */
{GPIO_PIN(PB, 5), ADC_INPUTCTRL_MUXPOS_PIN13}, /* ADC/AIN[13], A8 */
{GPIO_PIN(PB, 4), ADC_INPUTCTRL_MUXPOS_PIN12}, /* ADC/AIN[12], A9 */
{GPIO_PIN(PA, 7), ADC_INPUTCTRL_MUXPOS_PIN7}, /* ADC/AIN[7], A10 */
{GPIO_PIN(PB, 3), ADC_INPUTCTRL_MUXPOS_PIN11}, /* ADC/AIN[11], A11 */
{GPIO_PIN(PB, 2), ADC_INPUTCTRL_MUXPOS_PIN10}, /* ADC/AIN[10], A12 */
{GPIO_PIN(PB, 1), ADC_INPUTCTRL_MUXPOS_PIN9}, /* ADC/AIN[9], A13 (pin also used for DTR) */
{GPIO_PIN(PB, 0), ADC_INPUTCTRL_MUXPOS_PIN8}, /* ADC/AIN[8], BATVOLT */
};
#define ADC_NUMOF ARRAY_SIZE(adc_channels)
/** @} */
/**
* @name PWM configuration
* @{