Commit 117d5b00 authored by Nils K's avatar Nils K

new variant KBD_VARIANT_QWERTZ_TRADITIONAL

parent f22040e3
......@@ -40,9 +40,14 @@
#include "scancodes.h"
#include <stdlib.h>
// Firmware name and version
// Max. 21 char. : 123456789012345678901
#define KBD_FW_REV "R1 20210315"
// Firmware type
//#define KBD_VARIANT_STANDALONE
#define KBD_VARIANT_QWERTY_US
//#define KBD_VARIANT_QWERTZ_TRADITIONAL
/** 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)];
......@@ -73,18 +78,111 @@ USB_ClassInfo_HID_Device_t Keyboard_HID_Interface =
#define set_input(portdir,pin) portdir &= ~(1<<pin)
#define set_output(portdir,pin) portdir |= (1<<pin)
// Keyboard keys and their respective constants used in LUFA can be found in
// lufa-master/LUFA/Drivers/USB/Class/Common/HIDClassCommon.h
uint8_t matrix[15*6] = {
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, HID_KEYBOARD_SC_EXSEL, HID_KEYBOARD_SC_EXSEL,
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, 0,
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_BACKSLASH_AND_PIPE, 0,
HID_KEYBOARD_SC_LEFT_CONTROL, HID_KEYBOARD_SC_APPLICATION, 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, 0,
HID_KEYBOARD_SC_LEFT_SHIFT, HID_KEYBOARD_SC_NON_US_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, 0,
HID_KEYBOARD_SC_RIGHT_GUI, HID_KEYBOARD_SC_LEFT_GUI, HID_KEYBOARD_SC_RIGHT_CONTROL, KEY_SPACE, HID_KEYBOARD_SC_LEFT_ALT, HID_KEYBOARD_SC_RIGHT_ALT, KEY_SPACE, HID_KEYBOARD_SC_PAGE_UP, HID_KEYBOARD_SC_PAGE_DOWN, HID_KEYBOARD_SC_LEFT_ARROW, HID_KEYBOARD_SC_DOWN_ARROW, HID_KEYBOARD_SC_RIGHT_ARROW, 0,0,0
// row 1 (first) / 0-14
// key, matrix id
KEY_ESCAPE, // 0
KEY_F1, // 1
KEY_F2, // 2
KEY_F3, // 3
KEY_F4, // 4
KEY_F5, // 5
KEY_F6, // 6
KEY_F7, // 6
KEY_F8, // 8
KEY_F9, // 9
KEY_F10, // 10
KEY_F11, // 11
KEY_F12, // 12
HID_KEYBOARD_SC_EXSEL, // 13
0, // 14
// row 2 / 15 - 29
KEY_GRAVE_ACCENT_AND_TILDE, // 15
KEY_1, // 16
KEY_2, // 17
KEY_3, // 18
KEY_4, // 19
KEY_5, // 20
KEY_6, // 21
KEY_7, // 22
KEY_8, // 23
KEY_9, // 24
KEY_0, // 25
KEY_MINUS_AND_UNDERSCORE, // 26
KEY_EQUAL_AND_PLUS, // 27
KEY_BACKSPACE, // 28
0, // 29
// row 3 / 30 - 44
KEY_TAB, // 30
KEY_Q, // 31
KEY_W, // 32
KEY_E, // 33
KEY_R, // 34
KEY_T, // 35
KEY_Y, // 36
KEY_U, // 37
KEY_I, // 38
KEY_O, // 39
KEY_P, // 40
KEY_OPENING_BRACKET_AND_OPENING_BRACE, // 41
KEY_CLOSING_BRACKET_AND_CLOSING_BRACE, // 42
KEY_BACKSLASH_AND_PIPE, // 43
0, // 44
// row 4 / 45 - 59
HID_KEYBOARD_SC_LEFT_CONTROL, // 45
HID_KEYBOARD_SC_APPLICATION, // 46
KEY_A, // 47
KEY_S, // 48
KEY_D, // 49
KEY_F, // 50
KEY_G, // 51
KEY_H, // 52
KEY_J, // 53
KEY_K, // 54
KEY_L, // 55
KEY_SEMICOLON_AND_COLON, // 56
KEY_APOSTROPHE_AND_QUOTE, // 57
KEY_ENTER, // 58
0, // 59
// row 5 / 60 - 74
HID_KEYBOARD_SC_LEFT_SHIFT, // 60
HID_KEYBOARD_SC_NON_US_BACKSLASH_AND_PIPE, // 61 : KBD_VARIANT_QWERTY_US=KEY_DELETE
KEY_Z, // 62
KEY_X, // 63
KEY_C, // 64
KEY_V, // 65
KEY_B, // 66
KEY_N, // 67
KEY_M, // 68
HID_KEYBOARD_SC_COMMA_AND_LESS_THAN_SIGN, // 69
HID_KEYBOARD_SC_DOT_AND_GREATER_THAN_SIGN, // 70
KEY_SLASH_AND_QUESTION_MARK, // 71
HID_KEYBOARD_SC_UP_ARROW, // 72
HID_KEYBOARD_SC_RIGHT_SHIFT, // 73
0, // 74
// row 6 (last) / 75 - 90
HID_KEYBOARD_SC_RIGHT_GUI, // 75
HID_KEYBOARD_SC_LEFT_GUI, // 76
HID_KEYBOARD_SC_RIGHT_CONTROL, // 77
KEY_SPACE, // 78
HID_KEYBOARD_SC_LEFT_ALT, // 79
HID_KEYBOARD_SC_RIGHT_ALT, // 80
KEY_SPACE, // 81
HID_KEYBOARD_SC_PAGE_UP, // 82
HID_KEYBOARD_SC_PAGE_DOWN, // 83
HID_KEYBOARD_SC_LEFT_ARROW, // 84
HID_KEYBOARD_SC_DOWN_ARROW, // 85
HID_KEYBOARD_SC_RIGHT_ARROW, // 86
0, // 87
0, // 89
0 // 90
};
uint8_t matrix_debounce[15*6];
......@@ -741,9 +839,23 @@ void process_alerts(void) {
int main(void)
{
#ifdef KBD_VARIANT_QWERTY_US
matrix[15*4+1]=KEY_DELETE;
#endif
// Overwrite default matrix
// QWERTY US layout with DEL key
#ifdef KBD_VARIANT_QWERTY_US
matrix[61]=KEY_DELETE;
#endif
// QWERTZ layout more traditional
#ifdef KBD_VARIANT_QWERTZ_TRADITIONAL
matrix[13]=HID_KEYBOARD_SC_DELETE;
matrix[45]=HID_KEYBOARD_SC_EXSEL;
matrix[46]=HID_KEYBOARD_SC_PAGE_DOWN;
matrix[75]=HID_KEYBOARD_SC_LEFT_CONTROL;
matrix[77]=HID_KEYBOARD_SC_LEFT_ALT;
matrix[79]=KEY_SPACE;
matrix[80]=KEY_SPACE;
matrix[82]=HID_KEYBOARD_SC_RIGHT_ALT;
matrix[83]=HID_KEYBOARD_SC_RIGHT_CONTROL;
#endif
SetupHardware();
GlobalInterruptEnable();
......
# MNT Reform Keyboard
## Parts
* [Kailh Choc Brown](http://www.kailh.com/en/Products/Ks/CS/320.html) tactile (non-clicky) keyswitches
* Keycap for Kailh 1.5U
* Keycap for Kailh 1U
More Details in [assembly-components.csv](assembly-components.csv).
## Requirements
Install required packages:
```
apt install binutils-avr gcc-avr avr-libc dfu-programmer
```
## Modify
Edit `Keyboard.c`:
```
vi Keyboard.c
```
Change the firmware name and version `KBD_FW_REV`.
Use an already created firmware type or create a new one. Simply comment out the others types.
* `KBD_VARIANT_STANDALONE`
* `KBD_VARIANT_QWERTY_US`
* `KBD_VARIANT_QWERTZ_TRADITIONAL` ([community post](https://community.mnt.re/t/qwertz-and-delete-key/115/4))
The standard matrix can be found relatively far up in the source code.
Individual keys are overwritten further down in the `int main(void)` function at line 840.
## Firmware
Build firmware:
```
make
```
## Prepare Hardware
Remove the keyboard frame.
Toogle DIP switch `SW84` to ON.
Press the reset button `SW83`.
## Flash
Upload new firmware as root:
```
sudo sh flash.sh
```
Warning: Do this via SSH or with a USB keyboard.
You will temporarily have no keyboard.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment