Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Inria
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
24/* Add specific clock configuration (HSE, LSE) for this board here */
25#ifndef CONFIG_BOARD_HAS_LSE
26#define CONFIG_BOARD_HAS_LSE 1
27#endif
28
29#include "clk_conf.h"
30#include "cfg_i2c1_pb8_pb9.h"
31#include "cfg_rtt_default.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif
36
41static const timer_conf_t timer_config[] = {
42 {
43 .dev = TIM3,
44 .max = 0x0000ffff,
45 .rcc_mask = RCC_APBENR1_TIM3EN,
46 .bus = APB1,
47 .irqn = TIM3_IRQn
48 }
49};
50
51#define TIMER_0_ISR isr_tim3
52
53#define TIMER_NUMOF ARRAY_SIZE(timer_config)
60static const uart_conf_t uart_config[] = {
61 {
62 .dev = USART2,
63 .rcc_mask = RCC_APBENR1_USART2EN,
64 .rx_pin = GPIO_PIN(PORT_A, 3),
65 .tx_pin = GPIO_PIN(PORT_A, 2),
66 .rx_af = GPIO_AF1,
67 .tx_af = GPIO_AF1,
68 .bus = APB1,
69 .irqn = USART2_IRQn,
70 },
71 { /* Arduino pinout on D0/D1 */
72 .dev = USART1,
73 .rcc_mask = RCC_APBENR2_USART1EN,
74 .rx_pin = GPIO_PIN(PORT_C, 5),
75 .tx_pin = GPIO_PIN(PORT_C, 4),
76 .rx_af = GPIO_AF1,
77 .tx_af = GPIO_AF1,
78 .bus = APB12,
79 .irqn = USART1_IRQn,
80 },
81};
82
83#define UART_0_ISR (isr_usart2)
84#define UART_1_ISR (isr_usart1)
85
86#define UART_NUMOF ARRAY_SIZE(uart_config)
116static const adc_conf_t adc_config[] = {
117 { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 }, /* ARD_A0_IN0 */
118 { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 }, /* ARD_A1_IN1 */
119 { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 }, /* ARD_A2_IN4 */
120 { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 }, /* ARD_A3_IN9 */
121 { .pin = GPIO_PIN(PORT_B, 11), .dev = 0, .chan = 15 }, /* ARD_A4_IN15 */
122 { .pin = GPIO_PIN(PORT_B, 12), .dev = 0, .chan = 16 }, /* ARD_A5_IN16 */
123 { .pin = GPIO_UNDEF, .dev = 0, .chan = 14}, /* VBAT */
124};
125
126#define VBAT_ADC ADC_LINE(6)
127#define ADC_NUMOF ARRAY_SIZE(adc_config)
134static const spi_conf_t spi_config[] = {
135 {
136 .dev = SPI1,
137 .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
138 .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
139 .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
140 .cs_pin = GPIO_UNDEF,
141 .mosi_af = GPIO_AF0,
142 .miso_af = GPIO_AF0,
143 .sclk_af = GPIO_AF0,
144 .cs_af = GPIO_AF0,
145 .rccmask = RCC_APBENR2_SPI1EN,
146 .apbbus = APB12,
147 },
148};
149
150#define SPI_NUMOF ARRAY_SIZE(spi_config)
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* PERIPH_CONF_H */
@ PORT_B
port B
Definition periph_cpu.h:48
@ PORT_C
port C
Definition periph_cpu.h:49
@ 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.
static const adc_conf_t adc_config[]
ADC configuration.
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
ADC device configuration.
Definition periph_cpu.h:379
gpio_t pin
pin connected to the channel
Definition periph_cpu.h:288
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