reform

MNT Reform: Open Source Portable Computer
Log (Feed) | Files | Refs (Tags) | README

commit 6049d22586eb5f42c431a3e8fe2da0a6f12fa22f
parent 1c2a274a9ff3fd8d0a881ab6781ecb34f8821505
Author: Lukas F. Hartmann <lukas@mntre.com>
Date:   Fri, 12 Jan 2024 16:30:33 +0100

keyboard fw: add anri's variant

Diffstat:
Mreform2-keyboard-fw/keyboard.c | 4++++
Areform2-keyboard-fw/matrix_anri.h | 175+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 179 insertions(+), 0 deletions(-)

diff --git a/reform2-keyboard-fw/keyboard.c b/reform2-keyboard-fw/keyboard.c @@ -25,6 +25,9 @@ #include "remote.h" #include "scancodes.h" +#ifdef KBD_VARIANT_ANRI +#include "matrix_anri.h" +#else #ifdef KBD_VARIANT_3 #include "matrix_3.h" #else @@ -34,6 +37,7 @@ #include "matrix.h" #endif #endif +#endif /** Buffer to hold the previously generated Keyboard HID report, for comparison purposes inside the HID class driver. */ static uint8_t PrevKeyboardHIDReportBuffer[sizeof(USB_KeyboardReport_Data_t)]; diff --git a/reform2-keyboard-fw/matrix_anri.h b/reform2-keyboard-fw/matrix_anri.h @@ -0,0 +1,175 @@ +/* + MNT Reform 2.0 Keyboard Firmware + See keyboard.c for Copyright + SPDX-License-Identifier: MIT +*/ + +#include "keyboard.h" + +// Top row, left to right +#define MATRIX_ANRI_DEFAULT_ROW_1 \ + KEY_ESCAPE,\ + KEY_F1,\ + KEY_F2,\ + KEY_F3,\ + KEY_F4,\ + KEY_F5,\ + KEY_F6,\ + KEY_F7,\ + KEY_F8,\ + KEY_F9,\ + KEY_F10,\ + KEY_F11,\ + KEY_F12,\ + KEY_DELETE + +// Second row +#define MATRIX_ANRI_DEFAULT_ROW_2 \ + KEY_GRAVE_ACCENT_AND_TILDE,\ + KEY_1,\ + KEY_2,\ + KEY_3,\ + KEY_4,\ + KEY_5,\ + KEY_6,\ + KEY_7,\ + KEY_8,\ + KEY_9,\ + KEY_0,\ + KEY_MINUS_AND_UNDERSCORE,\ + KEY_EQUAL_AND_PLUS,\ + KEY_BACKSPACE + +// Third row +#define MATRIX_ANRI_DEFAULT_ROW_3 \ + KEY_TAB,\ + KEY_Q,\ + KEY_W,\ + KEY_E,\ + KEY_R,\ + KEY_T,\ + KEY_Y,\ + KEY_U,\ + KEY_I,\ + KEY_O,\ + KEY_P,\ + KEY_OPENING_BRACKET_AND_OPENING_BRACE,\ + KEY_CLOSING_BRACKET_AND_CLOSING_BRACE,\ + KEY_CIRCLE + +// Fourth row +#define MATRIX_ANRI_DEFAULT_ROW_4 \ + HID_KEYBOARD_SC_CAPS_LOCK,\ + KEY_A,\ + KEY_S,\ + KEY_D,\ + KEY_F,\ + KEY_G,\ + KEY_H,\ + KEY_J,\ + KEY_K,\ + KEY_L,\ + KEY_SEMICOLON_AND_COLON,\ + KEY_APOSTROPHE_AND_QUOTE,\ + KEY_ENTER,\ + KEY_ENTER + +// Fifth row +#define MATRIX_ANRI_DEFAULT_ROW_5 \ + HID_KEYBOARD_SC_LEFT_SHIFT,\ + KEY_BACKSLASH_AND_PIPE,\ + KEY_Z,\ + KEY_X,\ + KEY_C,\ + KEY_V,\ + KEY_B,\ + KEY_N,\ + KEY_M,\ + HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN,\ + HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN,\ + KEY_SLASH_AND_QUESTION_MARK,\ + HID_KEYBOARD_SC_UP_ARROW,\ + HID_KEYBOARD_SC_RIGHT_SHIFT + +// Sixth row +#define MATRIX_ANRI_DEFAULT_ROW_6 \ + HID_KEYBOARD_SC_LEFT_CONTROL,\ + HID_KEYBOARD_SC_LEFT_GUI,\ + HID_KEYBOARD_SC_LEFT_ALT,\ + KEY_SPACE,\ + KEY_SPACE,\ + KEY_SPACE,\ + KEY_SPACE,\ + HID_KEYBOARD_SC_RIGHT_ALT,\ + HID_KEYBOARD_SC_EXECUTE,\ + HID_KEYBOARD_SC_LEFT_ARROW,\ + HID_KEYBOARD_SC_DOWN_ARROW,\ + HID_KEYBOARD_SC_RIGHT_ARROW + +// Every line of `matrix` is a row of the keyboard, starting from the top. +// Check keyboard.h for the definitions of the default rows. +uint8_t matrix[KBD_MATRIX_SZ] = { + MATRIX_ANRI_DEFAULT_ROW_1, + MATRIX_ANRI_DEFAULT_ROW_2, + MATRIX_ANRI_DEFAULT_ROW_3, + MATRIX_ANRI_DEFAULT_ROW_4, + MATRIX_ANRI_DEFAULT_ROW_5, + MATRIX_ANRI_DEFAULT_ROW_6, + + // Marker for layout editor (FIXME) + KBD_EDITOR_MARKER +}; + +// When holding down HYPER +uint8_t matrix_fn[KBD_MATRIX_SZ] = { + // Media keys on Hyper + F7-F12 + KEY_ESCAPE, + HID_KEYBOARD_SC_MEDIA_BRIGHTNESS_DOWN, + HID_KEYBOARD_SC_MEDIA_BRIGHTNESS_UP, + KEY_F3, + KEY_F4, + HID_KEYBOARD_SC_PRINT_SCREEN, + KEY_F6, + HID_KEYBOARD_SC_MEDIA_PREVIOUS_TRACK, + HID_KEYBOARD_SC_MEDIA_PLAY, + HID_KEYBOARD_SC_MEDIA_NEXT_TRACK, + HID_KEYBOARD_SC_MEDIA_MUTE, + HID_KEYBOARD_SC_MEDIA_VOLUME_DOWN, + HID_KEYBOARD_SC_MEDIA_VOLUME_UP, + KEY_DELETE, + + MATRIX_ANRI_DEFAULT_ROW_2, + MATRIX_ANRI_DEFAULT_ROW_3, + MATRIX_ANRI_DEFAULT_ROW_4, + + HID_KEYBOARD_SC_LEFT_SHIFT, + HID_KEYBOARD_SC_BACKSLASH_AND_PIPE, + KEY_Z, + KEY_X, + KEY_C, + KEY_V, + KEY_B, + KEY_N, + KEY_M, + HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN, + HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN, + KEY_SLASH_AND_QUESTION_MARK, + HID_KEYBOARD_SC_PAGE_UP, + HID_KEYBOARD_SC_RIGHT_SHIFT, + + HID_KEYBOARD_SC_LEFT_CONTROL, + HID_KEYBOARD_SC_LEFT_GUI, + HID_KEYBOARD_SC_LEFT_ALT, + KEY_SPACE, + KEY_SPACE, + KEY_SPACE, + KEY_SPACE, + HID_KEYBOARD_SC_RIGHT_ALT, + HID_KEYBOARD_SC_EXECUTE, + HID_KEYBOARD_SC_HOME, + HID_KEYBOARD_SC_PAGE_DOWN, + HID_KEYBOARD_SC_END +}; + +// Second layer (toggled by HYPER+CIRCLE) +#define matrix_fn_toggled matrix_fn