FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_gpio.h File Reference

This file contains all the GPIO HAL API definitions. This GPIO interface APIs only provides pin-level functions. To modify a GPIO pin, a handle must be obtained by calling the iot_gpio_open() function. This handle must be passed to other functions in this interface. Handling multiple GPIOs simultaneously in the same bank or different banks is outside of the scope of this file. User can modify multiple pins sequentially using this interface by iterating over multiple GPIOs in a loop. More...

Go to the source code of this file.

Macros

#define IOT_GPIO_SUCCESS   ( 0 )
 Error codes. More...
 
#define IOT_GPIO_INVALID_VALUE   ( 1 )
 
#define IOT_GPIO_READ_FAILED   ( 2 )
 
#define IOT_GPIO_WRITE_FAILED   ( 3 )
 
#define IOT_GPIO_FUNCTION_NOT_SUPPORTED   ( 4 )
 

Typedefs

typedef struct IotGpioDescriptor * IotGpioHandle_t
 IotGpioHandle_t type is the GPIO handle returned by calling iot_gpio_open() this is initialized in open and returned to caller. Caller must pass this pointer to the rest of the APIs.
 
typedef void(* IotGpioCallback_t) (uint8_t ucPinState, void *pvUserContext)
 GPIO interrupt callback type. This callback is passed to the driver by using iot_gpio_set_callback API. More...
 

Enumerations

enum  IotGpioDirection_t { eGpioDirectionInput, eGpioDirectionOutput }
 enum for configuring GPIO input/output direction. More...
 
enum  IotGpioOutputMode_t { eGpioOpenDrain, eGpioPushPull }
 enum for configuring GPIO output type. More...
 
enum  IotGpioPull_t { eGpioPullNone, eGpioPullUp, eGpioPullDown }
 GPIO pin internal pull state. Sets the default state for output pins. More...
 
enum  IotGpioInterrupt_t {
  eGpioInterruptNone, eGpioInterruptRising, eGpioInterruptFalling, eGpioInterruptEdge,
  eGpioInterruptLow, eGpioInterruptHigh
}
 GPIO pin interrupt config types. More...
 
enum  IotGpioIoctlRequest_t {
  eSetGpioFunction, eSetGpioDirection, eSetGpioPull, eSetGpioOutputMode,
  eSetGpioInterrupt, eSetGpioSpeed, eSetGpioDriveStrength, eGetGpioFunction,
  eGetGpioDirection, eGetGpioPull, eGetGpioOutputType, eGetGpioInterrupt,
  eGetGpioSpeed, eGetGpioDriveStrength
}
 Ioctl request types. More...
 

Functions

IotGpioHandle_t iot_gpio_open (int32_t lGpioNumber)
 iot_gpio_open is used to open the GPIO handle. The application must call this function to open desired GPIO and use other functions. More...
 
void iot_gpio_set_callback (IotGpioHandle_t const pxGpio, IotGpioCallback_t xGpioCallback, void *pvUserContext)
 iot_gpio_set_callback is used to set the callback to be called when an interrupt is tirggered. More...
 
int32_t iot_gpio_read_sync (IotGpioHandle_t const pxGpio, uint8_t *pucPinState)
 iot_gpio_read_sync is used to read data from GPIO pin in blocking mode. More...
 
int32_t iot_gpio_write_sync (IotGpioHandle_t const pxGpio, uint8_t ucPinState)
 iot_gpio_write_sync is used to write data into the GPIO pin in blocking mode. More...
 
int32_t iot_gpio_close (IotGpioHandle_t const pxGpio)
 iot_gpio_close is used to deinitializes the GPIO pin to default value and close the handle. The application should call this function to reset and deinitialize the GPIO pin. More...
 
int32_t iot_gpio_ioctl (IotGpioHandle_t const pxGpio, IotGpioIoctlRequest_t xRequest, void *const pvBuffer)
 iot_gpio_ioctl is used to configure GPIO pin options. The application should call this function to configure various GPIO pin options: pin function, I/O direction, pin internal pull mode, drive strength, slew rate etc More...
 

Detailed Description

This file contains all the GPIO HAL API definitions. This GPIO interface APIs only provides pin-level functions. To modify a GPIO pin, a handle must be obtained by calling the iot_gpio_open() function. This handle must be passed to other functions in this interface. Handling multiple GPIOs simultaneously in the same bank or different banks is outside of the scope of this file. User can modify multiple pins sequentially using this interface by iterating over multiple GPIOs in a loop.