Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Benjamin Valentin
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
20#ifndef PERIPH_CONF_H
21#define PERIPH_CONF_H
22
23/* This board provides a LSE */
24#ifndef CONFIG_BOARD_HAS_LSE
25#define CONFIG_BOARD_HAS_LSE 1
26#endif
27
28/* This board provides an HSE */
29#ifndef CONFIG_BOARD_HAS_HSE
30#define CONFIG_BOARD_HAS_HSE 1
31#endif
32
33#include "clk_conf.h"
34#include "cfg_i2c1_pb8_pb9.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif
39
44static const timer_conf_t timer_config[] = {
45 {
46 .dev = TIM1,
47 .max = 0x0000ffff,
48 .rcc_mask = RCC_APB2ENR_TIM1EN,
49 .bus = APB2,
50 .irqn = TIM1_CC_IRQn
51 },
52 {
53 .dev = TIM3,
54 .max = 0x0000ffff,
55 .rcc_mask = RCC_APB1ENR_TIM3EN,
56 .bus = APB1,
57 .irqn = TIM3_IRQn
58 },
59};
60
61#define TIMER_0_ISR (isr_tim1_cc)
62#define TIMER_1_ISR (isr_tim3)
63
64#define TIMER_NUMOF ARRAY_SIZE(timer_config)
71static const uart_conf_t uart_config[] = {
72 {
73 .dev = USART1,
74 .rcc_mask = RCC_APB2ENR_USART1EN,
75 .rx_pin = GPIO_PIN(PORT_A, 10),
76 .tx_pin = GPIO_PIN(PORT_A, 9),
77 .rx_af = GPIO_AF1,
78 .tx_af = GPIO_AF1,
79 .bus = APB2,
80 .irqn = USART1_IRQn
81 }
82};
83
84#define UART_0_ISR (isr_usart1)
85
86#define UART_NUMOF ARRAY_SIZE(uart_config)
93static const pwm_conf_t pwm_config[] = {
94 {
95 .dev = TIM3,
96 .rcc_mask = RCC_APB1ENR_TIM3EN,
97 .chan = { { .pin = GPIO_PIN(PORT_A, 6), .cc_chan = 0},
98 { .pin = GPIO_PIN(PORT_A, 7), .cc_chan = 1},
99 { .pin = GPIO_UNDEF, .cc_chan = 0},
100 { .pin = GPIO_UNDEF, .cc_chan = 0} },
101 .af = GPIO_AF1,
102 .bus = APB1
103 }
104};
105
106#define PWM_NUMOF ARRAY_SIZE(pwm_config)
113static const spi_conf_t spi_config[] = {
114 {
115 .dev = SPI1,
116 .mosi_pin = GPIO_PIN(PORT_A, 7),
117 .miso_pin = GPIO_PIN(PORT_A, 6),
118 .sclk_pin = GPIO_PIN(PORT_A, 5),
119 .cs_pin = GPIO_PIN(PORT_B, 1),
120 .mosi_af = GPIO_AF0,
121 .miso_af = GPIO_AF0,
122 .sclk_af = GPIO_AF0,
123 .cs_af = GPIO_AF0,
124 .rccmask = RCC_APB2ENR_SPI1EN,
125 .apbbus = APB2
126 },
127};
128
129#define SPI_NUMOF ARRAY_SIZE(spi_config)
136static const adc_conf_t adc_config[] = {
137 { GPIO_PIN(PORT_A, 0), 0 },
138 { GPIO_PIN(PORT_A, 1), 1 },
139 { GPIO_PIN(PORT_A, 2), 2 },
140 { GPIO_PIN(PORT_A, 3), 3 },
141 { GPIO_PIN(PORT_A, 4), 4 },
142 { GPIO_PIN(PORT_A, 5), 5 }
143};
144
145#define ADC_NUMOF ARRAY_SIZE(adc_config)
148#ifdef __cplusplus
149}
150#endif
151
152#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
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:102
@ APB1
Advanced Peripheral Bus 1
Definition periph_cpu.h:79
@ APB2
Advanced Peripheral Bus 2
Definition periph_cpu.h:80
ADC device configuration.
Definition periph_cpu.h:379
PWM device configuration.
mini_timer_t * dev
Timer used.
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