PebbleOS v4.47.0-635-gd62d3c7d4
Loading...
Searching...
No Matches
STM32 pin controller

Pin control controller of the STM32 GPIO ports. More...

Data Structures

struct  pbl_pinctrl_stm32
 STM32 pin controller. More...
 

Macros

#define PBL_PINCTRL_STM32_PINMUX(cell)   ((uint32_t)(cell))
 A pinmux cell, the pin number and mode of STM32_PINMUX().
 
#define PBL_PINCTRL_STM32_NUM_PORTS   11U
 Number of GPIO ports of the controller, A to K.
 
#define STM32_PINCTRL   (&pbl_pinctrl_stm32)
 Pin controller.
 
#define PBL_PINCTRL_STM32_DEFINE(sym, _name, _base, ...)
 Define the pin controller.
 

Pin options

#define PBL_PINCTRL_STM32_NO_PULL   0U
 No pull.
 
#define PBL_PINCTRL_STM32_PULL_UP   (1U << 16)
 Pull-up.
 
#define PBL_PINCTRL_STM32_PULL_DOWN   (2U << 16)
 Pull-down.
 
#define PBL_PINCTRL_STM32_PUSH_PULL   0U
 Push-pull output.
 
#define PBL_PINCTRL_STM32_OPEN_DRAIN   PBL_PINCTRL_STM32_OD
 Open-drain output.
 
#define PBL_PINCTRL_STM32_SPEED(n)   ((uint32_t)(n) << 21)
 Output speed, 0 (low) to 3 (very high).
 

Detailed Description

Pin control controller of the STM32 GPIO ports.

A pin is a pinmux cell of the upstream binding, STM32_PINMUX(port, line, mode), or'ed with its options. Every option is written when the pin is configured, so a pin without any gets no pull, a push-pull output and the lowest speed. The controller ungates the clock of a port the first time it configures one of its pins:

#define PBL_PINCTRL_STM32_PINMUX(cell)
A pinmux cell, the pin number and mode of STM32_PINMUX().
Definition stm32.h:40
#define PBL_PINCTRL_STM32_PULL_UP
Pull-up.
Definition stm32.h:49
#define STM32_PINCTRL
Pin controller.
Definition stm32.h:79
#define PBL_PINCTRL_STATE_DEFINE(sym, _ctrl,...)
Define a pin state.
Definition pinctrl.h:98
#define AF7
Definition stm32-pinfunc.h:16
#define STM32_PINMUX(port, line, mode)
Definition stm32-pinfunc.h:30

Data Structure Documentation

◆ pbl_pinctrl_stm32

struct pbl_pinctrl_stm32

STM32 pin controller.

Data Fields
uintptr_t base Registers of port A, the others following at 1 KiB steps.
struct pbl_clk clks[PBL_PINCTRL_STM32_NUM_PORTS] Clocks of the ports.
struct pbl_pinctrl_controller ctrl Pin controller.

Macro Definition Documentation

◆ PBL_PINCTRL_STM32_DEFINE

#define PBL_PINCTRL_STM32_DEFINE (   sym,
  _name,
  _base,
  ... 
)
Value:
PBL_DEVICE_INSTANCE(sym, struct pbl_pinctrl_stm32, struct pbl_pinctrl_controller, ctrl) { \
.ctrl = PBL_PINCTRL_CONTROLLER_INIT(sym, _name, nullptr, &pbl_pinctrl_stm32_ops, \
.base = (_base), .clks = {__VA_ARGS__}, \
}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
STM32 pin controller.
Definition stm32.h:64
#define PBL_PINCTRL_STM32_NUM_PORTS
Number of GPIO ports of the controller, A to K.
Definition stm32.h:61
A pin controller.
Definition pinctrl.h:55
#define PBL_PINCTRL_CONTROLLER_INIT(sym, _name, _parent, _ops, _num_pads)
Initializer for the struct pbl_pinctrl_controller of controller sym.
Definition pinctrl.h:74

Define the pin controller.

Parameters
symSymbol of the controller.
_nameName.
_baseRegisters of port A.
...Clocks of ports A to K, from PBL_CLK().

◆ PBL_PINCTRL_STM32_NO_PULL

#define PBL_PINCTRL_STM32_NO_PULL   0U

No pull.

◆ PBL_PINCTRL_STM32_NUM_PORTS

#define PBL_PINCTRL_STM32_NUM_PORTS   11U

Number of GPIO ports of the controller, A to K.

◆ PBL_PINCTRL_STM32_OPEN_DRAIN

#define PBL_PINCTRL_STM32_OPEN_DRAIN   PBL_PINCTRL_STM32_OD

Open-drain output.

◆ PBL_PINCTRL_STM32_PINMUX

#define PBL_PINCTRL_STM32_PINMUX (   cell)    ((uint32_t)(cell))

A pinmux cell, the pin number and mode of STM32_PINMUX().

◆ PBL_PINCTRL_STM32_PULL_DOWN

#define PBL_PINCTRL_STM32_PULL_DOWN   (2U << 16)

Pull-down.

◆ PBL_PINCTRL_STM32_PULL_UP

#define PBL_PINCTRL_STM32_PULL_UP   (1U << 16)

Pull-up.

◆ PBL_PINCTRL_STM32_PUSH_PULL

#define PBL_PINCTRL_STM32_PUSH_PULL   0U

Push-pull output.

◆ PBL_PINCTRL_STM32_SPEED

#define PBL_PINCTRL_STM32_SPEED (   n)    ((uint32_t)(n) << 21)

Output speed, 0 (low) to 3 (very high).

◆ STM32_PINCTRL

#define STM32_PINCTRL   (&pbl_pinctrl_stm32)

Pin controller.