Loading...
Searching...
No Matches
periph_conf.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Koen Zandberg <koen@bergzand.net>
3 * SPDX-FileCopyrightText: 2023 Gunar Schorcht <gunar@schorcht.net>
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
19
20#include "macros/units.h"
21
22#ifndef CONFIG_BOARD_HAS_HXTAL
23#define CONFIG_BOARD_HAS_HXTAL 1
24#endif
25
26#ifndef CONFIG_BOARD_HAS_LXTAL
27#define CONFIG_BOARD_HAS_LXTAL 1
28#endif
29
30#ifndef CONFIG_CLOCK_HXTAL
31#define CONFIG_CLOCK_HXTAL MHZ(8)
32#endif
33
34#ifndef SPI_DEV_1_USED
35#define SPI_DEV_1_USED 1
36#endif
37
38#ifndef I2C_DEV_1_USED
39#define I2C_DEV_1_USED 1
40#endif
41
42#include "periph_cpu.h"
43#include "periph_common_conf.h"
44
45#include "cfg_i2c_default.h"
46#include "cfg_spi_default.h"
47#include "cfg_timer_default.h"
48#include "cfg_uart_default.h"
49#include "cfg_usbdev_default.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
59static const adc_conf_t adc_config[] = {
60 { .pin = GPIO_PIN(PORT_A, 1), .dev = 0, .chan = 1 },
61 { .pin = GPIO_PIN(PORT_A, 2), .dev = 0, .chan = 2 },
62 { .pin = GPIO_PIN(PORT_A, 3), .dev = 0, .chan = 3 },
63 { .pin = GPIO_PIN(PORT_C, 0), .dev = 0, .chan = 10 },
64 { .pin = GPIO_PIN(PORT_C, 1), .dev = 0, .chan = 11 },
65 { .pin = GPIO_PIN(PORT_C, 2), .dev = 0, .chan = 12 },
66 { .pin = GPIO_PIN(PORT_C, 3), .dev = 0, .chan = 13 },
67 { .pin = GPIO_PIN(PORT_C, 4), .dev = 0, .chan = 14 },
68 { .pin = GPIO_PIN(PORT_C, 5), .dev = 0, .chan = 15 },
69 /* ADC Temperature channel */
70 { .pin = GPIO_UNDEF, .dev = 0, .chan = 16 },
71 /* ADC VREF channel */
72 { .pin = GPIO_UNDEF, .dev = 0, .chan = 17 },
73};
74
75#define ADC_NUMOF ARRAY_SIZE(adc_config)
77
82static const pwm_conf_t pwm_config[] = {
83 {
84 .dev = TIMER2,
85 .rcu_mask = RCU_APB1EN_TIMER2EN_Msk,
86 .chan = {
87 { .pin = GPIO_PIN(PORT_B, 0), .cc_chan = 2 },
88 { .pin = GPIO_PIN(PORT_B, 1), .cc_chan = 3 },
89 /* unused channels have to be defined by GPIO_UNDEF */
90 { .pin = GPIO_UNDEF, .cc_chan = 0 },
91 { .pin = GPIO_UNDEF, .cc_chan = 1 },
92 },
93 .af = GPIO_AF_OUT_PP,
94 .bus = APB1,
95 },
96#if !defined(MODULE_PERIPH_CAN)
97 {
98 .dev = TIMER3,
99 .rcu_mask = RCU_APB1EN_TIMER3EN_Msk,
100 .chan = {
101 { .pin = GPIO_PIN(PORT_B, 8), .cc_chan = 2 },
102 { .pin = GPIO_PIN(PORT_B, 9), .cc_chan = 3 },
103 /* unused channels have to be defined by GPIO_UNDEF */
104 { .pin = GPIO_UNDEF, .cc_chan = 0 },
105 { .pin = GPIO_UNDEF, .cc_chan = 1 },
106 },
107 .af = GPIO_AF_OUT_PP,
108 .bus = APB1,
109 },
110#endif
111};
112
113#define PWM_NUMOF ARRAY_SIZE(pwm_config)
115
116#ifdef __cplusplus
117}
118#endif
119
@ 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.
@ GPIO_AF_OUT_PP
alternate function output - push-pull
Definition periph_cpu.h:166
@ APB1
Advanced Peripheral Bus 1.
Definition periph_cpu.h:78
Common peripheral configuration for GD32VF103 boards.
ADC device configuration.
Definition periph_cpu.h:374
PWM device configuration.
Unit helper macros.