|
Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
|
Macros for pin control configuration of WCH CH32H41x. More...
Files | |
| file | ch32h41x-pinctrl.h |
| Devicetree pin control helpers for WCH CH32H41x. | |
Macros | |
| #define | CH32H41X_PINMUX_PORT_PA 0 |
| Port PA selector. | |
| #define | CH32H41X_PINMUX_PORT_PB 1 |
| Port PB selector. | |
| #define | CH32H41X_PINMUX_PORT_PC 2 |
| Port PC selector. | |
| #define | CH32H41X_PINMUX_PORT_PD 3 |
| Port PD selector. | |
| #define | CH32H41X_PINMUX_PORT_PE 4 |
| Port PE selector. | |
| #define | CH32H41X_PINMUX_PORT_PF 5 |
| Port PF selector. | |
| #define | CH32H41X_PINMUX_PORT_MASK 0x007 |
| Mask for the port field of the pinmux cell. | |
| #define | CH32H41X_PINMUX_PIN_MASK 0x078 |
| Mask for the pin field of the pinmux cell. | |
| #define | CH32H41X_PINMUX_AF_MASK 0x780 |
| Mask for the alternate-function field of the pinmux cell. | |
| #define | CH32H41X_PINMUX(port, pin, af) |
| Encode a port, pin and alternate function into a pinmux cell. | |
| #define | USART1_TX_PA9_AF7 CH32H41X_PINMUX(PA, 9, 7) |
| USART1 TX on PA9 (AF7). | |
| #define | USART1_RX_PA10_AF7 CH32H41X_PINMUX(PA, 10, 7) |
| USART1 RX on PA10 (AF7). | |
| #define | USART8_TX_PB4_AF11 CH32H41X_PINMUX(PB, 4, 11) |
| USART8 TX on PB4 (AF11). | |
Macros for pin control configuration of WCH CH32H41x.
The CH32H41x uses an STM32-style per-pin alternate-function mux: each GPIO pin has a 4-bit AF selector in the AFIO GPIOx_AFLR/AFHR registers, rather than the CH32V20x/30x AFIO remap (PCFR) model.
Encoding (packed into the pinmux cell):
| #define CH32H41X_PINMUX | ( | port, | |
| pin, | |||
| af ) |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Encode a port, pin and alternate function into a pinmux cell.
| port | Port name (PA, PB, ...) |
| pin | Pin number (0..15) |
| af | Alternate function (0..15) |
| #define CH32H41X_PINMUX_AF_MASK 0x780 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Mask for the alternate-function field of the pinmux cell.
| #define CH32H41X_PINMUX_PIN_MASK 0x078 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Mask for the pin field of the pinmux cell.
| #define CH32H41X_PINMUX_PORT_MASK 0x007 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Mask for the port field of the pinmux cell.
| #define CH32H41X_PINMUX_PORT_PA 0 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PA selector.
| #define CH32H41X_PINMUX_PORT_PB 1 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PB selector.
| #define CH32H41X_PINMUX_PORT_PC 2 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PC selector.
| #define CH32H41X_PINMUX_PORT_PD 3 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PD selector.
| #define CH32H41X_PINMUX_PORT_PE 4 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PE selector.
| #define CH32H41X_PINMUX_PORT_PF 5 |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
Port PF selector.
| #define USART1_RX_PA10_AF7 CH32H41X_PINMUX(PA, 10, 7) |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
USART1 RX on PA10 (AF7).
| #define USART1_TX_PA9_AF7 CH32H41X_PINMUX(PA, 9, 7) |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
USART1 TX on PA9 (AF7).
| #define USART8_TX_PB4_AF11 CH32H41X_PINMUX(PB, 4, 11) |
#include <zephyr/dt-bindings/pinctrl/ch32h41x-pinctrl.h>
USART8 TX on PB4 (AF11).