ledmap¶
Define a static, per-key, RGB matrix design.
It works similar to keymaps, mapping a color to each key and allowing transparency.
Your configuration would end up looking like:
#include "elpekenin/ledmap.h"
const ledmap_color_t PROGMEM ledmap[][MATRIX_ROWS][MATRIX_COLS] = {
[QWERTY] = LAYOUT(
RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED,
RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED,
RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED,
RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED, RED,
RED, RED, RED, RED, BLACK, WHITE, RED, TRNS, RED, RED
),
[FN] = LAYOUT(
TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS, TRNS,
CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN, CYAN,
BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE, BLUE,
ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE, ROSE,
WHITE,WHITE,BLACK,TRNS, BLACK, BLACK, RED, TRNS, WHITE,WHITE
),
};
Warning
- Due to reusing
LAYOUT
macro to define the colors, implementation is not too flexible. Assumes existence of a LED under every key.
Does not support assigning colors to LEDs that aren’t under a key (eg: indicators or underglow)
It also hasn’t been exhaustively tested, there might be some problems.
- Result(rgb_t, int) rgb_at_ledmap_location(uint8_t layer, uint8_t row, uint8_t col)[source]
Retrieve the color assigned to a key in the ledmap (transparency gets applied).
- Parameters:
layer – Where to look at.
row – Electrical position of the key in the matrix.
col – Electrical position of the key in the matrix.
rgb – Where the value will be written.
- Returns:
- Result of the operation.
Ok(rgb): Color was retrieved. Use
unwrap()
to get the value.- Err(val): Something went wrong. Use
unwrap_err()
to get the value. Possible values: -EINVAL
: Some input was wrong.-ENODATA
:TRNS
on layer 0 -> Dont overwrite the existing effect.-ENOTSUP
: Unknown value read (not a value inledmap_color_t
).
- Err(val): Something went wrong. Use