hi,i am using zephyr`s sample of gpiote,it works well,but i don`t know how to optimize the power consume of gpiote:
1,how to setup PORT EVENT?
2,Sometimes i want to reduce power consume like these:
nrfx_gpiote_in_event_disable() 、nrfx_gpiote_in_uninit() and nrfx_gpiote_uninit(),
but i can`t find zephyr api to do this.
bool gpio_irq_set(const struct gpio_dt_spec *gpio, uint32_t pull, uint32_t flag, struct gpio_callback *callback, gpio_callback_handler_t handler)
{
if (!gpio_is_ready_dt(gpio)) {
printk("Error: device %s is not ready\n", gpio->port->name);
return false;
}
int ret = gpio_pin_configure_dt(gpio, GPIO_INPUT|pull);
if (ret != 0) {
printk("Error %d: failed to configure %s pin %d\n", ret, gpio->port->name, gpio->pin);
return false;
}
ret = gpio_pin_interrupt_configure_dt(gpio, flag);
if (ret != 0) {
printk("Error %d: failed to configure interrupt on %s pin %d\n", ret, gpio->port->name, gpio->pin);
return false;
}
gpio_init_callback(callback, handler, BIT(gpio->pin));
gpio_add_callback(gpio->port, callback);
printk("Set up at %s pin %d\n", gpio->port->name, gpio->pin);
return true;
}
static struct gpio_callback gpio_cb;
struct gpio_dt_spec gpio_int = GPIO_DT_SPEC_GET_BY_IDX(DT_NODELABEL(mems_gpio), gpios, 3);
void gpio_irq_cb(const struct device *dev, struct gpio_callback *cb, uint32_t pins)
{
printk("gpio_irq_cb\n");
}
main()
{
... ...
gpio_irq_set(&gpio_int, GPIO_PULL_DOWN, GPIO_INT_EDGE_BOTH, &gpio_cb, gpio_irq_cb);
while (1) {
k_msleep(forever);
}
}