Core
Loading...
Searching...
No Matches
gpio.h File Reference

Core GPIO library. More...

#include "stm32g4xx_hal.h"
#include <stdint.h>
#include <stdbool.h>

Go to the source code of this file.

Functions

void core_GPIO_init (GPIO_TypeDef *port, uint16_t pin, uint16_t dir, uint32_t pull)
 Initialize a GPIO pin.
 
void core_GPIO_digital_write (GPIO_TypeDef *port, uint16_t pin, bool state)
 Set a digital output.
 
bool core_GPIO_digital_read (GPIO_TypeDef *port, uint16_t pin)
 Read a digital input.
 
void core_heartbeat_init (GPIO_TypeDef *port, uint16_t pin)
 Set a particular pin as the heartbeat LED output.
 
void core_GPIO_toggle_heartbeat ()
 Toggle the heartbeat LED output.
 
void core_GPIO_set_heartbeat (bool state)
 Set the state of the heartbeat LED.
 

Detailed Description

Core GPIO library.

This core library component is used to initialize and control GPIO pins.

Function Documentation

◆ core_GPIO_digital_read()

bool core_GPIO_digital_read ( GPIO_TypeDef * port,
uint16_t pin )

Read a digital input.

Parameters
portGPIO port (GPIOx)
pinGPIO pin (GPIO_PIN_x)
Returns
The state of the pin

◆ core_GPIO_digital_write()

void core_GPIO_digital_write ( GPIO_TypeDef * port,
uint16_t pin,
bool state )

Set a digital output.

Parameters
portGPIO port (GPIOx)
pinGPIO pin (GPIO_PIN_x)
stateThe desired setting of the output

◆ core_GPIO_init()

void core_GPIO_init ( GPIO_TypeDef * port,
uint16_t pin,
uint16_t dir,
uint32_t pull )

Initialize a GPIO pin.

Parameters
portPort on which the pin is located (GPIOx)
pinPin number (GPIO_PIN_x)
dirDirection or pin mode (GPIO_MODE_INPUT, GPIO_MODE_OUTPUT_PP, GPIO_MODE_OUTPUT_OD, GPIO_MODE_AF_PP, GPIO_MODE_AF_OD, or GPIO_MODE_ANALOG)
pullPullup/pulldown resistor configuration (GPIO_NOPULL, GPIO_PULLUP, GPIO_PULLDOWN)

◆ core_GPIO_set_heartbeat()

void core_GPIO_set_heartbeat ( bool state)

Set the state of the heartbeat LED.

Parameters
stateThe desired setting of the output

◆ core_heartbeat_init()

void core_heartbeat_init ( GPIO_TypeDef * port,
uint16_t pin )

Set a particular pin as the heartbeat LED output.

Parameters
portGPIO port (GPIOx)
pinGPIO pin (GPIO_PIN_x)