|
mraa
2.0.0
Low Level Skeleton Library for Communication on GNU/Linux platforms
|
Gpio is the General Purpose IO interface to libmraa. Its features depend on the board type used, it can use gpiolibs (exported via a kernel module through sysfs), or memory mapped IO via a /dev/uio device or /dev/mem depending again on the board configuration.
Go to the source code of this file.
Data Structures | |
| struct | mraa_gpio_event |
Typedefs | |
| typedef struct _gpio * | mraa_gpio_context |
| typedef long long unsigned int | mraa_timestamp_t |
| typedef mraa_gpio_event * | mraa_gpio_events_t |
Enumerations | |
| enum | mraa_gpio_mode_t { MRAA_GPIO_STRONG = 0, MRAA_GPIO_PULLUP = 1, MRAA_GPIO_PULLDOWN = 2, MRAA_GPIO_HIZ = 3, MRAA_GPIOD_ACTIVE_LOW = 4, MRAA_GPIOD_OPEN_DRAIN = 5, MRAA_GPIOD_OPEN_SOURCE = 6 } |
| enum | mraa_gpio_dir_t { MRAA_GPIO_OUT = 0, MRAA_GPIO_IN = 1, MRAA_GPIO_OUT_HIGH = 2, MRAA_GPIO_OUT_LOW = 3 } |
| enum | mraa_gpio_edge_t { MRAA_GPIO_EDGE_NONE = 0, MRAA_GPIO_EDGE_BOTH = 1, MRAA_GPIO_EDGE_RISING = 2, MRAA_GPIO_EDGE_FALLING = 3 } |
| enum | mraa_gpio_input_mode_t { MRAA_GPIO_ACTIVE_HIGH = 0, MRAA_GPIO_ACTIVE_LOW = 1 } |
| enum | mraa_gpio_out_driver_mode_t { MRAA_GPIO_OPEN_DRAIN = 0, MRAA_GPIO_PUSH_PULL = 1 } |
| mraa_gpio_context mraa_gpio_init | ( | int | pin | ) |
Initialise gpio_context, based on board number
| pin | Pin number read from the board, i.e IO3 is 3 |

| mraa_gpio_context mraa_gpio_init_multi | ( | int | pins[], |
| int | num_pins | ||
| ) |
Initialise gpio_context, based on board number, for multiple pins (can be one).
| pins | Pin array read from the board |
| num_pins | Number of pins - must be the same as the pins array length provided as the first argument. |
| mraa_gpio_context mraa_gpio_init_raw | ( | int | gpiopin | ) |
Initialise gpio context without any mapping to a pin
| gpiopin | gpio pin as listed in SYSFS |

| mraa_result_t mraa_gpio_edge_mode | ( | mraa_gpio_context | dev, |
| mraa_gpio_edge_t | mode | ||
| ) |
Set the edge mode on the gpio
| dev | The Gpio context |
| mode | The edge mode to set the gpio into |

| mraa_result_t mraa_gpio_isr | ( | mraa_gpio_context | dev, |
| mraa_gpio_edge_t | edge, | ||
| void(*)(void *) | fptr, | ||
| void * | args | ||
| ) |
Set an interrupt on pin(s).
| dev | The Gpio context |
| edge | The edge mode to set the gpio(s) into |
| fptr | Function pointer to function to be called when interrupt is triggered |
| args | Arguments passed to the interrupt handler (fptr) |

| mraa_gpio_events_t mraa_gpio_get_events | ( | mraa_gpio_context | dev | ) |
Get an array of structures describing triggered events.
| dev | The Gpio context |
| mraa_result_t mraa_gpio_isr_exit | ( | mraa_gpio_context | dev | ) |
Stop the current interrupt watcher on this Gpio, and set the Gpio edge mode to MRAA_GPIO_EDGE_NONE(only for sysfs interface).
| dev | The Gpio context |

