Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
ch32h41x-pinctrl.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Liu Changjie
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef __CH32H41X_PINCTRL_H__
8#define __CH32H41X_PINCTRL_H__
9
15
32
34#define CH32H41X_PINMUX_PORT_PA 0
36#define CH32H41X_PINMUX_PORT_PB 1
38#define CH32H41X_PINMUX_PORT_PC 2
40#define CH32H41X_PINMUX_PORT_PD 3
42#define CH32H41X_PINMUX_PORT_PE 4
44#define CH32H41X_PINMUX_PORT_PF 5
45
47#define CH32H41X_PINMUX_PORT_MASK 0x007
49#define CH32H41X_PINMUX_PIN_MASK 0x078
51#define CH32H41X_PINMUX_AF_MASK 0x780
52
60#define CH32H41X_PINMUX(port, pin, af) ((CH32H41X_PINMUX_PORT_##port) | ((pin) << 3) | ((af) << 7))
61
62/* USART1: AF7 */
64#define USART1_TX_PA9_AF7 CH32H41X_PINMUX(PA, 9, 7)
66#define USART1_RX_PA10_AF7 CH32H41X_PINMUX(PA, 10, 7)
67
68/* USART8: AF11 */
70#define USART8_TX_PB4_AF11 CH32H41X_PINMUX(PB, 4, 11)
71
73
74#endif /* __CH32H41X_PINCTRL_H__ */