Low Power
RMK supports low-power mode by utilizing embassy's low-power feature and the Wait trait in embedded-hal-async.
Usage
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:
- Enable the
extifeature for yourembassy-stm32dependency inCargo.toml - Ensure that your input pins don't share the same EXTI channel
- For configuration:
- If you're using
keyboard.toml, you are all set. The[rmk_keyboard]macro will automatically check yourCargo.tomland handle it for you. - If you're using Rust code, you'll need to use
ExtiInputfor your input pins:
- If you're using
External VCC
Some boards, such as the nice!nano have an external 3.3V regulator that can be used to power the LEDs. If not used, the regulator can be disabled by pulling P0_13 low to safe power.
In the case of the nice!nano, this can be done by adding the following line to main.rs
or the following snippet to your keyboard.toml: