I am having issues using a keypad to wakeup an nrf52840 and am unclear on if the GPIO sample is relevant if using a kbd_matrix device definition.
I would like to use "sys_poweroff()" for power savings but have not been able to wake it up again. Is it possible to use this device? Do I need to change to a GPIO interrupt or something?
Currently, a callback is registered for the keypad events:
INPUT_CALLBACK_DEFINE(DEVICE_DT_GET(DT_NODELABEL(keymap)), input_button_raw_cb);
I have added "wakeup-source" to the device tree and the definition is:
kbd_matrix: kbd_matrix {
compatible = "gpio-kbd-matrix";
zephyr,deferred-init; // Init at runtime depending on the board
wakeup-source;
row-gpios = <&gpio1 1 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
<&gpio1 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
<&gpio1 3 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>,
<&gpio1 4 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
col-gpios = <&gpio1 5 GPIO_ACTIVE_LOW>,
<&gpio1 6 GPIO_ACTIVE_LOW>,
<&gpio1 7 GPIO_ACTIVE_LOW>;
keymap: keymap {
compatible = "input-keymap";
keymap = <
MATRIX_KEY(3, 0, 100)
MATRIX_KEY(3, 1, 101)
MATRIX_KEY(3, 2, 102)
MATRIX_KEY(2, 0, 103)
MATRIX_KEY(2, 1, 104)
MATRIX_KEY(2, 2, 105)
MATRIX_KEY(1, 0, 106)
MATRIX_KEY(1, 1, 107)
MATRIX_KEY(1, 2, 108)
MATRIX_KEY(0, 0, 109)
MATRIX_KEY(0, 1, 110)
MATRIX_KEY(0, 2, 111)
>;
row-size = <4>;
col-size = <3>;
};
};