FreeRTOS: Common I/O
AWS IoT Common I/O library
Return to main page ↑
iot_gpio.h
Go to the documentation of this file.
1 /*
2  * FreeRTOS Common IO V1.0.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  *
22  * http://aws.amazon.com/freertos
23  * http://www.FreeRTOS.org
24  */
25 
35 #ifndef _IOT_GPIO_H_
36 #define _IOT_GPIO_H_
37 
46 #define IOT_GPIO_SUCCESS ( 0 )
47 #define IOT_GPIO_INVALID_VALUE ( 1 )
48 #define IOT_GPIO_READ_FAILED ( 2 )
49 #define IOT_GPIO_WRITE_FAILED ( 3 )
50 #define IOT_GPIO_FUNCTION_NOT_SUPPORTED ( 4 )
55 typedef enum
56 {
60 
64 typedef enum
65 {
69 
73 typedef enum
74 {
79 
83 typedef enum
84 {
92 
96 typedef enum
97 {
115 
119 struct IotGpioDescriptor;
120 
126 typedef struct IotGpioDescriptor * IotGpioHandle_t;
127 
136 typedef void ( * IotGpioCallback_t )( uint8_t ucPinState,
137  void * pvUserContext );
138 
153 IotGpioHandle_t iot_gpio_open( int32_t lGpioNumber );
154 
169 void iot_gpio_set_callback( IotGpioHandle_t const pxGpio,
170  IotGpioCallback_t xGpioCallback,
171  void * pvUserContext );
172 
185 int32_t iot_gpio_read_sync( IotGpioHandle_t const pxGpio,
186  uint8_t * pucPinState );
187 
199 int32_t iot_gpio_write_sync( IotGpioHandle_t const pxGpio,
200  uint8_t ucPinState );
201 
214 int32_t iot_gpio_close( IotGpioHandle_t const pxGpio );
215 
235 int32_t iot_gpio_ioctl( IotGpioHandle_t const pxGpio,
236  IotGpioIoctlRequest_t xRequest,
237  void * const pvBuffer );
238 
243 #endif /* _IOT_GPIO_H_ */
Definition: iot_gpio.h:98
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.
IotGpioOutputMode_t
enum for configuring GPIO output type.
Definition: iot_gpio.h:64
Definition: iot_gpio.h:76
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.
Definition: iot_gpio.h:110
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 desire...
Definition: iot_gpio.h:113
Definition: iot_gpio.h:58
Definition: iot_gpio.h:89
IotGpioIoctlRequest_t
Ioctl request types.
Definition: iot_gpio.h:96
Definition: iot_gpio.h:103
Definition: iot_gpio.h:88
Definition: iot_gpio.h:108
Definition: iot_gpio.h:77
Definition: iot_gpio.h:101
Definition: iot_gpio.h:85
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 co...
IotGpioDirection_t
enum for configuring GPIO input/output direction.
Definition: iot_gpio.h:55
Definition: iot_gpio.h:66
Definition: iot_gpio.h:57
IotGpioInterrupt_t
GPIO pin interrupt config types.
Definition: iot_gpio.h:83
Definition: iot_gpio.h:86
Definition: iot_gpio.h:105
Definition: iot_gpio.h:102
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...
Definition: iot_gpio.h:100
Definition: iot_gpio.h:67
Definition: iot_gpio.h:90
Definition: iot_gpio.h:109
Definition: iot_gpio.h:112
Definition: iot_gpio.h:75
Definition: iot_gpio.h:87
IotGpioPull_t
GPIO pin internal pull state. Sets the default state for output pins.
Definition: iot_gpio.h:73
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...
Definition: iot_gpio.h:107
Definition: iot_gpio.h:106
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 AP...
Definition: iot_gpio.h:136
struct IotGpioDescriptor * IotGpioHandle_t
IotGpioHandle_t type is the GPIO handle returned by calling iot_gpio_open() this is initialized in op...
Definition: iot_gpio.h:126
Definition: iot_gpio.h:111