# gpio\_if.h - [Overview](#section597261440165627) - [Summary](#section730195322165627) - [Typedefs](#typedef-members) - [Enumerations](#enum-members) - [Functions](#func-members) ## **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.

GpioIrqType { GPIO_IRQ_TRIGGER_NONE = OSAL_IRQF_TRIGGER_NONE, GPIO_IRQ_TRIGGER_RISING = OSAL_IRQF_TRIGGER_RISING, GPIO_IRQ_TRIGGER_FALLING = OSAL_IRQF_TRIGGER_FALLING, GPIO_IRQ_TRIGGER_HIGH = OSAL_IRQF_TRIGGER_HIGH, GPIO_IRQ_TRIGGER_LOW = OSAL_IRQF_TRIGGER_LOW, GPIO_IRQ_USING_THREAD = (0x1 << 8) }

Enumerates GPIO irq types.

## Functions

Function

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.