Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Inria
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18#include "periph_cpu.h"
19
20/* Add specific clock configuration (HSE, LSE) for this board here */
21#ifndef CONFIG_BOARD_HAS_LSE
22#define CONFIG_BOARD_HAS_LSE 1
23#endif
24
25#include "clk_conf.h"
26#include "cfg_i2c1_pb8_pb9.h"
27#include "cfg_rtt_default.h"
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
37static const timer_conf_t timer_config[] = {
38 {
39 .dev = TIM3,
40 .max = 0x0000ffff,
41 .rcc_mask = RCC_APBENR1_TIM3EN,
42 .bus = APB1,
43 .irqn = TIM3_IRQn
44 }
45};
46
47#define TIMER_0_ISR isr_tim3
48
49#define TIMER_NUMOF ARRAY_SIZE(timer_config)
51
56static const uart_conf_t uart_config[] = {
57 {
58 .dev = USART2,
59 .rcc_mask = RCC_APBENR1_USART2EN,
60 .rx_pin = GPIO_PIN(PORT_A, 3),
61 .tx_pin = GPIO_PIN(PORT_A, 2),
62 .rx_af = GPIO_AF1,
63 .tx_af = GPIO_AF1,
64 .bus = APB1,
65 .irqn = USART2_IRQn,
66 },
67 { /* Arduino pinout on D0/D1 */
68 .dev = USART1,
69 .rcc_mask = RCC_APBENR2_USART1EN,
70 .rx_pin = GPIO_PIN(PORT_C, 5),
71 .tx_pin = GPIO_PIN(PORT_C, 4),
72 .rx_af = GPIO_AF1,
73 .tx_af = GPIO_AF1,
74 .bus = APB12,
75 .irqn = USART1_IRQn,
76 },
77};
78
79#define UART_0_ISR (isr_usart2)
80#define UART_1_ISR (isr_usart1)
81
82#define UART_NUMOF ARRAY_SIZE(uart_config)
84
112static const adc_conf_t adc_config[] = {
113 { .pin = GPIO_PIN(PORT_A, 0), .dev = 0, .chan = 0 }, /* ARD_A0_IN0 */
114 { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 }, /* ARD_A1_IN1 */
115 { .pin = GPIO_PIN(PORT_A, 4), .dev = 0, .chan = 4 }, /* ARD_A2_IN4 */
116 { .pin = GPIO_PIN(PORT_B, 1), .dev = 0, .chan = 9 }, /* ARD_A3_IN9 */
117 { .pin = GPIO_PIN(PORT_B, 11), .dev = 0, .chan = 15 }, /* ARD_A4_IN15 */
118 { .pin = GPIO_PIN(PORT_B, 12), .dev = 0, .chan = 16 }, /* ARD_A5_IN16 */
119 { .pin = GPIO_UNDEF, .dev = 0, .chan = 14}, /* VBAT */
120};
121
122#define VBAT_ADC ADC_LINE(6)
123#define ADC_NUMOF ARRAY_SIZE(adc_config)
125
130static const spi_conf_t spi_config[] = {
131 {
132 .dev = SPI1,
133 .mosi_pin = GPIO_PIN(PORT_A, 7), /* Arduino D11 */
134 .miso_pin = GPIO_PIN(PORT_A, 6), /* Arduino D12 */
135 .sclk_pin = GPIO_PIN(PORT_A, 5), /* Arduino D13 */
136 .cs_pin = GPIO_UNDEF,
137 .mosi_af = GPIO_AF0,
138 .miso_af = GPIO_AF0,
139 .sclk_af = GPIO_AF0,
140 .cs_af = GPIO_AF0,
141 .rccmask = RCC_APBENR2_SPI1EN,
142 .apbbus = APB12,
143 },
144};
145
146#define SPI_NUMOF ARRAY_SIZE(spi_config)
148
149#ifdef __cplusplus
150}
151#endif
152
@ PORT_B
port B
Definition periph_cpu.h:44
@ PORT_C
port C
Definition periph_cpu.h:45
@ PORT_A
port A
Definition periph_cpu.h:43
#define GPIO_PIN(x, y)
Define a CPU specific GPIO pin generator macro.
Definition periph_cpu.h:42
#define GPIO_UNDEF
Definition of a fitting UNDEF value.
Common configuration for STM32 I2C.
@ GPIO_AF1
use alternate function 1
Definition cpu_gpio.h:102
@ GPIO_AF0
use alternate function 0
Definition cpu_gpio.h:101
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
ADC device configuration.
Definition periph_cpu.h:374
SPI device configuration.
Definition periph_cpu.h:333
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214