Contiki-NG
|
Header file for the GPIO HAL. More...
#include "contiki.h"
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | gpio_hal_event_handler_s |
Datatype for GPIO event handlers. More... | |
Macros | |
#define | GPIO_HAL_PORT_PIN_NUMBERING 1 |
Specifies whether the HAL should support a port/pin convention. More... | |
#define | GPIO_HAL_ARCH_SW_TOGGLE 1 |
Specifies whether software-based pin toggle is required. More... | |
#define | GPIO_HAL_NULL_PORT 0 |
Convenience macro to use this as the port argument of macros. More... | |
#define | GPIO_HAL_PIN_COUNT 32 |
Specifies the total number of pins on a device. More... | |
#define | GPIO_HAL_PIN_UNKNOWN 0xFF |
Unknown GPIO. More... | |
Typedefs | |
typedef uint8_t | gpio_hal_pin_t |
GPIO pin number representation. | |
typedef uint8_t | gpio_hal_port_t |
A data structure that represents ports. More... | |
typedef uint32_t | gpio_hal_pin_cfg_t |
GPIO pin configuration. More... | |
typedef uint32_t | gpio_hal_pin_mask_t |
GPIO pin mask representation. More... | |
typedef struct gpio_hal_event_handler_s | gpio_hal_event_handler_t |
Datatype for GPIO event handlers. More... | |
Core GPIO functions | |
#define | gpio_hal_pin_to_mask(pin) ((gpio_hal_pin_mask_t)1 << (pin)) |
Convert a pin to a pin mask. More... | |
void | gpio_hal_init (void) |
Initialise the GPIO HAL. | |
void | gpio_hal_register_handler (gpio_hal_event_handler_t *handler) |
Register a function to be called whenever a pin triggers an event. More... | |
void | gpio_hal_event_handler (gpio_hal_port_t port, gpio_hal_pin_mask_t pins) |
The platform-independent GPIO event handler. More... | |
GPIO pin manipulation functions to be provided by the platform code. | |
All functions have two flavours:
Macros are provided that automatically expand to the desirable prototype depending on the value of GPIO_HAL_PORT_PIN_NUMBERING. In order to achieve code portability, all platform-independent code should use those macros to manipulate GPIOs instead of using the port_ / no_port_ functions directly. A convenience macro GPIO_HAL_NULL_PORT is provided to be used as the port argument of macros when GPIO_HAL_PORT_PIN_NUMBERING is zero. All the functions below must be provided by the platform's developer. The HAL offers the developer a number of options of how to provide the required functionality.
#define gpio_hal_arch_write_pin(port, pin, v) sdk_function(port, pin, v)
#define gpio_hal_arch_set_pin(port, pin) set_pin(port, pin) static inline void set_pin(gpio_hal_port_t port, gpio_hal_pin_t pin) { ... } In the latter two cases, the developer will likely provide implementations in a header file. In this scenario, one of the platform's configuration files must define GPIO_HAL_CONF_ARCH_HDR_PATH to the name of this header file. For example: #define GPIO_HAL_CONF_ARCH_HDR_PATH "dev/gpio-hal-arch.h" | |
#define | gpio_hal_arch_interrupt_enable(port, pin) gpio_hal_arch_port_interrupt_enable(port, pin) |
#define | gpio_hal_arch_interrupt_disable(port, pin) gpio_hal_arch_port_interrupt_disable(port, pin) |
#define | gpio_hal_arch_pin_cfg_set(port, pin, cfg) gpio_hal_arch_port_pin_cfg_set(port, pin, cfg) |
#define | gpio_hal_arch_pin_cfg_get(port, pin) gpio_hal_arch_port_pin_cfg_get(port, pin) |
#define | gpio_hal_arch_pin_set_input(port, pin) gpio_hal_arch_port_pin_set_input(port, pin) |
#define | gpio_hal_arch_pin_set_output(port, pin) gpio_hal_arch_port_pin_set_output(port, pin) |
#define | gpio_hal_arch_set_pin(port, pin) gpio_hal_arch_port_set_pin(port, pin) |
#define | gpio_hal_arch_clear_pin(port, pin) gpio_hal_arch_port_clear_pin(port, pin) |
#define | gpio_hal_arch_toggle_pin(port, pin) gpio_hal_arch_port_toggle_pin(port, pin) |
#define | gpio_hal_arch_read_pin(port, pin) gpio_hal_arch_port_read_pin(port, pin) |
#define | gpio_hal_arch_write_pin(port, pin, value) gpio_hal_arch_port_write_pin(port, pin, value) |
#define | gpio_hal_arch_set_pins(port, pin) gpio_hal_arch_port_set_pins(port, pin) |
#define | gpio_hal_arch_clear_pins(port, pin) gpio_hal_arch_port_clear_pins(port, pin) |
#define | gpio_hal_arch_toggle_pins(port, pin) gpio_hal_arch_port_toggle_pins(port, pin) |
#define | gpio_hal_arch_read_pins(port, pin) gpio_hal_arch_port_read_pins(port, pin) |
#define | gpio_hal_arch_write_pins(port, pin, value) gpio_hal_arch_port_write_pins(port, pin, value) |
void | gpio_hal_arch_init (void) |
Perform architecture specific gpio initaliaztion. More... | |
void | gpio_hal_arch_port_interrupt_enable (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Enable interrupts for a gpio pin. More... | |
void | gpio_hal_arch_no_port_interrupt_enable (gpio_hal_pin_t pin) |
Enable interrupts for a gpio pin. More... | |
void | gpio_hal_arch_port_interrupt_disable (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Disable interrupts for a gpio pin. More... | |
void | gpio_hal_arch_no_port_interrupt_disable (gpio_hal_pin_t pin) |
Disable interrupts for a gpio pin. More... | |
void | gpio_hal_arch_port_pin_cfg_set (gpio_hal_port_t port, gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) |
Configure a gpio pin. More... | |
void | gpio_hal_arch_no_port_pin_cfg_set (gpio_hal_pin_t pin, gpio_hal_pin_cfg_t cfg) |
Configure a gpio pin. More... | |
gpio_hal_pin_cfg_t | gpio_hal_arch_port_pin_cfg_get (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Read the configuration of a GPIO pin. More... | |
gpio_hal_pin_cfg_t | gpio_hal_arch_no_port_pin_cfg_get (gpio_hal_pin_t pin) |
Read the configuration of a GPIO pin. More... | |
void | gpio_hal_arch_port_pin_set_input (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Configure a pin as GPIO input. More... | |
void | gpio_hal_arch_no_port_pin_set_input (gpio_hal_pin_t pin) |
Configure a pin as GPIO input. More... | |
void | gpio_hal_arch_port_pin_set_output (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Configure a pin as GPIO output. More... | |
void | gpio_hal_arch_no_port_pin_set_output (gpio_hal_pin_t pin) |
Configure a pin as GPIO output. More... | |
void | gpio_hal_arch_port_set_pin (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Set a GPIO pin to logical high. More... | |
void | gpio_hal_arch_no_port_set_pin (gpio_hal_pin_t pin) |
Set a GPIO pin to logical high. More... | |
void | gpio_hal_arch_port_clear_pin (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Clear a GPIO pin (logical low) More... | |
void | gpio_hal_arch_no_port_clear_pin (gpio_hal_pin_t pin) |
Clear a GPIO pin (logical low) More... | |
void | gpio_hal_arch_port_toggle_pin (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Toggle a GPIO pin. More... | |
void | gpio_hal_arch_no_port_toggle_pin (gpio_hal_pin_t pin) |
Toggle a GPIO pin. More... | |
uint8_t | gpio_hal_arch_port_read_pin (gpio_hal_port_t port, gpio_hal_pin_t pin) |
Read a GPIO pin. More... | |
uint8_t | gpio_hal_arch_no_port_read_pin (gpio_hal_pin_t pin) |
Read a GPIO pin. More... | |
void | gpio_hal_arch_port_write_pin (gpio_hal_port_t port, gpio_hal_pin_t pin, uint8_t value) |
Write a GPIO pin. More... | |
void | gpio_hal_arch_no_port_write_pin (gpio_hal_pin_t pin, uint8_t value) |
Write a GPIO pin. More... | |
void | gpio_hal_arch_port_set_pins (gpio_hal_port_t port, gpio_hal_pin_mask_t pins) |
Set multiple pins to logical high. More... | |
void | gpio_hal_arch_no_port_set_pins (gpio_hal_pin_mask_t pins) |
Set multiple pins to logical high. More... | |
void | gpio_hal_arch_port_clear_pins (gpio_hal_port_t port, gpio_hal_pin_mask_t pins) |
Clear multiple pins to logical low. More... | |
void | gpio_hal_arch_no_port_clear_pins (gpio_hal_pin_mask_t pins) |
Clear multiple pins to logical low. More... | |
void | gpio_hal_arch_port_toggle_pins (gpio_hal_port_t port, gpio_hal_pin_mask_t pins) |
Toggle multiple pins. More... | |
void | gpio_hal_arch_no_port_toggle_pins (gpio_hal_pin_mask_t pins) |
Toggle multiple pins. More... | |
gpio_hal_pin_mask_t | gpio_hal_arch_port_read_pins (gpio_hal_port_t port, gpio_hal_pin_mask_t pins) |
Read multiple pins. More... | |
gpio_hal_pin_mask_t | gpio_hal_arch_no_port_read_pins (gpio_hal_pin_mask_t pins) |
Read multiple pins. More... | |
void | gpio_hal_arch_port_write_pins (gpio_hal_port_t port, gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value) |
Write multiple pins. More... | |
void | gpio_hal_arch_no_port_write_pins (gpio_hal_pin_mask_t pins, gpio_hal_pin_mask_t value) |
Write multiple pins. More... | |
Header file for the GPIO HAL.
Definition in file gpio-hal.h.