You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
731 lines
21 KiB
731 lines
21 KiB
/*
|
|
* Code generated from Atmel Start.
|
|
*
|
|
* This file will be overwritten when reconfiguring your Atmel Start project.
|
|
* Please copy examples or other code you want to keep to a separate file
|
|
* to avoid losing it when reconfiguring.
|
|
*/
|
|
|
|
#include "driver_init.h"
|
|
#include <peripheral_clk_config.h>
|
|
#include <utils.h>
|
|
#include <hal_init.h>
|
|
#include <hpl_gclk_base.h>
|
|
#include <hpl_pm_base.h>
|
|
#include <hpl_adc_base.h>
|
|
#include <hpl_rtc_base.h>
|
|
|
|
/*! The buffer size for USART */
|
|
#define USART_ASYNC_SERCOM2_BUFFER_SIZE 16
|
|
|
|
struct spi_m_sync_descriptor SPI_M_SERCOM0;
|
|
struct usart_async_descriptor USART_ASYNC_SERCOM2;
|
|
struct timer_descriptor TIMER_0;
|
|
|
|
static uint8_t USART_ASYNC_SERCOM2_buffer[USART_ASYNC_SERCOM2_BUFFER_SIZE];
|
|
|
|
struct adc_sync_descriptor ADC_0;
|
|
|
|
struct flash_descriptor FLASH_0;
|
|
|
|
struct i2c_m_sync_desc I2C_M_SYNC_SERCOM1;
|
|
|
|
struct spi_m_dma_descriptor SPI_M_DMA_SERCOM3;
|
|
|
|
struct pwm_descriptor PWM_0;
|
|
|
|
struct dac_sync_descriptor DAC_0;
|
|
|
|
void ADC_0_PORT_init(void)
|
|
{
|
|
}
|
|
|
|
void ADC_0_CLOCK_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBC, ADC);
|
|
_gclk_enable_channel(ADC_GCLK_ID, CONF_GCLK_ADC_SRC);
|
|
}
|
|
|
|
void ADC_0_init(void)
|
|
{
|
|
ADC_0_CLOCK_init();
|
|
ADC_0_PORT_init();
|
|
adc_sync_init(&ADC_0, ADC, (void *)NULL);
|
|
}
|
|
|
|
void FLASH_0_CLOCK_init(void)
|
|
{
|
|
|
|
_pm_enable_bus_clock(PM_BUS_APBB, NVMCTRL);
|
|
}
|
|
|
|
void FLASH_0_init(void)
|
|
{
|
|
FLASH_0_CLOCK_init();
|
|
flash_init(&FLASH_0, NVMCTRL);
|
|
}
|
|
|
|
void SPI_M_SERCOM0_PORT_init(void)
|
|
{
|
|
|
|
// Set pin direction to output
|
|
gpio_set_pin_direction(PA04, GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA04,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_function(PA04, PINMUX_PA04D_SERCOM0_PAD0);
|
|
|
|
// Set pin direction to output
|
|
gpio_set_pin_direction(PA05, GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA05,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_function(PA05, PINMUX_PA05D_SERCOM0_PAD1);
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA06, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA06,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA06, PINMUX_PA06D_SERCOM0_PAD2);
|
|
}
|
|
|
|
void SPI_M_SERCOM0_CLOCK_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBC, SERCOM0);
|
|
_gclk_enable_channel(SERCOM0_GCLK_ID_CORE, CONF_GCLK_SERCOM0_CORE_SRC);
|
|
}
|
|
|
|
void SPI_M_SERCOM0_init(void)
|
|
{
|
|
SPI_M_SERCOM0_CLOCK_init();
|
|
spi_m_sync_init(&SPI_M_SERCOM0, SERCOM0);
|
|
SPI_M_SERCOM0_PORT_init();
|
|
}
|
|
|
|
void I2C_M_SYNC_SERCOM1_PORT_init(void)
|
|
{
|
|
|
|
gpio_set_pin_pull_mode(PA16,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA16, PINMUX_PA16C_SERCOM1_PAD0);
|
|
|
|
gpio_set_pin_pull_mode(PA17,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA17, PINMUX_PA17C_SERCOM1_PAD1);
|
|
}
|
|
|
|
void I2C_M_SYNC_SERCOM1_CLOCK_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBC, SERCOM1);
|
|
_gclk_enable_channel(SERCOM1_GCLK_ID_CORE, CONF_GCLK_SERCOM1_CORE_SRC);
|
|
_gclk_enable_channel(SERCOM1_GCLK_ID_SLOW, CONF_GCLK_SERCOM1_SLOW_SRC);
|
|
}
|
|
|
|
void I2C_M_SYNC_SERCOM1_init(void)
|
|
{
|
|
I2C_M_SYNC_SERCOM1_CLOCK_init();
|
|
i2c_m_sync_init(&I2C_M_SYNC_SERCOM1, SERCOM1);
|
|
I2C_M_SYNC_SERCOM1_PORT_init();
|
|
}
|
|
|
|
/**
|
|
* \brief USART Clock initialization function
|
|
*
|
|
* Enables register interface and peripheral clock
|
|
*/
|
|
void USART_ASYNC_SERCOM2_CLOCK_init()
|
|
{
|
|
|
|
_pm_enable_bus_clock(PM_BUS_APBC, SERCOM2);
|
|
_gclk_enable_channel(SERCOM2_GCLK_ID_CORE, CONF_GCLK_SERCOM2_CORE_SRC);
|
|
}
|
|
|
|
/**
|
|
* \brief USART pinmux initialization function
|
|
*
|
|
* Set each required pin to USART functionality
|
|
*/
|
|
void USART_ASYNC_SERCOM2_PORT_init()
|
|
{
|
|
|
|
gpio_set_pin_function(PA08, PINMUX_PA08D_SERCOM2_PAD0);
|
|
|
|
gpio_set_pin_function(PA09, PINMUX_PA09D_SERCOM2_PAD1);
|
|
}
|
|
|
|
/**
|
|
* \brief USART initialization function
|
|
*
|
|
* Enables USART peripheral, clocks and initializes USART driver
|
|
*/
|
|
void USART_ASYNC_SERCOM2_init(void)
|
|
{
|
|
USART_ASYNC_SERCOM2_CLOCK_init();
|
|
usart_async_init(
|
|
&USART_ASYNC_SERCOM2, SERCOM2, USART_ASYNC_SERCOM2_buffer, USART_ASYNC_SERCOM2_BUFFER_SIZE, (void *)NULL);
|
|
USART_ASYNC_SERCOM2_PORT_init();
|
|
}
|
|
|
|
void SPI_M_DMA_SERCOM3_PORT_init(void)
|
|
{
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA22, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA22,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA22, PINMUX_PA22C_SERCOM3_PAD0);
|
|
|
|
// Set pin direction to output
|
|
gpio_set_pin_direction(PA20, GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA20,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_function(PA20, PINMUX_PA20D_SERCOM3_PAD2);
|
|
|
|
// Set pin direction to output
|
|
gpio_set_pin_direction(PA19, GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA19,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_function(PA19, PINMUX_PA19D_SERCOM3_PAD3);
|
|
}
|
|
|
|
void SPI_M_DMA_SERCOM3_CLOCK_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBC, SERCOM3);
|
|
_gclk_enable_channel(SERCOM3_GCLK_ID_CORE, CONF_GCLK_SERCOM3_CORE_SRC);
|
|
}
|
|
|
|
void SPI_M_DMA_SERCOM3_init(void)
|
|
{
|
|
SPI_M_DMA_SERCOM3_CLOCK_init();
|
|
spi_m_dma_init(&SPI_M_DMA_SERCOM3, SERCOM3);
|
|
SPI_M_DMA_SERCOM3_PORT_init();
|
|
}
|
|
|
|
void delay_driver_init(void)
|
|
{
|
|
delay_init(SysTick);
|
|
}
|
|
|
|
/**
|
|
* \brief Timer initialization function
|
|
*
|
|
* Enables Timer peripheral, clocks and initializes Timer driver
|
|
*/
|
|
static void TIMER_0_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBA, RTC);
|
|
_gclk_enable_channel(RTC_GCLK_ID, CONF_GCLK_RTC_SRC);
|
|
timer_init(&TIMER_0, RTC, _rtc_get_timer());
|
|
}
|
|
|
|
void PWM_0_PORT_init(void)
|
|
{
|
|
}
|
|
|
|
void PWM_0_CLOCK_init(void)
|
|
{
|
|
_pm_enable_bus_clock(PM_BUS_APBC, TC3);
|
|
_gclk_enable_channel(TC3_GCLK_ID, CONF_GCLK_TC3_SRC);
|
|
}
|
|
|
|
void PWM_0_init(void)
|
|
{
|
|
PWM_0_CLOCK_init();
|
|
PWM_0_PORT_init();
|
|
pwm_init(&PWM_0, TC3, _tc_get_pwm());
|
|
}
|
|
|
|
void DAC_0_PORT_init(void)
|
|
{
|
|
}
|
|
|
|
void DAC_0_CLOCK_init(void)
|
|
{
|
|
|
|
_pm_enable_bus_clock(PM_BUS_APBC, DAC);
|
|
_gclk_enable_channel(DAC_GCLK_ID, CONF_GCLK_DAC_SRC);
|
|
}
|
|
|
|
void DAC_0_init(void)
|
|
{
|
|
DAC_0_CLOCK_init();
|
|
dac_sync_init(&DAC_0, DAC);
|
|
DAC_0_PORT_init();
|
|
}
|
|
|
|
void USB_0_PORT_init(void)
|
|
{
|
|
|
|
gpio_set_pin_direction(PA24,
|
|
// <y> Pin direction
|
|
// <id> pad_direction
|
|
// <GPIO_DIRECTION_OFF"> Off
|
|
// <GPIO_DIRECTION_IN"> In
|
|
// <GPIO_DIRECTION_OUT"> Out
|
|
GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA24,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_pull_mode(PA24,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA24,
|
|
// <y> Pin function
|
|
// <id> pad_function
|
|
// <i> Auto : use driver pinmux if signal is imported by driver, else turn off function
|
|
// <PINMUX_PA24G_USB_DM"> Auto
|
|
// <GPIO_PIN_FUNCTION_OFF"> Off
|
|
// <GPIO_PIN_FUNCTION_A"> A
|
|
// <GPIO_PIN_FUNCTION_B"> B
|
|
// <GPIO_PIN_FUNCTION_C"> C
|
|
// <GPIO_PIN_FUNCTION_D"> D
|
|
// <GPIO_PIN_FUNCTION_E"> E
|
|
// <GPIO_PIN_FUNCTION_F"> F
|
|
// <GPIO_PIN_FUNCTION_G"> G
|
|
// <GPIO_PIN_FUNCTION_H"> H
|
|
PINMUX_PA24G_USB_DM);
|
|
|
|
gpio_set_pin_direction(PA25,
|
|
// <y> Pin direction
|
|
// <id> pad_direction
|
|
// <GPIO_DIRECTION_OFF"> Off
|
|
// <GPIO_DIRECTION_IN"> In
|
|
// <GPIO_DIRECTION_OUT"> Out
|
|
GPIO_DIRECTION_OUT);
|
|
|
|
gpio_set_pin_level(PA25,
|
|
// <y> Initial level
|
|
// <id> pad_initial_level
|
|
// <false"> Low
|
|
// <true"> High
|
|
false);
|
|
|
|
gpio_set_pin_pull_mode(PA25,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA25,
|
|
// <y> Pin function
|
|
// <id> pad_function
|
|
// <i> Auto : use driver pinmux if signal is imported by driver, else turn off function
|
|
// <PINMUX_PA25G_USB_DP"> Auto
|
|
// <GPIO_PIN_FUNCTION_OFF"> Off
|
|
// <GPIO_PIN_FUNCTION_A"> A
|
|
// <GPIO_PIN_FUNCTION_B"> B
|
|
// <GPIO_PIN_FUNCTION_C"> C
|
|
// <GPIO_PIN_FUNCTION_D"> D
|
|
// <GPIO_PIN_FUNCTION_E"> E
|
|
// <GPIO_PIN_FUNCTION_F"> F
|
|
// <GPIO_PIN_FUNCTION_G"> G
|
|
// <GPIO_PIN_FUNCTION_H"> H
|
|
PINMUX_PA25G_USB_DP);
|
|
}
|
|
|
|
/* The USB module requires a GCLK_USB of 48 MHz ~ 0.25% clock
|
|
* for low speed and full speed operation. */
|
|
#if (CONF_GCLK_USB_FREQUENCY > (48000000 + 48000000 / 400)) || (CONF_GCLK_USB_FREQUENCY < (48000000 - 48000000 / 400))
|
|
#warning USB clock should be 48MHz ~ 0.25% clock, check your configuration!
|
|
#endif
|
|
|
|
void USB_0_CLOCK_init(void)
|
|
{
|
|
|
|
_pm_enable_bus_clock(PM_BUS_APBB, USB);
|
|
_pm_enable_bus_clock(PM_BUS_AHB, USB);
|
|
_gclk_enable_channel(USB_GCLK_ID, CONF_GCLK_USB_SRC);
|
|
}
|
|
|
|
void USB_0_init(void)
|
|
{
|
|
USB_0_CLOCK_init();
|
|
usb_d_init();
|
|
USB_0_PORT_init();
|
|
}
|
|
|
|
void system_init(void)
|
|
{
|
|
init_mcu();
|
|
|
|
// GPIO on PA02
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA02, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA02,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA02, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA03
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA03, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA03,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA03, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA07
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA07, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA07,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA07, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA10
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA10, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA10,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA10, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA11
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA11, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA11,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA11, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA13
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA13, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA13,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA13, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA14
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA14, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA14,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA14, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA15
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA15, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA15,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA15, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA18
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA18, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA18,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA18, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA23
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA23, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA23,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA23, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA27
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA27, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA27,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA27, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA28
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA28, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA28,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA28, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA30
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA30, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA30,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA30, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PA31
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PA31, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PA31,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PA31, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB02
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB02, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB02,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB02, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB03
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB03, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB03,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB03, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB08
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB08, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB08,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB08, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB09
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB09, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB09,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB09, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB22
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB22, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB22,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB22, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
// GPIO on PB23
|
|
|
|
// Set pin direction to input
|
|
gpio_set_pin_direction(PB23, GPIO_DIRECTION_IN);
|
|
|
|
gpio_set_pin_pull_mode(PB23,
|
|
// <y> Pull configuration
|
|
// <id> pad_pull_config
|
|
// <GPIO_PULL_OFF"> Off
|
|
// <GPIO_PULL_UP"> Pull-up
|
|
// <GPIO_PULL_DOWN"> Pull-down
|
|
GPIO_PULL_OFF);
|
|
|
|
gpio_set_pin_function(PB23, GPIO_PIN_FUNCTION_OFF);
|
|
|
|
ADC_0_init();
|
|
|
|
FLASH_0_init();
|
|
|
|
SPI_M_SERCOM0_init();
|
|
|
|
I2C_M_SYNC_SERCOM1_init();
|
|
USART_ASYNC_SERCOM2_init();
|
|
|
|
SPI_M_DMA_SERCOM3_init();
|
|
|
|
delay_driver_init();
|
|
|
|
TIMER_0_init();
|
|
|
|
PWM_0_init();
|
|
|
|
DAC_0_init();
|
|
|
|
USB_0_init();
|
|
}
|
|
|