The GPIO API provides functions to control GPIO peripherals connected to the IoT device.
Required Header
#include <peripheral_io.h>
Overview
This GPIO API provides functions to control GPIO peripherals connected to the IoT device.
Realted Features
This API is related with the following feature:
It is recommended to use features in your application for reliability.
You can check if a IoT device supports the related features for this API
by using System Information, and control your application's actions accordingly.
To ensure your application is only running on the IoT device with specific features,
please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Typedef Documentation
The handle of a GPIO pin.
- Since :
- 4.0
The GPIO interrupted callback called when the GPIO interrupt is triggered.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Parameters:
-
[in] | gpio | The GPIO handle |
[in] | error | The GPIO error |
[in] | user_data | The user data passed from the callback registration function |
- See also:
- peripheral_gpio_set_interrupted_cb()
Enumeration Type Documentation
Enumeration of GPIO direction options.
- Since :
- 4.0
- Enumerator:
PERIPHERAL_GPIO_DIRECTION_IN |
Input Mode
|
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_HIGH |
Output mode with high value
|
PERIPHERAL_GPIO_DIRECTION_OUT_INITIALLY_LOW |
Output mode with low value
|
Enumeration of edge types for the GPIO interrupt.
- Since :
- 4.0
- Enumerator:
PERIPHERAL_GPIO_EDGE_NONE |
No interrupt on GPIO
|
PERIPHERAL_GPIO_EDGE_RISING |
Interrupt on rising only
|
PERIPHERAL_GPIO_EDGE_FALLING |
Interrupt on falling only
|
PERIPHERAL_GPIO_EDGE_BOTH |
Interrupt on rising & falling
|
Function Documentation
Opens a GPIO pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio_pin | The GPIO pin number |
[out] | gpio | The GPIO handle is created on success |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- Postcondition:
- peripheral_gpio_close()
Gets the current value of the GPIO pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio | The GPIO handle |
[out] | value | The value to get |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- See also:
- peripheral_gpio_write()
Sets the GPIO direction.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio | The GPIO handle |
[in] | direction | The direction of the GPIO pin |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- See also:
- peripheral_gpio_direction_e
Sets the GPIO edge mode.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio | The GPIO handle |
[in] | edge | The edge mode of the GPIO pin |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- See also:
- peripheral_gpio_edge_e
Sets the GPIO interrupted callback to be invoked when the GPIO interrupt is triggered.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio | The GPIO handle |
[in] | callback | The GPIO interrupted callback function to set |
[in] | user_data | The user data to be passed to the callback function |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- Postcondition:
- peripheral_gpio_unset_interrupted_cb()
- See also:
- peripheral_gpio_set_edge_mode()
Sets the value of the GPIO pin.
- Warning:
- This is not for use by third-party applications.
- Since :
- 4.0
- Privilege Level:
- platform
- Privilege:
- http://tizen.org/privilege/peripheralio
- Parameters:
-
[in] | gpio | The GPIO handle |
[in] | value | The value to set (must be 0 or 1) |
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
- See also:
- peripheral_gpio_read()