gpio: Improve the public API to handle multi callbacks

Many sub-systems might require to set a callback on different pins.
Thus enabling it via changing the API.

It is also possible to retrieve private-data in the callback handler
using CONTAINER_OF() macro (include/misc/util.h).

Former API is still available, and is emulated through the new one.
Using both should not be a problem as it's using new API calls.
However, it's now better to start using the new API.

Change-Id: Id16594202905976cc524775d1cd3592b54a84514
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Tomasz Bursztyka 2016-03-23 12:01:06 +01:00 committed by Anas Nashif
commit fea1c49ba2
22 changed files with 537 additions and 224 deletions

View file

@ -44,7 +44,7 @@ struct gpio_sch_config {
struct gpio_sch_data {
char __stack polling_stack[GPIO_SCH_POLLING_STACK_SIZE];
gpio_callback_t callback;
sys_slist_t callbacks;
struct nano_timer poll_timer;
struct {
@ -53,9 +53,8 @@ struct gpio_sch_data {
} int_regs;
uint32_t cb_enabled;
uint8_t port_cb;
uint8_t poll;
uint8_t stride[2];
uint8_t stride[3];
};
#endif /* __GPIO_SCH_H__ */