Merge remote-tracking branch 'tmk/master'

This commit is contained in:
Mark Sikora 2023-02-05 14:23:40 -05:00
commit d65fbd54b5
11 changed files with 5065 additions and 4896 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -48,6 +48,7 @@ static void register_key(uint8_t key);
void matrix_init(void)
{
debug_enable = true;
m0110_init();
// initialize matrix state: all keys off
for (uint8_t i=0; i < MATRIX_ROWS; i++) _matrix0[i] = 0x00;
@ -61,16 +62,34 @@ void matrix_init(void)
return;
}
static bool m0110_intl = false;
static uint8_t m0110_model = 0xFF;
static uint8_t get_m0110_model(void)
{
m0110_send(M0110_MODEL);
return m0110_recv();
}
uint8_t matrix_scan(void)
{
uint8_t key;
if (m0110_model == 0xFF) {
m0110_model = get_m0110_model();
if (m0110_model == 0xFF) {
return 0;
}
xprintf("model: %02X\n", m0110_model);
// TODO: detect international M0110 and config m0110_intl
}
is_modified = false;
key = m0110_recv_key();
if (key == M0110_NULL) {
return 0;
} else if (key == M0110_ERROR) {
m0110_model = 0xFF;
return 0;
} else {
is_modified = true;
@ -89,9 +108,37 @@ uint8_t matrix_get_row(uint8_t row)
return matrix[row];
}
static uint8_t intl_key(uint8_t key)
{
switch (key) {
// Intl code -> TMK matrix
case 0x06: return 0x0A; // Non-US bslash
case 0x07: return 0x06; // Z
case 0x08: return 0x07; // X
case 0x09: return 0x08; // C
case 0x0B: return 0x09; // V
case 0x2D: return 0x0B; // B
case 0x2E: return 0x2D; // N
case 0x2B: return 0x2E; // M
case 0x2F: return 0x2B; // ,
case 0x2C: return 0x2F; // .
case 0x0A: return 0x2C; // /
case 0x34: return 0x31; // Space
case 0x31: return 0x34; // RGUI
case 0x24: return 0x2A; // bslash
case 0x2A: return 0x24; // Enter
}
return key;
}
inline
static void register_key(uint8_t key)
{
if (m0110_intl) {
key = (key & 0x80) | intl_key(key & 0x7F);
dprintf("<%02X> ", key);
}
if (key&0x80) {
matrix[ROW(key)] &= ~(1<<COL(key));
} else {

View file

@ -89,7 +89,7 @@ const uint8_t PROGMEM unimap_trans[MATRIX_ROWS][MATRIX_COLS] = {
{
UNIMAP_C, // 0x08
UNIMAP_V, // 0x09
UNIMAP_NO, // 0x0A
UNIMAP_NONUS_BSLASH, // 0x0A
UNIMAP_B, // 0x0B
#endif
UNIMAP_Q, // 0x0C

View file

@ -1,5 +1,7 @@
TARGET = usb_usb_8mhz
F_CPU = 8000000
F_USB = 16000000
UNIMAP_ENABLE = yes
KEYMAP_SECTION_ENABLE = yes
NO_DEBUG = yes
include Makefile

View file

@ -0,0 +1,27 @@
TARGET = usb_usb_8mhz_debug
F_CPU = 8000000
F_USB = 16000000
#UNIMAP_ENABLE = yes
#KEYMAP_SECTION_ENABLE = yes
# LUFA debug print
# This may prevent USB enumeration and keyboard init
#TMK_LUFA_DEBUG = yes
# Select one of outputs for debug print
#TMK_LUFA_DEBUG_UART = yes
#TMK_LUFA_DEBUG_SUART = yes
# USB_Host_Shield_2.0 debug print
# This may prevent USB enumeration and keyboard init
OPT_DEFS += -DDEBUG_USB_HOST
CONSOLE_ENABLE = yes
MOUSEKEY_ENABLE = no
EXTRAKEY_ENABLE = no
COMMAND_ENABLE = no
OPT_DEFS += -DNO_ACTION_TAPPING
OPT_DEFS += -DNO_ACTION_LAYER
OPT_DEFS += -DNO_ACTION_MACRO
include Makefile

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -220,10 +220,10 @@ void matrix_print(void) {
void led_set(uint8_t usb_led)
{
if (kbd1.isReady()) kbd1.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd2.isReady()) kbd2.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd3.isReady()) kbd3.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd4.isReady()) kbd4.SetReport(0, 0, 2, 0, 1, &usb_led);
if (kbd1.isReady()) kbd1.SetLed(&usb_led);
if (kbd2.isReady()) kbd2.SetLed(&usb_led);
if (kbd3.isReady()) kbd3.SetLed(&usb_led);
if (kbd4.isReady()) kbd4.SetLed(&usb_led);
}
// We need to keep doing UHS2 USB::Task() to initialize keyboard

View file

@ -495,9 +495,15 @@ RAW CODE:
MODEL NUMBER:
M0110: 0x09 00001001 : model number 4 (100)
M0110A: 0x0B 00001011 : model number 5 (101)
M0110 & M0120: ???
M0110(GS536): 0x03 00000011 : model number 1 (001)
M0110(GS624): 0x09 00001001 : model number 4 (100)
M0110A(M923): 0x0B 00001011 : model number 5 (101)
M0110AJ(M839): 0x0B 00001011 : model number 5 (101)
M0110AJ(A615): 0x0B 00001011 : model number 5 (101)
M0120(BCG9GRM0120): 0x11 00010001
M0120 & M0110(G536): 0x13 00010011
M0120 & M0110(G624): 0x19 00011001
M0120 & M0110A(M923): 0x1B 00011011
Scan Code

@ -1 +1 @@
Subproject commit 35606b2a9bb1e02e1adac14a8484c32d7a5e9f1c
Subproject commit a98e6f720683b2514cf4dfe0f04a65dfdcc508e1