Skip to content

Class GpioHAL

ClassList > GpioHAL

Public Functions

Type Name
void configurePin (uint8_t pin, gpio_flags_t flags)
Configure an I/O pin. This must be done prior to accessing any other function from this API on the pin.
uint8_t readPin (uint8_t pin)
Get the current value of a pin configured as input.
void resetPin (uint8_t pin)
Reset the value of a pin configured as output to 0.
void setPin (uint8_t pin)
Set the value of a pin configured as output to 1.
void togglePin (uint8_t pin)
Toggle the value of a pin configured as output:
void writePin (uint8_t pin, uint8_t value)
Set the value of a pin configured as output to a given value.

Public Functions Documentation

function configurePin

Configure an I/O pin. This must be done prior to accessing any other function from this API on the pin.

void GpioHAL::configurePin (
    uint8_t pin,
    gpio_flags_t flags
) 

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.
  • flags Pin configuration flags. Authorized values:
  • INPUT
  • INPUT_PULLUP
  • OUTPUT

function readPin

Get the current value of a pin configured as input.

uint8_t GpioHAL::readPin (
    uint8_t pin
) 

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.

Returns:

Current value (0 or 1) of the pin.


function resetPin

Reset the value of a pin configured as output to 0.

void GpioHAL::resetPin (
    uint8_t pin
) 

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.

function setPin

Set the value of a pin configured as output to 1.

void GpioHAL::setPin (
    uint8_t pin
) 

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.

function togglePin

Toggle the value of a pin configured as output:

void GpioHAL::togglePin (
    uint8_t pin
) 

  • if pin value is 1, it will be set to 0
  • if pin value is 0, it will be set to 1.

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.

function writePin

Set the value of a pin configured as output to a given value.

void GpioHAL::writePin (
    uint8_t pin,
    uint8_t value
) 

Parameters:

  • pin Number of the Spin pin OR STM32-style name of the pin, e.g. PA1, PB10, etc. See pin_t type for the full list of available STM32-style pins on Spin board.
  • value Value (0 or 1) to assign to the pin.


The documentation for this class was generated from the following file docs/core/zephyr/modules/owntech_spin_api/zephyr/src/GpioHAL.h