periph_conf.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2024 BISSELL Homecare, Inc.
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
16 #pragma once
17 
18 #include <stdint.h>
19 
20 #include "cpu.h"
21 #include "periph_cpu.h"
22 #include "clk_conf.h"
23 #include "cfg_rtt_default.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
33 static const timer_conf_t timer_config[] = {
34  {
35  .dev = TIM3,
36  .max = 0x0000ffff,
37  .rcc_mask = RCC_APBENR1_TIM3EN,
38  .bus = APB1,
39  .irqn = TIM3_IRQn
40  }
41 };
42 
43 #define TIMER_0_ISR isr_tim3
44 
45 #define TIMER_NUMOF ARRAY_SIZE(timer_config)
46 
47 #define TIMER_0_MAX_VALUE 0x0000FFFFUL /* the STM32C031 doesn't have a 32-bit timer */
54 static const uart_conf_t uart_config[] = {
55  { /* USART is connected to the ST-Link */
56  .dev = USART1,
57  .rcc_mask = RCC_APBENR2_USART1EN,
58  .rx_pin = GPIO_PIN(PORT_B, 7),
59  .tx_pin = GPIO_PIN(PORT_B, 6),
60  .rx_af = GPIO_AF0,
61  .tx_af = GPIO_AF0,
62  .bus = APB12,
63  .irqn = USART1_IRQn,
64  },
65  { /* this USART is connected to the Morpho-Connector */
66  .dev = USART2,
67  .rcc_mask = RCC_APBENR1_USART2EN,
68  .rx_pin = GPIO_PIN(PORT_A, 3),
69  .tx_pin = GPIO_PIN(PORT_A, 2),
70  .rx_af = GPIO_AF1,
71  .tx_af = GPIO_AF1,
72  .bus = APB1,
73  .irqn = USART2_IRQn,
74  },
75 };
76 
77 #define UART_0_ISR (isr_usart1)
78 #define UART_1_ISR (isr_usart2)
79 
80 #define UART_NUMOF ARRAY_SIZE(uart_config)
83 #ifdef __cplusplus
84 }
85 #endif
86 
@ PORT_B
port B
Definition: periph_cpu.h:44
@ 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
static const uart_conf_t uart_config[]
UART configuration.
Definition: periph_conf.h:35
static const timer_conf_t timer_config[]
All timers on board.
Definition: periph_conf.h:36
@ GPIO_AF1
use alternate function 1
Definition: cpu_gpio.h:99
@ GPIO_AF0
use alternate function 0
Definition: cpu_gpio.h:98
@ APB1
Advanced Peripheral Bus 1
Definition: periph_cpu.h:75
Timer device configuration.
Definition: periph_cpu.h:260
TC0_t * dev
Pointer to the used as Timer device.
Definition: periph_cpu.h:261
UART device configuration.
Definition: periph_cpu.h:214
USART_t * dev
pointer to the used UART device
Definition: periph_cpu.h:215