mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
a51d167a43
To simplify board definitions and for unification between samd2x and newer models, don't use the GCLK bitmask in board definitions. Instead use the GCLK index and generate the bitmask when needed.
153 lines
4.1 KiB
C
153 lines
4.1 KiB
C
/*
|
|
* Copyright (C) 2017 Inria
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup boards_sodaq-explorer
|
|
* @{
|
|
*
|
|
* @file
|
|
* @brief Configuration of CPU peripherals for the Sodaq LoRaWAN Explorer board
|
|
*
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
*/
|
|
|
|
#ifndef PERIPH_CONF_H
|
|
#define PERIPH_CONF_H
|
|
|
|
#include "periph_cpu.h"
|
|
#include "cfg_clock_default.h"
|
|
#include "cfg_rtc_default.h"
|
|
#include "cfg_rtt_default.h"
|
|
#include "cfg_spi_default.h"
|
|
#include "cfg_timer_default.h"
|
|
#include "cfg_usbdev_default.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @name UART configuration
|
|
* @{
|
|
*/
|
|
static const uart_conf_t uart_config[] = {
|
|
{
|
|
.dev = &SERCOM5->USART,
|
|
.rx_pin = GPIO_PIN(PB,31), /* D0, RX Pin */
|
|
.tx_pin = GPIO_PIN(PB,30), /* D1, TX Pin */
|
|
#ifdef MODULE_SAM0_PERIPH_UART_HW_FC
|
|
.rts_pin = GPIO_UNDEF,
|
|
.cts_pin = GPIO_UNDEF,
|
|
#endif
|
|
.mux = GPIO_MUX_D,
|
|
.rx_pad = UART_PAD_RX_1,
|
|
.tx_pad = UART_PAD_TX_0_RTS_2_CTS_3,
|
|
.flags = UART_FLAG_NONE,
|
|
.gclk_src = 0
|
|
},
|
|
{
|
|
.dev = &SERCOM4->USART,
|
|
.rx_pin = GPIO_PIN(PB,13),
|
|
.tx_pin = GPIO_PIN(PB,14),
|
|
#ifdef MODULE_SAM0_PERIPH_UART_HW_FC
|
|
.rts_pin = GPIO_UNDEF,
|
|
.cts_pin = GPIO_UNDEF,
|
|
#endif
|
|
.mux = GPIO_MUX_C,
|
|
.rx_pad = UART_PAD_RX_1,
|
|
.tx_pad = UART_PAD_TX_2,
|
|
.flags = UART_FLAG_NONE,
|
|
.gclk_src = 0
|
|
},
|
|
{ /* Connected to RN2483 */
|
|
.dev = &SERCOM0->USART,
|
|
.rx_pin = GPIO_PIN(PA,5),
|
|
.tx_pin = GPIO_PIN(PA,6),
|
|
#ifdef MODULE_SAM0_PERIPH_UART_HW_FC
|
|
.rts_pin = GPIO_UNDEF,
|
|
.cts_pin = GPIO_UNDEF,
|
|
#endif
|
|
.mux = GPIO_MUX_D,
|
|
.rx_pad = UART_PAD_RX_1,
|
|
.tx_pad = UART_PAD_TX_2,
|
|
.flags = UART_FLAG_NONE,
|
|
.gclk_src = 0
|
|
},
|
|
};
|
|
|
|
/* interrupt function name mapping */
|
|
#define UART_0_ISR isr_sercom5
|
|
#define UART_1_ISR isr_sercom4
|
|
#define UART_2_ISR isr_sercom0
|
|
|
|
#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, pin, muxpos */
|
|
{GPIO_PIN(PB, 0), ADC_INPUTCTRL_MUXPOS_PIN8}, /* A0 */
|
|
{GPIO_PIN(PB, 1), ADC_INPUTCTRL_MUXPOS_PIN9}, /* A1 */
|
|
{GPIO_PIN(PB, 2), ADC_INPUTCTRL_MUXPOS_PIN10}, /* A2 */
|
|
{GPIO_PIN(PB, 3), ADC_INPUTCTRL_MUXPOS_PIN11}, /* A3 */
|
|
{GPIO_PIN(PA, 8), ADC_INPUTCTRL_MUXPOS_PIN16}, /* A4 */
|
|
{GPIO_PIN(PA, 9), ADC_INPUTCTRL_MUXPOS_PIN17}, /* A5 */
|
|
{GPIO_PIN(PA, 4), ADC_INPUTCTRL_MUXPOS_PIN4}, /* A6 (temperature) */
|
|
{GPIO_PIN(PA, 10), ADC_INPUTCTRL_MUXPOS_PIN18}, /* A7 */
|
|
{GPIO_PIN(PA, 11), ADC_INPUTCTRL_MUXPOS_PIN19}, /* A8 */
|
|
{GPIO_PIN(PB, 5), ADC_INPUTCTRL_MUXPOS_PIN13}, /* BATVOLT */
|
|
};
|
|
|
|
#define ADC_NUMOF ARRAY_SIZE(adc_channels)
|
|
/** @} */
|
|
|
|
/**
|
|
* @name I2C configuration
|
|
* @{
|
|
*/
|
|
static const i2c_conf_t i2c_config[] = {
|
|
{
|
|
.dev = &(SERCOM1->I2CM),
|
|
.speed = I2C_SPEED_NORMAL,
|
|
.scl_pin = GPIO_PIN(PA, 17),
|
|
.sda_pin = GPIO_PIN(PA, 16),
|
|
.mux = GPIO_MUX_C,
|
|
.gclk_src = 0,
|
|
.flags = I2C_FLAG_NONE,
|
|
},
|
|
{
|
|
.dev = &(SERCOM2->I2CM),
|
|
.speed = I2C_SPEED_NORMAL,
|
|
.scl_pin = GPIO_PIN(PA, 9),
|
|
.sda_pin = GPIO_PIN(PA, 8),
|
|
.mux = GPIO_MUX_C,
|
|
.gclk_src = 0,
|
|
.flags = I2C_FLAG_NONE
|
|
}
|
|
};
|
|
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
|
/** @} */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* PERIPH_CONF_H */
|
|
/** @} */
|