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 <mahesh.mahadevan@nxp.com>
This commit is contained in:
Mahesh Mahadevan 2024-06-24 10:41:29 -05:00 committed by Benjamin Cabé
commit 0cd23dc5b7
2 changed files with 31 additions and 0 deletions

View file

@ -399,6 +399,13 @@ static int gpio_mcux_lpc_pin_interrupt_configure(const struct device *dev,
#endif
}
void gpio_mcux_lpc_trigger_cb(const struct device *dev, uint32_t pins)
{
struct gpio_mcux_lpc_data *data = dev->data;
gpio_fire_callbacks(&data->callbacks, dev, pins);
}
static int gpio_mcux_lpc_manage_cb(const struct device *port,
struct gpio_callback *callback, bool set)
{

View file

@ -0,0 +1,24 @@
/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_
#define ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
/**
* @brief Trigger a callback for a given pin.
*
* This allows other drivers to fire callbacks for the pin.
*
* @param dev Pointer to the device structure for the driver instance.
* @param pins The actual pin mask that triggered the interrupt.
*
*/
void gpio_mcux_lpc_trigger_cb(const struct device *dev, uint32_t pins);
#endif /* ZEPHYR_INCLUDE_DRIVERS_GPIO_MCUX_LPC_H_ */