Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2016 OTA keys
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
19#ifndef PERIPH_CONF_H
20#define PERIPH_CONF_H
21
22#include "periph_cpu.h"
23#include "clk_conf.h"
24#include "cfg_timer_tim2.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
34static const uart_conf_t uart_config[] = {
35 {
36 .dev = USART2,
37 .rcc_mask = RCC_APB1ENR_USART2EN,
38 .rx_pin = GPIO_PIN(PORT_A, 15),
39 .tx_pin = GPIO_PIN(PORT_A, 2),
40 .rx_af = GPIO_AF1,
41 .tx_af = GPIO_AF1,
42 .bus = APB1,
43 .irqn = USART2_IRQn
44 },
45 {
46 .dev = USART1,
47 .rcc_mask = RCC_APB2ENR_USART1EN,
48 .rx_pin = GPIO_PIN(PORT_A, 10),
49 .tx_pin = GPIO_PIN(PORT_A, 9),
50 .rx_af = GPIO_AF1,
51 .tx_af = GPIO_AF1,
52 .bus = APB2,
53 .irqn = USART1_IRQn
54 }
55};
56
57#define UART_0_ISR (isr_usart2)
58#define UART_1_ISR (isr_usart1)
59
60#define UART_NUMOF ARRAY_SIZE(uart_config)
67static const pwm_conf_t pwm_config[] = {
68 {
69 .dev = TIM1,
70 .rcc_mask = RCC_APB2ENR_TIM1EN,
71 .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
72 { .pin = GPIO_UNDEF, .cc_chan = 0 },
73 { .pin = GPIO_UNDEF, .cc_chan = 0 },
74 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
75 .af = GPIO_AF2,
76 .bus = APB2
77 },
78 {
79 .dev = TIM14,
80 .rcc_mask = RCC_APB1ENR_TIM14EN,
81 .chan = { { .pin = GPIO_PIN(PORT_B, 1) /* D6 */, .cc_chan = 0 },
82 { .pin = GPIO_UNDEF, .cc_chan = 0 },
83 { .pin = GPIO_UNDEF, .cc_chan = 0 },
84 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
85 .af = GPIO_AF0,
86 .bus = APB1
87 },
88 {
89 .dev = TIM3,
90 .rcc_mask = RCC_APB1ENR_TIM3EN,
91 .chan = { { .pin = GPIO_PIN(PORT_B, 0) /* D3 */, .cc_chan = 2 },
92 { .pin = GPIO_UNDEF, .cc_chan = 0 },
93 { .pin = GPIO_UNDEF, .cc_chan = 0 },
94 { .pin = GPIO_UNDEF, .cc_chan = 0 }},
95 .af = GPIO_AF1,
96 .bus = APB1
97 }
98};
99
100#define PWM_NUMOF ARRAY_SIZE(pwm_config)
107static const spi_conf_t spi_config[] = {
108 {
109 .dev = SPI1,
110 .mosi_pin = GPIO_PIN(PORT_B, 5),
111 .miso_pin = GPIO_PIN(PORT_B, 4),
112 .sclk_pin = GPIO_PIN(PORT_B, 3),
113 .cs_pin = SPI_CS_UNDEF,
114 .mosi_af = GPIO_AF0,
115 .miso_af = GPIO_AF0,
116 .sclk_af = GPIO_AF0,
117 .cs_af = GPIO_AF0,
118 .rccmask = RCC_APB2ENR_SPI1EN,
119 .apbbus = APB2
120 }
121};
122
123#define SPI_NUMOF ARRAY_SIZE(spi_config)
130static const adc_conf_t adc_config[] = {
131 { GPIO_PIN(PORT_A, 0), 0 },
132 { GPIO_PIN(PORT_A, 1), 1 },
133 { GPIO_PIN(PORT_A, 3), 3 },
134 { GPIO_PIN(PORT_A, 4), 4 },
135 { GPIO_PIN(PORT_A, 7), 7 },
136 { GPIO_UNDEF, 18 }, /* VBAT */
137};
138
139#define VBAT_ADC ADC_LINE(5)
140#define ADC_NUMOF ARRAY_SIZE(adc_config)
143#ifdef __cplusplus
144}
145#endif
146
147#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 Timer peripheral based on TIM2.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:103
@ GPIO_AF2
use alternate function 2
Definition cpu_gpio.h:104
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:102
#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
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
UART device configuration.
Definition periph_cpu.h:218
USART_t * dev
pointer to the used UART device
Definition periph_cpu.h:219