Initial commit

This commit is contained in:
Julian Appel 2026-03-29 14:47:13 +02:00
commit b49984b9c0
32 changed files with 2394 additions and 0 deletions

22
src/hal/matrix.h Normal file
View file

@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
// 5×5 button matrix
// COL_0 × ROW_03 = encoder SW buttons
// COL_14 × ROW_04 = 20 Cherry MX buttons
// COL_0 × ROW_4 = not connected
#define MATRIX_COLS 5
#define MATRIX_ROWS 5
#define MATRIX_KEYS 25 // col * MATRIX_ROWS + row
// Callback: key index (024), pressed = true / released = false
typedef void (*matrix_cb_t)(uint8_t key, bool pressed);
void matrix_init(matrix_cb_t cb);
void matrix_scan();
// Helper: key index from logical position
inline uint8_t matrix_key(uint8_t col, uint8_t row) {
return col * MATRIX_ROWS + row;
}