# gpio\_if.h ## **Overview** **Related Modules:** [GPIO](gpio.md) **Description:** Declares the standard GPIO interface functions. **Since:** 1.0 ## **Summary** ## Typedefs

Typedef Name

Description

GpioIrqFunc) (uint16_t gpio, void *data)

typedef int32_t(*

Defines the function type of a GPIO interrupt service routine (ISR).

## Enumerations

Enumeration Name

Description

GpioValue { GPIO_VAL_LOW = 0, GPIO_VAL_HIGH = 1, GPIO_VAL_ERR }

Enumerates GPIO level values.

GpioDirType { GPIO_DIR_IN = 0, GPIO_DIR_OUT = 1, GPIO_DIR_ERR }

Enumerates GPIO directions.

## Functions

Function Name

Description

GpioRead (uint16_t gpio, uint16_t *val)

int32_t

Reads the level value of a GPIO pin.

GpioWrite (uint16_t gpio, uint16_t val)

int32_t

Writes the level value for a GPIO pin.

GpioSetDir (uint16_t gpio, uint16_t dir)

int32_t

Sets the input/output direction for a GPIO pin.

GpioGetDir (uint16_t gpio, uint16_t *dir)

int32_t

Obtains the input/output direction of a GPIO pin.

GpioSetIrq (uint16_t gpio, uint16_t mode, GpioIrqFunc func, void *arg)

int32_t

Sets the ISR function for a GPIO pin.

GpioUnSetIrq (uint16_t gpio)

int32_t

Cancels the setting of the ISR function for a GPIO pin.

GpioEnableIrq (uint16_t gpio)

int32_t

Enables a GPIO pin interrupt.

GpioDisableIrq (uint16_t gpio)

int32_t

Disables a GPIO pin interrupt.