40 GPIO_TypeDef * gpio_base_reg,
43 uint32_t pin_bit_mask = ((uint32_t)1) << pin;
51 if(LL_GPIO_IsOutputPinSet(gpio_base_reg, pin_bit_mask))
61 gpio->
af = (
px_gpio_af_t)LL_GPIO_GetAFPin_0_7(gpio_base_reg, pin_bit_mask);
65 gpio->
af = (
px_gpio_af_t)LL_GPIO_GetAFPin_8_15(gpio_base_reg, pin_bit_mask);
71 uint32_t pin_bit_mask = ((uint32_t)1) << gpio->
pin;
108 gpio_base_reg->PUPDR = init->
pupdr;
110 gpio_base_reg->OTYPER = init->
otyper;
112 gpio_base_reg->OSPEEDR = init->
ospeedr;
114 gpio_base_reg->ODR = init->
odr;
116 gpio_base_reg->AFR[0] = init->
afrl;
118 gpio_base_reg->AFR[1] = init->
afrh;
120 gpio_base_reg->MODER = init->
moder;
#define PX_LOG_NAME(name)
Macro to declare a log name string once for each file to reduce code size.
uint32_t moder
Mode register value.
uint32_t otyper
Output type register value.
uint32_t afrl
Alternative function low register value.
px_gpio_af_t af
Alternative function: AF0, AF1, ... or AF7.
uint32_t odr
Output data register value.
uint8_t pin
Pin: 0, 1, 2, ..., or 15.
uint32_t ospeedr
Output speed register value.
GPIO_TypeDef * gpio_base_reg
GPIO peripheral base register address.
px_gpio_ospeed_t ospeed
Output speed: low, medium, high or very high.
px_gpio_otype_t otype
Output type: push-pull or open-drain.
uint32_t afrh
Alternative function high register value.
px_gpio_mode_t mode
Mode: Input, Output, Alternative Function or Analog.
px_gpio_out_init_t out_init
Initial output value: Low (0) or high (1)
GPIO_TypeDef * gpio_base_reg
GPIO peripheral base register address.
px_gpio_pull_t pull
None, pull-up or pull-down.
uint32_t pupdr
Pull up / pull-down register value.
px_gpio_mode_t
GPIO mode selection; See GPIOx_MODER register.
void px_gpio_port_init(const px_gpio_port_init_t *init)
Initialise a GPIO port.
px_gpio_otype_t
GPIO output type selection; See GPIOx_OTYPER register.
void px_gpio_open2(px_gpio_handle_t *gpio, GPIO_TypeDef *gpio_base_reg, uint8_t pin)
Open a GPIO handle and initialize with current pin configuration.
px_gpio_pull_t
GPIO pull-up / pull-down selection; See GPIOx_PUPDR register.
px_gpio_ospeed_t
GPIO output speed selection; See GPIOx_OSPEEDR register.
void px_gpio_init(const px_gpio_handle_t *gpio)
Initialise a GPIO pin using supplied handle.
px_gpio_af_t
GPIO alternate function selection; See GPIOx_AFRL and GPIOx_AFRH register.
@ PX_GPIO_OUT_INIT_HI
Initialize output pin to high (1)
@ PX_GPIO_OUT_INIT_LO
Initialize output pin to low (0)
GPIO pin handle definition.
GPIO register values to intialise a port.