2014-04-17 19:41:19 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014 Freie Universität Berlin
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2015-02-12 13:55:17 +01:00
|
|
|
* @ingroup boards_stm32f0discovery
|
2014-04-17 19:41:19 +02:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @brief Peripheral MCU configuration for the STM32F0discovery board
|
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
*/
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#ifndef PERIPH_CONF_H
|
|
|
|
#define PERIPH_CONF_H
|
2014-04-17 19:41:19 +02:00
|
|
|
|
2020-08-30 16:50:03 +02:00
|
|
|
/* This board provides an HSE */
|
|
|
|
#ifndef CONFIG_BOARD_HAS_HSE
|
|
|
|
#define CONFIG_BOARD_HAS_HSE 1
|
|
|
|
#endif
|
|
|
|
|
2016-02-14 14:46:08 +01:00
|
|
|
#include "periph_cpu.h"
|
2020-08-30 13:12:40 +02:00
|
|
|
#include "f0/cfg_clock_default.h"
|
2016-02-14 14:46:08 +01:00
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-04-17 19:41:19 +02:00
|
|
|
/**
|
2017-01-26 18:14:32 +01:00
|
|
|
* @name Timer configuration
|
2014-04-17 19:41:19 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-12-07 12:56:24 +01:00
|
|
|
static const timer_conf_t timer_config[] = {
|
|
|
|
{
|
|
|
|
.dev = TIM2,
|
|
|
|
.max = 0xffffffff,
|
|
|
|
.rcc_mask = RCC_APB1ENR_TIM2EN,
|
|
|
|
.bus = APB1,
|
|
|
|
.irqn = TIM2_IRQn
|
|
|
|
}
|
|
|
|
};
|
2014-04-17 19:41:19 +02:00
|
|
|
|
|
|
|
#define TIMER_0_ISR isr_tim2
|
2016-12-07 12:56:24 +01:00
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define TIMER_NUMOF ARRAY_SIZE(timer_config)
|
2014-04-17 19:41:19 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-01-26 18:14:32 +01:00
|
|
|
* @name UART configuration
|
2014-04-17 19:41:19 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2016-12-07 17:03:52 +01:00
|
|
|
static const uart_conf_t uart_config[] = {
|
|
|
|
{
|
|
|
|
.dev = USART1,
|
|
|
|
.rcc_mask = RCC_APB2ENR_USART1EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_B, 7),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_B, 6),
|
|
|
|
.rx_af = GPIO_AF0,
|
|
|
|
.tx_af = GPIO_AF0,
|
|
|
|
.bus = APB2,
|
|
|
|
.irqn = USART1_IRQn,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = USART2,
|
|
|
|
.rcc_mask = RCC_APB1ENR_USART2EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_A, 3),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_A, 2),
|
|
|
|
.rx_af = GPIO_AF1,
|
|
|
|
.tx_af = GPIO_AF1,
|
|
|
|
.bus = APB1,
|
|
|
|
.irqn = USART2_IRQn
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define UART_0_ISR (isr_usart1)
|
|
|
|
#define UART_1_ISR (isr_usart2)
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
2014-04-17 19:41:19 +02:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-01-26 18:14:32 +01:00
|
|
|
* @name ADC configuration
|
2016-02-14 14:46:08 +01:00
|
|
|
*
|
|
|
|
* We need to configure the following values:
|
|
|
|
* [ pin, channel ]
|
2014-04-17 19:41:19 +02:00
|
|
|
* @{
|
|
|
|
*/
|
2020-08-25 16:12:10 +02:00
|
|
|
static const adc_conf_t adc_config[] = {
|
|
|
|
{ GPIO_PIN(PORT_C, 0), 10 },
|
|
|
|
{ GPIO_PIN(PORT_C, 1), 11 },
|
|
|
|
{ GPIO_PIN(PORT_C, 2), 12 },
|
|
|
|
{ GPIO_PIN(PORT_C, 3), 13 },
|
|
|
|
{ GPIO_PIN(PORT_C, 4), 14 },
|
|
|
|
{ GPIO_PIN(PORT_C, 5), 15 }
|
|
|
|
};
|
2014-04-17 19:41:19 +02:00
|
|
|
|
2020-08-25 16:12:10 +02:00
|
|
|
#define ADC_NUMOF ARRAY_SIZE(adc_config)
|
2014-04-17 19:41:19 +02:00
|
|
|
/** @} */
|
|
|
|
|
2014-07-24 22:06:26 +02:00
|
|
|
/**
|
|
|
|
* @name SPI configuration
|
|
|
|
* @{
|
|
|
|
*/
|
2016-11-08 18:28:32 +01:00
|
|
|
static const spi_conf_t spi_config[] = {
|
|
|
|
{
|
|
|
|
.dev = SPI1,
|
|
|
|
.mosi_pin = GPIO_PIN(PORT_A, 7),
|
|
|
|
.miso_pin = GPIO_PIN(PORT_A, 6),
|
|
|
|
.sclk_pin = GPIO_PIN(PORT_A, 5),
|
|
|
|
.cs_pin = GPIO_UNDEF,
|
2019-06-07 08:52:42 +02:00
|
|
|
.mosi_af = GPIO_AF0,
|
|
|
|
.miso_af = GPIO_AF0,
|
|
|
|
.sclk_af = GPIO_AF0,
|
|
|
|
.cs_af = GPIO_AF0,
|
2016-11-08 18:28:32 +01:00
|
|
|
.rccmask = RCC_APB2ENR_SPI1EN,
|
|
|
|
.apbbus = APB2
|
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = SPI2,
|
|
|
|
.mosi_pin = GPIO_PIN(PORT_B, 15),
|
|
|
|
.miso_pin = GPIO_PIN(PORT_B, 14),
|
|
|
|
.sclk_pin = GPIO_PIN(PORT_B, 13),
|
|
|
|
.cs_pin = GPIO_UNDEF,
|
2019-06-07 08:52:42 +02:00
|
|
|
.mosi_af = GPIO_AF0,
|
|
|
|
.miso_af = GPIO_AF0,
|
|
|
|
.sclk_af = GPIO_AF0,
|
|
|
|
.cs_af = GPIO_AF0,
|
2016-11-08 18:28:32 +01:00
|
|
|
.rccmask = RCC_APB1ENR_SPI2EN,
|
|
|
|
.apbbus = APB1
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
2014-07-24 22:06:26 +02:00
|
|
|
/** @} */
|
|
|
|
|
2014-10-13 15:25:50 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-01-18 13:00:05 +01:00
|
|
|
#endif /* PERIPH_CONF_H */
|