Skip to content

Class GpioHAL

ClassList > GpioHAL

More...

  • #include <GpioHAL.h>

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.

Detailed Description

Class definition

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 pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

Parameters:

  • 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 pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

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 pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

function setPin

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

void GpioHAL::setPin (
    uint8_t pin
) 

Parameters:

  • pin Number of pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

function togglePin

Toggle the value of a pin configured as output:

void GpioHAL::togglePin (
    uint8_t pin
) 

Parameters:

  • pin Number of pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

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 pin. Format allowed:

  • the Spin pin number from 1 to 58

  • STM32-style pin name from PA1 to PA15, PB1 to PB15, PC1 to PC15 and PD1 to PD3

Parameters:

  • 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