HAL  v0.6.1
Hardware Abstraction Layer
Loading...
Searching...
No Matches
hal_gpio.h File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
Include dependency graph for hal_gpio.h:
This graph shows which files directly or indirectly include this file:

Typedefs

typedef uint16_t gpio_pin_t
 
typedef void(* hal_gpio_callback) (const gpio_pin_t pin)
 GPIO external interrupt callback function prototype.
 

Enumerations

enum  gpio_result_t {
  GPIO_RESULT_OK ,
  GPIO_RESULT_INVALID ,
  GPIO_RESULT_UNSUPPORTED ,
  GPIO_RESULT_ERR ,
  TOTAL_GPIO_RESULT
}
 
enum  gpio_state_t {
  GPIO_STATE_LOW ,
  GPIO_STATE_HIGH ,
  GPIO_STATE_HIGH_Z ,
  TOTAL_GPIO_STATE
}
 
enum  gpio_mode_t {
  GPIO_MODE_IN ,
  GPIO_MODE_OUT ,
  GPIO_MODE_INPUT_PULLUP ,
  GPIO_MODE_INPUT_PULLDOWN ,
  GPIO_MODE_OUTPUT_PULLUP ,
  GPIO_MODE_OUTPUT_PULLDOWN ,
  GPIO_MODE_OUTPUT_OPEN_DRAIN ,
  TOTAL_GPIO_MODE
}
 
enum  gpio_int_mode_t {
  GPIO_INT_MODE_RISING ,
  GPIO_INT_MODE_FALLING ,
  GPIO_INT_MODE_CHANGE ,
  GPIO_INT_MODE_ON_LOW ,
  GPIO_INT_MODE_ON_HIGH ,
  TOTAL_GPIO_INT_MODE
}
 

Functions

gpio_result_t hal_gpio_init (void)
 Initialize GPIO as a whole.
 
gpio_result_t hal_gpio_set_mode (const gpio_pin_t pin, const gpio_mode_t mode)
 Initialize pin mode.
 
gpio_result_t hal_gpio_set_interrupt (const gpio_pin_t pin, const gpio_int_mode_t mode, const hal_gpio_callback callback)
 Attach interrupt to pin.
 
gpio_state_t hal_gpio_read (const gpio_pin_t pin)
 Read digital pin state.
 
gpio_result_t hal_gpio_write (const gpio_pin_t pin, const gpio_state_t state)
 Set digital pin state.