/* Trigger possible interrupt events after an input pin has changed. 
The caller must ensure that  */
static void gpio_emul_pend_interrupt(const struct device *port, gpio_port_pins_t mask, gpio_port_value_t prev_values, gpio_port_value_t values)
/* Trigger possible interrupt events after an input pin has changed. 
The caller must ensure that  */
static void gpio_emul_pend_interrupt(const struct device *port, gpio_port_pins_t mask, gpio_port_value_t prev_values, gpio_port_value_t values)
{
	gpio_port_pins_t interrupts;
	struct gpio_emul_data *drv_data =
		(struct gpio_emul_data *)port->data;
	k_spinlock_key_t key;
	key = k_spin_lock(&drv_data->lock);
	gpio_emul_gen_interrupt_bits(port, mask, prev_values, values,
		&interrupts, true);
	while (interrupts != 0) {
		k_spin_unlock(&drv_data->lock, key);
		gpio_fire_callbacks(&drv_data->callbacks, port, interrupts);
		key = k_spin_lock(&drv_data->lock);
		drv_data->interrupts &= ~interrupts;
		gpio_emul_gen_interrupt_bits(port, mask, prev_values, values,
			&interrupts, false);
	}
	k_spin_unlock(&drv_data->lock, key);
}