how to set 2 separate callbacks on the same pin, for pin raise and fall in zephyr

hello Nordic

i am working with nrf52840, with zephyr 2.6.9, ncs 1.7.1

i want to have an interrupt on a pin toggle and have a callback for up and one for down

i configure the pin as follows:

ret = gpio_pin_interrupt_configure(button,
					   SW0_GPIO_PIN,
					   GPIO_INT_EDGE_BOTH);

but initialising the callback i don't see how i can create a different cb for each flag type

gpio_init_callback(&button_cb_data, button_pressed, BIT(SW0_GPIO_PIN));

any ideas as for how to achieve that without breaking the zephyr hw interface layer by using nrfx_gpio functions ?

hope to read from you soon

best regards

Ziv

Related