Skip to content

Commit 0cd23dc

Browse files
mmahadevan108kartben
authored andcommitted
drivers: gpio_mcux_lpc: Provide an API to fire callbacks
Provide an API for other drivers to fire GPIO callbacks Signed-off-by: Mahesh Mahadevan <[email protected]>
1 parent 419853f commit 0cd23dc

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

drivers/gpio/gpio_mcux_lpc.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,13 @@ static int gpio_mcux_lpc_pin_interrupt_configure(const struct device *dev,
399399
#endif
400400
}
401401

402+
void gpio_mcux_lpc_trigger_cb(const struct device *dev, uint32_t pins)
403+
{
404+
struct gpio_mcux_lpc_data *data = dev->data;
405+
406+
gpio_fire_callbacks(&data->callbacks, dev, pins);
407+
}
408+
402409
static int gpio_mcux_lpc_manage_cb(const struct device *port,
403410
struct gpio_callback *callback, bool set)
404411
{
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2024 NXP
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_
8+
#define ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_
9+
10+
#include <zephyr/device.h>
11+
#include <zephyr/drivers/gpio.h>
12+
13+
/**
14+
* @brief Trigger a callback for a given pin.
15+
*
16+
* This allows other drivers to fire callbacks for the pin.
17+
*
18+
* @param dev Pointer to the device structure for the driver instance.
19+
* @param pins The actual pin mask that triggered the interrupt.
20+
*
21+
*/
22+
void gpio_mcux_lpc_trigger_cb(const struct device *dev, uint32_t pins);
23+
24+
#endif /* ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_ */

0 commit comments

Comments
 (0)