49 #define LOG_MODULE "GPIO HAL" 50 #define LOG_LEVEL LOG_LEVEL_NONE 60 #if GPIO_HAL_PORT_PIN_NUMBERING 67 for(
this =
list_head(handlers);
this != NULL;
this = this->next) {
68 if((port == this->port) && (pins & this->pin_mask)) {
69 if(this->handler != NULL) {
70 this->handler(port, pins & this->pin_mask);
83 for(
this =
list_head(handlers);
this != NULL;
this = this->next) {
84 if(pins & this->pin_mask) {
85 if(this->handler != NULL) {
86 this->handler(pins & this->pin_mask);
101 #if GPIO_HAL_ARCH_SW_TOGGLE 106 gpio_hal_arch_write_pin(port, pin, gpio_hal_arch_read_pin(port, pin) ^ 1);
112 gpio_hal_arch_write_pins(port, pins, ~gpio_hal_arch_read_pins(port, pins));
119 LOG_ERR(
"Pin %u out of bounds\n", pin);
Datatype for GPIO event handlers.
void gpio_hal_arch_port_toggle_pin(gpio_hal_port_t port, gpio_hal_pin_t pin)
Toggle a GPIO pin.
void gpio_hal_arch_no_port_toggle_pins(gpio_hal_pin_mask_t pins)
Toggle multiple pins.
uint8_t gpio_hal_port_t
A data structure that represents ports.
#define GPIO_HAL_PIN_COUNT
Specifies the total number of pins on a device.
void gpio_hal_arch_no_port_toggle_pin(gpio_hal_pin_t pin)
Toggle a GPIO pin.
void gpio_hal_init()
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.
void gpio_hal_arch_port_toggle_pins(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
Toggle multiple pins.
Linked list manipulation routines.
void * list_head(list_t list)
Get a pointer to the first element of a list.
uint8_t gpio_hal_pin_t
GPIO pin number representation.
void list_add(list_t list, void *item)
Add an item at the end of a list.
uint32_t gpio_hal_pin_mask_t
GPIO pin mask representation.
void list_init(list_t list)
Initialize a list.
#define LIST(name)
Declare a linked list.
Header file for the GPIO HAL.
void gpio_hal_event_handler(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
The platform-independent GPIO event handler.
Header file for the logging system
#define GPIO_HAL_NULL_PORT
Convenience macro to use this as the port argument of macros.