2017-02-19 18:50:10 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2017 Freie Universität Berlin
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2019-07-07 13:05:43 +02:00
|
|
|
* @ingroup boards_nucleo-l053r8
|
2017-02-19 18:50:10 +01:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
* @file
|
2018-02-27 14:37:17 +01:00
|
|
|
* @brief Peripheral MCU configuration for the nucleo-l053r8 board
|
2017-02-19 18:50:10 +01:00
|
|
|
*
|
|
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
|
|
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PERIPH_CONF_H
|
|
|
|
#define PERIPH_CONF_H
|
|
|
|
|
2020-08-28 20:17:47 +02:00
|
|
|
/* Add specific clock configuration (HSE, LSE) for this board here */
|
|
|
|
#ifndef CONFIG_BOARD_HAS_LSE
|
2020-09-04 09:17:40 +02:00
|
|
|
#define CONFIG_BOARD_HAS_LSE 1
|
2020-08-28 20:17:47 +02:00
|
|
|
#endif
|
|
|
|
|
2017-02-19 18:50:10 +01:00
|
|
|
#include "periph_cpu.h"
|
2020-10-22 08:51:13 +02:00
|
|
|
#include "clk_conf.h"
|
2019-03-29 22:43:57 +01:00
|
|
|
#include "cfg_rtt_default.h"
|
2019-07-05 19:21:39 +02:00
|
|
|
#include "cfg_timer_tim2.h"
|
2017-02-19 18:50:10 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name UART configuration
|
2017-02-19 18:50:10 +01:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
static const uart_conf_t uart_config[] = {
|
|
|
|
{
|
|
|
|
.dev = USART2,
|
|
|
|
.rcc_mask = RCC_APB1ENR_USART2EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_A, 3),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_A, 2),
|
|
|
|
.rx_af = GPIO_AF4,
|
|
|
|
.tx_af = GPIO_AF4,
|
|
|
|
.bus = APB1,
|
2018-05-21 21:47:31 +02:00
|
|
|
.irqn = USART2_IRQn,
|
|
|
|
.type = STM32_USART,
|
|
|
|
.clk_src = 0, /* Use APB clock */
|
2017-02-19 18:50:10 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
.dev = USART1,
|
|
|
|
.rcc_mask = RCC_APB2ENR_USART1EN,
|
|
|
|
.rx_pin = GPIO_PIN(PORT_A, 10),
|
|
|
|
.tx_pin = GPIO_PIN(PORT_A, 9),
|
|
|
|
.rx_af = GPIO_AF4,
|
|
|
|
.tx_af = GPIO_AF4,
|
|
|
|
.bus = APB2,
|
2018-05-21 21:47:31 +02:00
|
|
|
.irqn = USART1_IRQn,
|
|
|
|
.type = STM32_USART,
|
|
|
|
.clk_src = 0, /* Use APB clock */
|
2017-02-19 18:50:10 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define UART_0_ISR (isr_usart2)
|
|
|
|
#define UART_1_ISR (isr_usart1)
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
2017-02-19 18:50:10 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name PWM configuration
|
2017-02-19 18:50:10 +01:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
static const pwm_conf_t pwm_config[] = {
|
|
|
|
{
|
|
|
|
.dev = TIM22,
|
|
|
|
.rcc_mask = RCC_APB2ENR_TIM22EN,
|
|
|
|
.chan = { { .pin = GPIO_PIN(PORT_B, 4) /* D5 */, .cc_chan = 0 },
|
|
|
|
{ .pin = GPIO_PIN(PORT_B, 5), .cc_chan = 1 },
|
|
|
|
{ .pin = GPIO_UNDEF, .cc_chan = 0 },
|
|
|
|
{ .pin = GPIO_UNDEF, .cc_chan = 0 } },
|
|
|
|
.af = GPIO_AF4,
|
|
|
|
.bus = APB2
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
|
2017-02-19 18:50:10 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
/**
|
2017-04-10 19:04:32 +02:00
|
|
|
* @name SPI configuration
|
2017-02-19 18:50:10 +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),
|
2022-01-04 12:31:20 +01:00
|
|
|
.cs_pin = SPI_CS_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,
|
2017-02-19 18:50:10 +01:00
|
|
|
.rccmask = RCC_APB2ENR_SPI1EN,
|
|
|
|
.apbbus = APB2
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2019-07-18 15:14:29 +02:00
|
|
|
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
2017-02-19 18:50:10 +01:00
|
|
|
/** @} */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* PERIPH_CONF_H */
|
|
|
|
/** @} */
|