Skip to content

DEPRECATED-OLD-GPIO

Module: LIBDAISY / PERIPHERAL

Deprecated C API for GPIO is staying in place for a few versions to support backwards compatibility. More...

Classes

Name
struct dsy_gpio

Types

Name
enum dsy_gpio_mode
enum dsy_gpio_pull

Functions

Name
void dsy_gpio_init(const dsy_gpio * p)
void dsy_gpio_deinit(const dsy_gpio * p)
uint8_t dsy_gpio_read(const dsy_gpio * p)
void dsy_gpio_write(const dsy_gpio * p, uint8_t state)
void dsy_gpio_toggle(const dsy_gpio * p)

Detailed Description

Deprecated C API for GPIO is staying in place for a few versions to support backwards compatibility.

Deprecated:

These should only be used for casting to configs, and are planned to be reomved in a future version.

This should not be used for anything new.

Types Documentation

enum dsy_gpio_mode

Enumerator Value Description
DSY_GPIO_MODE_INPUT &
DSY_GPIO_MODE_OUTPUT_PP Push-Pull
DSY_GPIO_MODE_OUTPUT_OD Open-Drain
DSY_GPIO_MODE_ANALOG &
DSY_GPIO_MODE_LAST &

General Purpose IO driver Sets the mode of the GPIO

enum dsy_gpio_pull

Enumerator Value Description
DSY_GPIO_NOPULL &
DSY_GPIO_PULLUP &
DSY_GPIO_PULLDOWN &

Configures whether an internal Pull up or Pull down resistor is used

Functions Documentation

function dsy_gpio_init

void dsy_gpio_init(
    const dsy_gpio * p
)

Parameters:

  • ***p** Pin pointer

Initializes the gpio with the settings configured.

function dsy_gpio_deinit

void dsy_gpio_deinit(
    const dsy_gpio * p
)

Parameters:

  • ***p** Pin pointer

Deinitializes the gpio pin

function dsy_gpio_read

uint8_t dsy_gpio_read(
    const dsy_gpio * p
)

Parameters:

  • ***p** Pin pointer

Return: 1 if the pin is HIGH, and 0 if the pin is LOW

Reads the state of the gpio pin

function dsy_gpio_write

void dsy_gpio_write(
    const dsy_gpio * p,
    uint8_t state
)

Parameters:

  • ***p** Pin pointer
  • state State to write

Writes the state to the gpio pin Pin will be set to 3v3 when state is 1, and 0V when state is 0

function dsy_gpio_toggle

void dsy_gpio_toggle(
    const dsy_gpio * p
)

Parameters:

  • ***p** Pin pointer

Toggles the state of the pin so that it is not at the same state as it was previously.


Updated on 2024-01-03 at 19:41:01 +0000