Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2026 Technische Universität Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
17
18/* Nucleo board provides 32.768 kHz LSE for RTC (same as other Nucleo-U boards) */
19#ifndef CONFIG_BOARD_HAS_LSE
20# define CONFIG_BOARD_HAS_LSE 1
21#endif
22
23#include "periph_cpu.h"
24#include "clk_conf.h"
25
26#ifdef __cplusplus
27extern "C" {
28#endif
29
36static const timer_conf_t timer_config[] = {
37 {
38 .dev = TIM3,
39 .max = 0xffffffff,
40 .rcc_mask = RCC_APB1ENR1_TIM3EN,
41 .bus = APB1,
42 .irqn = TIM3_IRQn,
43 }
44};
45
46#define TIMER_NUMOF ARRAY_SIZE(timer_config)
47
48#define TIMER_0_ISR isr_tim3
50
55static const uart_conf_t uart_config[] = {
56 {
57 /* ST-Link Virtual COM Port (STDIO, UART_DEV(0)) — USART1 on PA9/PA10 */
58 .dev = USART1,
59 .rcc_mask = RCC_APB2ENR_USART1EN,
60 .rx_pin = GPIO_PIN(PORT_A, 10),
61 .tx_pin = GPIO_PIN(PORT_A, 9),
62 .rx_af = GPIO_AF7,
63 .tx_af = GPIO_AF7,
64 .bus = APB2,
65 .irqn = USART1_IRQn,
66 .type = STM32_USART,
67 .clk_src = 0, /* Use APB clock */
68 },
69 {
70 /* LPUART1 on PA2/PA3 */
71 .dev = LPUART1,
72 .rcc_mask = RCC_APB3ENR_LPUART1EN,
73 .rx_pin = GPIO_PIN(PORT_A, 3),
74 .tx_pin = GPIO_PIN(PORT_A, 2),
75 .rx_af = GPIO_AF8,
76 .tx_af = GPIO_AF8,
77 .bus = APB3,
78 .irqn = LPUART1_IRQn,
79 .type = STM32_LPUART,
80 .clk_src = 0,
81 }
82};
83
84#define UART_0_ISR (isr_usart1)
85#define UART_1_ISR (isr_lpuart1)
86#define UART_NUMOF ARRAY_SIZE(uart_config)
88
89#ifdef __cplusplus
90}
91#endif
92
@ 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
@ GPIO_AF8
use alternate function 8
Definition cpu_gpio.h:107
@ GPIO_AF7
use alternate function 7
Definition cpu_gpio.h:105
@ STM32_LPUART
STM32 Low-power UART (LPUART) module type.
Definition cpu_uart.h:35
@ STM32_USART
STM32 USART module type.
Definition cpu_uart.h:34
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:75
@ APB2
Advanced Peripheral Bus 2.
Definition periph_cpu.h:76
Timer device configuration.
Definition periph_cpu.h:260
UART device configuration.
Definition periph_cpu.h:214