From eb6ea28649f6364f17642835af0aa7706c37a10b Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Wed, 19 Sep 2018 10:15:11 -0700 Subject: [PATCH] gpio: enable callback to specify pin in addition to pin_mask There are GPIO controllers that can control more than 32 pins. The pin_mask is no longer adequate in this case. This wraps the pin_mask in a union together with a field named 'pin'. The driver is responsible for choosing whether to use pin_mask or pin. Signed-off-by: Daniel Leung --- include/gpio.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/gpio.h b/include/gpio.h index bb804846635..297d945da78 100644 --- a/include/gpio.h +++ b/include/gpio.h @@ -90,13 +90,17 @@ struct gpio_callback { /** Actual callback function being called when relevant. */ gpio_callback_handler_t handler; - /** A mask of pins the callback is interested in, if 0 the callback - * will never be called. Such pin_mask can be modified whenever + /** A mask of pins (pin_mask) or a specific pin (pin) the callback + * is interested in, if 0 the callback will never be called. + * The pin_mask or pin can be modified whenever * necessary by the owner, and thus will affect the handler being * called or not. The selected pins must be configured to trigger * an interrupt. */ - u32_t pin_mask; + union { + u32_t pin_mask; + u32_t pin; + }; }; /**