Common IO - basic v1.0.0
Common IO - basic v1.0.0 Library
 
Loading...
Searching...
No Matches
iot_gpio.h
Go to the documentation of this file.
1/*
2 * Common IO - basic V1.0.0
3 * Copyright (C) 2020 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 )
55typedef enum
56{
60
64typedef enum
65{
69
73typedef enum
74{
79
83typedef enum
84{
92
96typedef enum
97{
115
119struct IotGpioDescriptor;
120
126typedef struct IotGpioDescriptor * IotGpioHandle_t;
127
136typedef void ( * IotGpioCallback_t )( uint8_t ucPinState,
137 void * pvUserContext );
138
153IotGpioHandle_t iot_gpio_open( int32_t lGpioNumber );
154
170 IotGpioCallback_t xGpioCallback,
171 void * pvUserContext );
172
186 uint8_t * pucPinState );
187
200 uint8_t ucPinState );
201
214int32_t iot_gpio_close( IotGpioHandle_t const pxGpio );
215
235int32_t iot_gpio_ioctl( IotGpioHandle_t const pxGpio,
236 IotGpioIoctlRequest_t xRequest,
237 void * const pvBuffer );
238
243#endif /* _IOT_GPIO_H_ */
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...
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
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 triggered.
IotGpioOutputMode_t
enum for configuring GPIO output type.
Definition: iot_gpio.h:65
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....
IotGpioPull_t
GPIO pin internal pull state. Sets the default state for output pins.
Definition: iot_gpio.h:74
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
IotGpioIoctlRequest_t
Ioctl request types.
Definition: iot_gpio.h:97
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.
IotGpioInterrupt_t
GPIO pin interrupt config types.
Definition: iot_gpio.h:84
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.
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:56
@ eGpioPushPull
Definition: iot_gpio.h:67
@ eGpioOpenDrain
Definition: iot_gpio.h:66
@ eGpioPullUp
Definition: iot_gpio.h:76
@ eGpioPullDown
Definition: iot_gpio.h:77
@ eGpioPullNone
Definition: iot_gpio.h:75
@ eGetGpioFunction
Definition: iot_gpio.h:107
@ eGetGpioDriveStrength
Definition: iot_gpio.h:113
@ eSetGpioInterrupt
Definition: iot_gpio.h:103
@ eSetGpioOutputMode
Definition: iot_gpio.h:102
@ eSetGpioDriveStrength
Definition: iot_gpio.h:106
@ eGetGpioInterrupt
Definition: iot_gpio.h:111
@ eSetGpioFunction
Definition: iot_gpio.h:98
@ eSetGpioDirection
Definition: iot_gpio.h:100
@ eGetGpioSpeed
Definition: iot_gpio.h:112
@ eGetGpioOutputType
Definition: iot_gpio.h:110
@ eGetGpioDirection
Definition: iot_gpio.h:108
@ eSetGpioSpeed
Definition: iot_gpio.h:105
@ eGetGpioPull
Definition: iot_gpio.h:109
@ eSetGpioPull
Definition: iot_gpio.h:101
@ eGpioInterruptLow
Definition: iot_gpio.h:89
@ eGpioInterruptNone
Definition: iot_gpio.h:85
@ eGpioInterruptHigh
Definition: iot_gpio.h:90
@ eGpioInterruptRising
Definition: iot_gpio.h:86
@ eGpioInterruptEdge
Definition: iot_gpio.h:88
@ eGpioInterruptFalling
Definition: iot_gpio.h:87
@ eGpioDirectionInput
Definition: iot_gpio.h:57
@ eGpioDirectionOutput
Definition: iot_gpio.h:58