PER Firmware
Loading...
Searching...
No Matches
gpio_priv.c File Reference

G4 GPIO private/register level implementation. More...

Include dependency graph for gpio_priv.c:

Functions

static uint32_t gpio_mode_bits (PHAL_GPIO_PinType_t type)
 Get the bit pattern for a pin's MODER field from its type.
 
static uint32_t gpio_speed_bits (PHAL_GPIO_OutputSpeed_t speed)
 Get the bit pattern for a pin's OSPEEDR field from its speed.
 
static uint32_t gpio_otype_bits (PHAL_GPIO_OutputPull_t otype)
 Get the bit pattern for a pin's OTYPER field from its output type.
 
static uint32_t gpio_pull_bits (PHAL_GPIO_InputPull_t pull)
 Get the bit pattern for a pin's PUPDR field from its pull selection.
 
bool PHAL_GPIO_priv_enableClock (GPIO_TypeDef *bank)
 Enable the AHB2 clock for bank's port (GPIOA-GPIOG).
 
void PHAL_GPIO_priv_setMode (GPIO_TypeDef *bank, uint8_t pin, PHAL_GPIO_PinType_t type)
 Set MODER's field for pin to type. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_setOutputSpeed (GPIO_TypeDef *bank, uint8_t pin, PHAL_GPIO_OutputSpeed_t speed)
 Set OSPEEDR's field for pin. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_setOutputType (GPIO_TypeDef *bank, uint8_t pin, PHAL_GPIO_OutputPull_t otype)
 Set OTYPER's field for pin. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_setPull (GPIO_TypeDef *bank, uint8_t pin, PHAL_GPIO_InputPull_t pull)
 Set PUPDR's field for pin. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_setAltFunction (GPIO_TypeDef *bank, uint8_t pin, uint8_t af_num)
 Set AFR's field for pin. Caller must have validated pin <= 15.
 
bool PHAL_GPIO_priv_read (const GPIO_TypeDef *bank, uint8_t pin)
 Read IDR's bit for pin. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_write (GPIO_TypeDef *bank, uint8_t pin, bool value)
 Write BSRR to atomically set/reset pin. Caller must have validated pin <= 15.
 
void PHAL_GPIO_priv_toggle (GPIO_TypeDef *bank, uint8_t pin)
 Read then invert pin via BSRR. Caller must have validated pin <= 15.
 

Detailed Description

G4 GPIO private/register level implementation.

Author
Millan Kumar (kumar.nosp@m.798@.nosp@m.purdu.nosp@m.e.ed.nosp@m.u)

Function Documentation

◆ gpio_mode_bits()

static uint32_t gpio_mode_bits ( PHAL_GPIO_PinType_t type)
static

Get the bit pattern for a pin's MODER field from its type.

Here is the caller graph for this function:

◆ gpio_otype_bits()

static uint32_t gpio_otype_bits ( PHAL_GPIO_OutputPull_t otype)
static

Get the bit pattern for a pin's OTYPER field from its output type.

Here is the caller graph for this function:

◆ gpio_pull_bits()

static uint32_t gpio_pull_bits ( PHAL_GPIO_InputPull_t pull)
static

Get the bit pattern for a pin's PUPDR field from its pull selection.

Here is the caller graph for this function:

◆ gpio_speed_bits()

static uint32_t gpio_speed_bits ( PHAL_GPIO_OutputSpeed_t speed)
static

Get the bit pattern for a pin's OSPEEDR field from its speed.

Here is the caller graph for this function:

◆ PHAL_GPIO_priv_enableClock()

bool PHAL_GPIO_priv_enableClock ( GPIO_TypeDef * bank)

Enable the AHB2 clock for bank's port (GPIOA-GPIOG).

Returns
true on success; false if bank is not a recognized GPIO port
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_read()

bool PHAL_GPIO_priv_read ( const GPIO_TypeDef * bank,
uint8_t pin )

Read IDR's bit for pin. Caller must have validated pin <= 15.

Here is the caller graph for this function:

◆ PHAL_GPIO_priv_setAltFunction()

void PHAL_GPIO_priv_setAltFunction ( GPIO_TypeDef * bank,
uint8_t pin,
uint8_t af_num )

Set AFR's field for pin. Caller must have validated pin <= 15.

Here is the caller graph for this function:

◆ PHAL_GPIO_priv_setMode()

void PHAL_GPIO_priv_setMode ( GPIO_TypeDef * bank,
uint8_t pin,
PHAL_GPIO_PinType_t type )

Set MODER's field for pin to type. Caller must have validated pin <= 15.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_setOutputSpeed()

void PHAL_GPIO_priv_setOutputSpeed ( GPIO_TypeDef * bank,
uint8_t pin,
PHAL_GPIO_OutputSpeed_t speed )

Set OSPEEDR's field for pin. Caller must have validated pin <= 15.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_setOutputType()

void PHAL_GPIO_priv_setOutputType ( GPIO_TypeDef * bank,
uint8_t pin,
PHAL_GPIO_OutputPull_t otype )

Set OTYPER's field for pin. Caller must have validated pin <= 15.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_setPull()

void PHAL_GPIO_priv_setPull ( GPIO_TypeDef * bank,
uint8_t pin,
PHAL_GPIO_InputPull_t pull )

Set PUPDR's field for pin. Caller must have validated pin <= 15.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_toggle()

void PHAL_GPIO_priv_toggle ( GPIO_TypeDef * bank,
uint8_t pin )

Read then invert pin via BSRR. Caller must have validated pin <= 15.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PHAL_GPIO_priv_write()

void PHAL_GPIO_priv_write ( GPIO_TypeDef * bank,
uint8_t pin,
bool value )

Write BSRR to atomically set/reset pin. Caller must have validated pin <= 15.

Here is the caller graph for this function: