Initial commit
This commit is contained in:
commit
b49984b9c0
32 changed files with 2394 additions and 0 deletions
22
src/hal/matrix.h
Normal file
22
src/hal/matrix.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
// 5×5 button matrix
|
||||
// COL_0 × ROW_0–3 = encoder SW buttons
|
||||
// COL_1–4 × ROW_0–4 = 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 (0–24), 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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue