RMK supports low-power mode by utilizing embassy's low-power feature and the Wait trait in embedded-hal-async.
By default, RMK uses a busy-loop for matrix scanning, which is not very power efficient. To enable the low-power mode, add the async_matrix feature to your Cargo.toml:
If you're using nRF chips or RP2040, you're all set! Your keyboard is now running in low-power mode. The async_matrix feature enables interrupt-based input detection, and puts your microcontroller into sleep mode when no keys are being pressed.
For STM32, there are some limitations about EXTI (see here):
EXTI is not built into Input itself because it needs to take ownership of the corresponding EXTI channel, which is a limited resource.
Pins PA5, PB5, PC5… all use EXTI channel 5, so you can’t use EXTI on, say, PA5 and PC5 at the same time.
There are a few more things that you need to do:
exti feature for your embassy-stm32 dependency in Cargo.tomlkeyboard.toml, you are all set. The [rmk_keyboard] macro will automatically check your Cargo.toml and handle it for you.ExtiInput for your input pins: