STM32_UART_BareMetal
gpio.c File Reference
#include "gpio.h"
Include dependency graph for gpio.c:

Functions

void GPIO_SetPinMode (GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t Mode)
 
void GPIO_SetPinAltFun (GPIO_TypeDef *GPIOx, uint32_t Pin, uint32_t AltFun)
 

Function Documentation

◆ GPIO_SetPinAltFun()

void GPIO_SetPinAltFun ( GPIO_TypeDef *  GPIOx,
uint32_t  Pin,
uint32_t  AltFun 
)

Set the alternate function of the pin. There are 2 registers to be addressed. It depends on the pin location and it is valid for each GPIO port.

  • Pins 00-07 are in ARFL
  • Pins 08-16 are in ARFH
    Parameters
    [in]GPIOxGPIO Handler
    [in]Pin[e.g. pin 8 is 0b 0000 0000 0000 0000 0000 0001 0000 0000]
    [in]AltFun[e.g. Alternate Function 9 is 0b 0000 0000 0000 0000 0000 0010 0000 0000]
Here is the caller graph for this function:

◆ GPIO_SetPinMode()

void GPIO_SetPinMode ( GPIO_TypeDef *  GPIOx,
uint32_t  Pin,
uint32_t  Mode 
)

Set the mode of the pin. See GPIOx_MODER.

Parameters
[in]GPIOxGPIO Handler
[in]Pin[e.g. pin 8 is 0b 0000 0000 0000 0000 0000 0001 0000 0000]
[in]Mode[0 - Input, 1 - Output, 2 - Alternate, 3 - Analog]
Here is the caller graph for this function: