Dear Support Team,
I realized that the callback on button press event takes about 11 µA, as reported by PPK2 & nRF52-DK with the code summarized below.
Indeed, the current absorption switches from ~8 µA to ~19 µA when the button callback is configured.
Any help ?
thank you, Paolo
main.c
#include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/spi.h> #include <zephyr/pm/device.h> #define BUTTON_NODE DT_NODELABEL(button) static const struct gpio_dt_spec button_spec = GPIO_DT_SPEC_GET(BUTTON_NODE, gpios); static struct gpio_callback button_cb; static void button_pressed_callback(const struct device *gpiob, struct gpio_callback *cb, gpio_port_pins_t pins) { LOG_INF("user button pressed"); } int main(void) { while (1) { // user button gpio_pin_configure_dt(&button_spec, GPIO_INPUT); gpio_pin_interrupt_configure_dt(&button_spec, GPIO_INT_EDGE_FALLING); gpio_init_callback(&button_cb, button_pressed_callback, BIT(button_spec.pin)); gpio_add_callback_dt(&button_spec, &button_cb); k_msleep(5000); gpio_remove_callback_dt(&button_spec, &button_cb); gpio_pin_interrupt_configure_dt(&button_spec, GPIO_INT_DISABLE); k_msleep(5000); } return 0; }
board.overlay
/ { inputs { compatible = "gpio-keys"; button: button { gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; }; };