| mraa_result_t mraa_gpio_mode | ( | mraa_gpio_context | dev, |
| mraa_gpio_mode_t | mode | ||
| ) |
Set Gpio(s) Output Mode,
| dev | The Gpio context |
| mode | The Gpio(s) Output Mode |

| mraa_result_t mraa_gpio_dir | ( | mraa_gpio_context | dev, |
| mraa_gpio_dir_t | dir | ||
| ) |
Set Gpio(s) direction
| dev | The Gpio context |
| dir | The direction of the Gpio(s) |

| mraa_result_t mraa_gpio_read_dir | ( | mraa_gpio_context | dev, |
| mraa_gpio_dir_t * | dir | ||
| ) |
Read Gpio(s) direction
| dev | The Gpio context |
| dir | The address where to store the Gpio(s) direction |

| mraa_result_t mraa_gpio_close | ( | mraa_gpio_context | dev | ) |
Close the Gpio context
| dev | The Gpio context |

| int mraa_gpio_read | ( | mraa_gpio_context | dev | ) |
Read the Gpio value. This can be 0 or 1. A resonse of -1 means that there was a fatal error.
| dev | The Gpio context |

| mraa_result_t mraa_gpio_read_multi | ( | mraa_gpio_context | dev, |
| int | output_values[] | ||
| ) |
Read the Gpio(s) value. The user must provide an integer array with a length equal to the number of pins provided to mraa_gpio_init_multi() function.
| dev | The Gpio context |
| output_values | The array provided by the user. Existing values will be overwritten with the newly read ones. |
| mraa_result_t mraa_gpio_write | ( | mraa_gpio_context | dev, |
| int | value | ||
| ) |
Write to the Gpio Value.
| dev | The Gpio context |
| value | Integer value to write |

| mraa_result_t mraa_gpio_write_multi | ( | mraa_gpio_context | dev, |
| int | input_values[] | ||
| ) |
Write to the Gpio(s) Value. The user must provide an integer array with a length equal to the number of pins provided to mraa_gpio_init_multi() function.
| dev | The Gpio context |
| output_values | The array provided by the user. It must contain the values intended to be written to the gpio pins, in the same order as the init function. |
| mraa_result_t mraa_gpio_owner | ( | mraa_gpio_context | dev, |
| mraa_boolean_t | owner | ||
| ) |
Change ownership of the context.
| dev | The Gpio context |
| owner | Does this context own the pin |

| DEPRECATED mraa_result_t mraa_gpio_use_mmaped | ( | mraa_gpio_context | dev, |
| mraa_boolean_t | mmap | ||
| ) |
Enable using memory mapped io instead of sysfs, chardev based I/O can be considered memorymapped
| dev | The Gpio context |
| mmap | Use mmap instead of sysfs |

| int mraa_gpio_get_pin | ( | mraa_gpio_context | dev | ) |
Get a pin number of the gpio, invalid will return -1
| dev | The Gpio context |

| int mraa_gpio_get_pin_raw | ( | mraa_gpio_context | dev | ) |
Get a gpio number as used within sysfs, invalid will return -1
| dev | The Gpio context |

| mraa_result_t mraa_gpio_input_mode | ( | mraa_gpio_context | dev, |
| mraa_gpio_input_mode_t | mode | ||
| ) |
Set Gpio input mode
| dev | The Gpio context |
| mode | Mode to set input pin state |

| mraa_result_t mraa_gpio_out_driver_mode | ( | mraa_gpio_context | dev, |
| mraa_gpio_out_driver_mode_t | mode | ||
| ) |
Set Gpio output driver mode. This is not a standard feature, it needs custom implementation for each board
| dev | The Gpio context |
| mode | Set output driver mode |

| typedef struct _gpio* mraa_gpio_context |
Opaque pointer definition to the internal struct _gpio
| enum mraa_gpio_mode_t |
| enum mraa_gpio_dir_t |
| enum mraa_gpio_edge_t |

1.8.11