picofuse

Typedefs | Enumerations
gpio.h File Reference

GPIO (General Purpose Input/Output) interface. More...

#include <stdbool.h>
#include <stdint.h>
Include dependency graph for gpio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct hw_gpio_t hw_gpio_t
 GPIO logical pin structure.
 
typedef void(* hw_gpio_callback_t) (uint8_t bank, uint8_t pin, hw_gpio_event_t event, void *userdata)
 GPIO interrupt callback function pointer. More...
 

Enumerations

enum  hw_gpio_mode_t {
  hw_gpio_none = 0, hw_gpio_input, hw_gpio_pullup, hw_gpio_pulldown,
  hw_gpio_output, hw_gpio_spi, hw_gpio_i2c, hw_gpio_uart,
  hw_gpio_pwm, hw_gpio_adc, hw_gpio_unknown
}
 GPIO mode flags for configuring GPIO pins.
 
enum  hw_gpio_event_t { hw_gpio_rising = (1 << 0), hw_gpio_falling = (1 << 1) }
 GPIO interrupt event flags.
 

Functions

Lifecycle
hw_gpio_thw_gpio_init (uint8_t bank, uint8_t pin, hw_gpio_mode_t mode)
 Initialize a GPIO pin with the specified mode. More...
 
void hw_gpio_deinit (hw_gpio_t *gpio)
 Deinitialize and release a GPIO pin. More...
 
uint8_t hw_gpio_count (uint8_t bank)
 Get the total number of available GPIO pins for a given bank. More...
 
void hw_gpio_set_callback (hw_gpio_callback_t callback, void *userdata)
 Set the global GPIO interrupt callback handler. More...
 
Methods
uint8_t hw_gpio_pin (const hw_gpio_t *gpio)
 Get the logical pin number for a GPIO handle. More...
 
uint8_t hw_gpio_bank (const hw_gpio_t *gpio)
 Get the GPIO bank number for a GPIO handle. More...
 
hw_gpio_mode_t hw_gpio_get_mode (const hw_gpio_t *gpio)
 Get the current mode configuration of a GPIO pin. More...
 
void hw_gpio_set_mode (hw_gpio_t *gpio, hw_gpio_mode_t mode)
 Set the current mode configuration of a GPIO pin. More...
 
bool hw_gpio_get (const hw_gpio_t *gpio)
 Read the current state of a GPIO pin. More...
 
void hw_gpio_set (hw_gpio_t *gpio, bool value)
 Set the state of a GPIO pin. More...
 

Detailed Description

GPIO (General Purpose Input/Output) interface.

Definition in file gpio.h.