Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017 Inria
3 * 2017 OTA keys
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#include "periph_cpu.h"
24#include "clk_conf.h"
25#include "cfg_timer_tim2.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
35static const uart_conf_t uart_config[] = {
36 {
37 .dev = USART1,
38 .rcc_mask = RCC_APB2ENR_USART1EN,
39 .rx_pin = GPIO_PIN(PORT_A, 15),
40 .tx_pin = GPIO_PIN(PORT_A, 2),
41 .rx_af = GPIO_AF1,
42 .tx_af = GPIO_AF1,
43 .bus = APB2,
44 .irqn = USART1_IRQn
45 }
46};
47
48#define UART_0_ISR (isr_usart1)
49
50#define UART_NUMOF ARRAY_SIZE(uart_config)
57static const pwm_conf_t pwm_config[] = {
58 {
59 .dev = TIM1,
60 .rcc_mask = RCC_APB2ENR_TIM1EN,
61 .chan = { { .pin = GPIO_PIN(PORT_A, 8) /* D9 */, .cc_chan = 0 },
62 { .pin = GPIO_UNDEF, .cc_chan = 0 },
63 { .pin = GPIO_UNDEF, .cc_chan = 0 },
64 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
65 .af = GPIO_AF2,
66 .bus = APB2
67 },
68 {
69 .dev = TIM14,
70 .rcc_mask = RCC_APB1ENR_TIM14EN,
71 .chan = { { .pin = GPIO_PIN(PORT_B, 1) /* D6 */, .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_AF0,
76 .bus = APB1
77 },
78 {
79 .dev = TIM3,
80 .rcc_mask = RCC_APB1ENR_TIM3EN,
81 .chan = { { .pin = GPIO_PIN(PORT_B, 0) /* D3 */, .cc_chan = 2 },
82 { .pin = GPIO_UNDEF, .cc_chan = 0 },
83 { .pin = GPIO_UNDEF, .cc_chan = 0 },
84 { .pin = GPIO_UNDEF, .cc_chan = 0 } },
85 .af = GPIO_AF1,
86 .bus = APB1
87 },
88};
89
90#define PWM_NUMOF ARRAY_SIZE(pwm_config)
97static const spi_conf_t spi_config[] = {
98 {
99 .dev = SPI1,
100 .mosi_pin = GPIO_PIN(PORT_B, 5),
101 .miso_pin = GPIO_PIN(PORT_B, 4),
102 .sclk_pin = GPIO_PIN(PORT_B, 3),
103 .cs_pin = SPI_CS_UNDEF,
104 .mosi_af = GPIO_AF0,
105 .miso_af = GPIO_AF0,
106 .sclk_af = GPIO_AF0,
107 .cs_af = GPIO_AF0,
108 .rccmask = RCC_APB2ENR_SPI1EN,
109 .apbbus = APB2
110 }
111};
112
113#define SPI_NUMOF ARRAY_SIZE(spi_config)
120static const adc_conf_t adc_config[] = {
121 { GPIO_PIN(PORT_A, 0), 0 },
122 { GPIO_PIN(PORT_A, 1), 1 },
123 { GPIO_PIN(PORT_A, 3), 3 },
124 { GPIO_PIN(PORT_A, 4), 4 },
125 { GPIO_PIN(PORT_A, 7), 7 },
126 { GPIO_UNDEF, 18 }, /* VBAT */
127};
128
129#define VBAT_ADC ADC_LINE(5)
130#define ADC_NUMOF ARRAY_SIZE(adc_config)
133#ifdef __cplusplus
134}
135#endif
136
137#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