Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2018 Inria
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
19#ifndef PERIPH_CONF_H
20#define PERIPH_CONF_H
21
22#include "periph_cpu.h"
23#include "clk_conf.h"
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
33static const timer_conf_t timer_config[] = {
34 {
35 .dev = TIM2,
36 .max = 0x0000ffff,
37 .rcc_mask = RCC_APB1ENR_TIM2EN,
38 .bus = APB1,
39 .irqn = TIM2_IRQn
40 }
41};
42
43#define TIMER_0_ISR isr_tim2
44
45#define TIMER_NUMOF ARRAY_SIZE(timer_config)
52static const uart_conf_t uart_config[] = {
53 {
54 .dev = USART1,
55 .rcc_mask = RCC_APB2ENR_USART1EN,
56 .rx_pin = GPIO_PIN(PORT_A, 10),
57 .tx_pin = GPIO_PIN(PORT_A, 9),
58 .rx_af = GPIO_AF4,
59 .tx_af = GPIO_AF4,
60 .bus = APB2,
61 .irqn = USART1_IRQn,
62 .type = STM32_USART,
63 .clk_src = 0, /* Use APB clock */
64 }
65};
66
67#define UART_0_ISR (isr_usart1)
68
69#define UART_NUMOF ARRAY_SIZE(uart_config)
76static const spi_conf_t spi_config[] = {
77 {
78 .dev = SPI1,
79 .mosi_pin = GPIO_PIN(PORT_B, 5),
80 .miso_pin = GPIO_PIN(PORT_B, 4),
81 .sclk_pin = GPIO_PIN(PORT_B, 3),
82 .cs_pin = SPI_CS_UNDEF,
83 .mosi_af = GPIO_AF0,
84 .miso_af = GPIO_AF0,
85 .sclk_af = GPIO_AF0,
86 .cs_af = GPIO_AF0,
87 .rccmask = RCC_APB2ENR_SPI1EN,
88 .apbbus = APB2
89 },
90 {
91 .dev = SPI2,
92 .mosi_pin = GPIO_PIN(PORT_B, 15),
93 .miso_pin = GPIO_PIN(PORT_B, 14),
94 .sclk_pin = GPIO_PIN(PORT_B, 13),
95 .cs_pin = GPIO_PIN(PORT_B, 12),
96 .mosi_af = GPIO_AF0,
97 .miso_af = GPIO_AF0,
98 .sclk_af = GPIO_AF0,
99 .cs_af = GPIO_AF0,
100 .rccmask = RCC_APB1ENR_SPI2EN,
101 .apbbus = APB1
102 },
103};
104
105#define SPI_NUMOF ARRAY_SIZE(spi_config)
108#ifdef __cplusplus
109}
110#endif
111
112#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_A
port A
Definition periph_cpu.h:47
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:46
@ GPIO_AF4
use alternate function 4
Definition cpu_gpio.h:106
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:102
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:38
#define SPI_CS_UNDEF
Define value for unused CS line.
Definition periph_cpu.h:363
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80
SPI device configuration.
Definition periph_cpu.h:337
SPI_t * dev
pointer to the used SPI device
Definition periph_cpu.h:338
Timer device configuration.
Definition periph_cpu.h:264
TC0_t * dev
Pointer to the used as Timer device.
Definition periph_cpu.h:265
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219