Add Fujitsu FMR60KB111

This commit is contained in:
Mikko Ahlroth 2023-07-12 21:37:47 +03:00
parent 632de46b00
commit 15568a7b37
6 changed files with 491 additions and 0 deletions

View file

@ -0,0 +1,20 @@
// Copyright 2023 Mikko Ahlroth (@Nicd)
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
/*
* Feature disable options
* These options are also useful to firmware size reduction.
*/
/* disable debug print */
//#define NO_DEBUG
/* disable print */
//#define NO_PRINT
/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT

View file

@ -0,0 +1,129 @@
{
"manufacturer": "Mikko Ahlroth",
"keyboard_name": "fujitsu/fmr60kb111",
"maintainer": "Nicd",
"bootloader": "usbasploader",
"diode_direction": "COL2ROW",
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": true
},
"matrix_pins": {
"cols": ["C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2", "C2"],
"rows": ["D1", "D1", "D1", "D1", "D1", "D1", "D1", "D1"]
},
"processor": "atmega32u4",
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"layouts": {
"LAYOUT_fullsize_jis": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 2], "x": 2, "y": 0},
{"matrix": [0, 3], "x": 3, "y": 0},
{"matrix": [0, 4], "x": 4, "y": 0},
{"matrix": [0, 5], "x": 5, "y": 0},
{"matrix": [0, 6], "x": 6.5, "y": 0},
{"matrix": [0, 7], "x": 7.5, "y": 0},
{"matrix": [0, 8], "x": 8.5, "y": 0},
{"matrix": [0, 9], "x": 9.5, "y": 0},
{"matrix": [0, 11], "x": 11, "y": 0},
{"matrix": [0, 12], "x": 12, "y": 0},
{"matrix": [0, 13], "x": 13, "y": 0},
{"matrix": [0, 14], "x": 14, "y": 0},
{"matrix": [0, 15], "x": 15.25, "y": 0},
{"matrix": [0, 16], "x": 16.25, "y": 0},
{"matrix": [0, 17], "x": 17.25, "y": 0},
{"matrix": [1, 0], "x": 0, "y": 1.25},
{"matrix": [1, 1], "x": 1, "y": 1.25},
{"matrix": [1, 2], "x": 2, "y": 1.25},
{"matrix": [1, 3], "x": 3, "y": 1.25},
{"matrix": [1, 4], "x": 4, "y": 1.25},
{"matrix": [1, 5], "x": 5, "y": 1.25},
{"matrix": [1, 6], "x": 6, "y": 1.25},
{"matrix": [1, 7], "x": 7, "y": 1.25},
{"matrix": [1, 8], "x": 8, "y": 1.25},
{"matrix": [1, 9], "x": 9, "y": 1.25},
{"matrix": [1, 10], "x": 10, "y": 1.25},
{"matrix": [1, 11], "x": 11, "y": 1.25},
{"matrix": [1, 12], "x": 12, "y": 1.25},
{"matrix": [1, 13], "x": 13, "y": 1.25},
{"matrix": [1, 14], "x": 14, "y": 1.25},
{"matrix": [1, 15], "x": 15.25, "y": 1.25},
{"matrix": [1, 16], "x": 16.25, "y": 1.25},
{"matrix": [1, 17], "x": 17.25, "y": 1.25},
{"matrix": [1, 18], "x": 18.5, "y": 1.25},
{"matrix": [2, 0], "x": 0, "y": 2.25, "w": 1.5},
{"matrix": [2, 1], "x": 1.5, "y": 2.25},
{"matrix": [2, 2], "x": 2.5, "y": 2.25},
{"matrix": [2, 3], "x": 3.5, "y": 2.25},
{"matrix": [2, 4], "x": 4.5, "y": 2.25},
{"matrix": [2, 5], "x": 5.5, "y": 2.25},
{"matrix": [2, 6], "x": 6.5, "y": 2.25},
{"matrix": [2, 7], "x": 7.5, "y": 2.25},
{"matrix": [2, 8], "x": 8.5, "y": 2.25},
{"matrix": [2, 9], "x": 9.5, "y": 2.25},
{"matrix": [2, 10], "x": 10.5, "y": 2.25},
{"matrix": [2, 11], "x": 11.5, "y": 2.25},
{"matrix": [2, 12], "x": 12.5, "y": 2.25},
{"matrix": [2, 13], "x": 13.75, "y": 2.25, "w": 1.25, "h": 2},
{"matrix": [2, 15], "x": 15.25, "y": 2.25},
{"matrix": [2, 16], "x": 16.25, "y": 2.25},
{"matrix": [2, 17], "x": 17.25, "y": 2.25},
{"matrix": [2, 18], "x": 18.5, "y": 2.25},
{"matrix": [3, 0], "x": 0, "y": 3.25, "w": 1.75},
{"matrix": [3, 1], "x": 1.75, "y": 3.25},
{"matrix": [3, 2], "x": 2.75, "y": 3.25},
{"matrix": [3, 3], "x": 3.75, "y": 3.25},
{"matrix": [3, 4], "x": 4.75, "y": 3.25},
{"matrix": [3, 5], "x": 5.75, "y": 3.25},
{"matrix": [3, 6], "x": 6.75, "y": 3.25},
{"matrix": [3, 7], "x": 7.75, "y": 3.25},
{"matrix": [3, 8], "x": 8.75, "y": 3.25},
{"matrix": [3, 9], "x": 9.75, "y": 3.25},
{"matrix": [3, 10], "x": 10.75, "y": 3.25},
{"matrix": [3, 11], "x": 11.75, "y": 3.25},
{"matrix": [3, 12], "x": 12.75, "y": 3.25},
{"matrix": [3, 18], "x": 18.5, "y": 3.25},
{"matrix": [4, 0], "x": 0, "y": 4.25, "w": 2.25},
{"matrix": [4, 2], "x": 2.25, "y": 4.25},
{"matrix": [4, 3], "x": 3.25, "y": 4.25},
{"matrix": [4, 4], "x": 4.25, "y": 4.25},
{"matrix": [4, 5], "x": 5.25, "y": 4.25},
{"matrix": [4, 6], "x": 6.25, "y": 4.25},
{"matrix": [4, 7], "x": 7.25, "y": 4.25},
{"matrix": [4, 8], "x": 8.25, "y": 4.25},
{"matrix": [4, 9], "x": 9.25, "y": 4.25},
{"matrix": [4, 10], "x": 10.25, "y": 4.25},
{"matrix": [4, 11], "x": 11.25, "y": 4.25},
{"matrix": [4, 12], "x": 12.25, "y": 4.25},
{"matrix": [4, 13], "x": 13.25, "y": 4.25, "w": 1.75},
{"matrix": [4, 16], "x": 16.25, "y": 4.25},
{"matrix": [4, 18], "x": 18.5, "y": 4.25},
{"matrix": [5, 0], "x": 0, "y": 5.25, "w": 1.25},
{"matrix": [5, 1], "x": 1.25, "y": 5.25, "w": 1.25},
{"matrix": [5, 2], "x": 2.5, "y": 5.25, "w": 1.25},
{"matrix": [5, 3], "x": 3.75, "y": 5.25, "w": 1.25},
{"matrix": [5, 5], "x": 5, "y": 5.25, "w": 3.25},
{"matrix": [5, 8], "x": 8.25, "y": 5.25, "w": 1.25},
{"matrix": [5, 9], "x": 9.5, "y": 5.25, "w": 1.25},
{"matrix": [5, 10], "x": 10.75, "y": 5.25},
{"matrix": [5, 11], "x": 11.75, "y": 5.25},
{"matrix": [5, 12], "x": 12.75, "y": 5.25},
{"matrix": [5, 13], "x": 13.75, "y": 5.25, "w": 1.25},
{"matrix": [5, 15], "x": 15.25, "y": 5.25},
{"matrix": [5, 16], "x": 16.25, "y": 5.25},
{"matrix": [5, 17], "x": 17.25, "y": 5.25},
{"matrix": [5, 18], "x": 18.5, "y": 5.25, "w": 2}
]
}
}
}

View file

@ -0,0 +1,49 @@
// Copyright 2023 QMK
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
*
* Esc F1 F2 F3 F4 F5 F6 F7 F8 F9 F10F11F12 PScScrPse
*
*
* ZHK 1 2 3 4 5 6 7 8 9 0 - ^ ¥ Bsp InsHomPgU Num / * -
*
* Tab Q W E R T Y U I O P @ [ DelEndPgD 7 8 9
* Ent +
* Eisu A S D F G H J K L ; : ] 4 5 6
*
* Shift Z X C V B N M , . / \ Shft 1 2 3
* Ent
* CtrlGUI Alt Mhen Space HenkKanaAltGUIAppCtrl 0 .
*
*/
[0] = {
{},
{},
{},
{},
{},
{},
{},
{}
}
};
void keyboard_post_init_user(void) {
// Customise these values to desired behaviour
debug_enable=true;
debug_matrix=true;
//debug_keyboard=true;
//debug_mouse=true;
}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef CONSOLE_ENABLE
uprintf("KL: kc: 0x%04X, col: %2u, row: %2u, pressed: %u, time: %5u, int: %u, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
#endif
return true;
}

View file

@ -0,0 +1,263 @@
#include "quantum.h"
#include "print.h"
/*
- A & B chooses which demux to use
- C, D & E are used for choosing column
SN54LS139AN
2G = always low (enabled)
A B -> H G F
0 0 0 1 1
0 1 1 0 1
1 0 1 1 0
1 1 1 1 1
1G = F (high disables)
D E -> K J I
0 0 0 1 1
0 1 1 0 1
1 0 1 1 0
1 1 1 1 1
SN54LS139AN feeds 215N_A (G) and 215N_B (H)
215N_A (G high disables)
G C D E -> S R Q P O N M L
0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 1 1 0 1 1 1 1 1 1
0 0 1 0 1 1 0 1 1 1 1 1
0 0 1 1 1 1 1 0 1 1 1 1
0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 1 1 1 1 1 0 1 1
0 1 1 0 1 1 1 1 1 1 0 1
0 1 1 1 1 1 1 1 1 1 1 0
1 X X X 1 1 1 1 1 1 1 1
215N_B (H high disables)
H C D E -> Ö Ä Å Z Y V U T
0 0 0 0 0 1 1 1 1 1 1 1
0 0 0 1 1 0 1 1 1 1 1 1
0 0 1 0 1 1 0 1 1 1 1 1
0 0 1 1 1 1 1 0 1 1 1 1
0 1 0 0 1 1 1 1 0 1 1 1
0 1 0 1 1 1 1 1 1 0 1 1
0 1 1 0 1 1 1 1 1 1 0 1
0 1 1 1 1 1 1 1 1 1 1 0
1 X X X 1 1 1 1 1 1 1 1
*/
// Column selection pins
#define COL_A F7
#define COL_B F6
#define COL_C F5
#define COL_D F4
#define COL_E F1
// Read pins
#define RD_A C6
#define RD_B D7
#define RD_C E6
#define RD_D B4
#define RD_E B5
#define RD_F B6
#define RD_G B7
#define RD_H D6
#define D139_START 0
#define D139_PINS 3
#define D215_A_START D139_PINS
#define D215_A_PINS 8
#define D215_B_START D215_A_START + D215_A_PINS
#define D215_B_PINS 8
enum Demux {
// SN54LS139AN
D139,
// SN74LS145N (first)
D215_A,
// SN74LS145N (second)
D215_B,
// All scanned
END
};
static uint8_t current_col[MATRIX_ROWS];
enum Demux next_demux(enum Demux current_demux) {
switch (current_demux) {
case D139: return D215_A;
case D215_A: return D215_B;
default: return END;
}
}
void select_demux(enum Demux demux) {
switch (demux) {
case D139:
writePinHigh(COL_A);
writePinLow(COL_B);
break;
case D215_A:
writePinLow(COL_A);
writePinHigh(COL_B);
break;
case D215_B:
writePinLow(COL_A);
writePinLow(COL_B);
default:
// This will never happen, trust me bro
return;
}
}
uint8_t readMatrixPin(pin_t pin) {
return (readPin(pin) == 0) ? 0 : 1;
}
void readPins(uint8_t out[]) {
out[0] = readMatrixPin(RD_A);
out[1] = readMatrixPin(RD_B) << 1;
out[2] = readMatrixPin(RD_C) << 2;
out[3] = readMatrixPin(RD_D) << 3;
out[4] = readMatrixPin(RD_E) << 4;
out[5] = readMatrixPin(RD_F) << 5;
out[6] = readMatrixPin(RD_G) << 6;
out[7] = readMatrixPin(RD_H) << 7;
}
bool readColumn(matrix_row_t current_matrix[], uint8_t col) {
bool changed = false;
readPins(current_col);
for (uint8_t r = 0; r < MATRIX_ROWS; ++r) {
uint8_t old_val = (current_matrix[r] >> col) & 0x1;
uint8_t new_val = current_col[r];
if (old_val != new_val) {
changed = true;
if (new_val == 1) {
current_matrix[r] |= (1U << col);
} else {
current_matrix[r] &= ~(1U << col);
}
}
}
return changed;
}
bool scan_d139(matrix_row_t current_matrix[]) {
bool changed = false;
for (uint8_t i = D139_START; i < D139_PINS; ++i) {
if (i == 0) {
writePinLow(COL_D);
writePinLow(COL_E);
} else if (i == 1) {
writePinLow(COL_D);
writePinHigh(COL_E);
} else {
writePinHigh(COL_D);
writePinLow(COL_E);
}
wait_us(5);
changed = readColumn(current_matrix, i) || changed;
}
return changed;
}
bool scan_d215(matrix_row_t current_matrix[], uint8_t col_start, uint8_t pins) {
bool changed = false;
for (uint8_t i = col_start; i < pins; ++i) {
uint8_t local_i = i - col_start;
if (local_i & 0x1) {
writePinHigh(COL_E);
} else {
writePinLow(COL_E);
}
if (local_i & 0x2) {
writePinHigh(COL_D);
} else {
writePinLow(COL_D);
}
if (local_i & 0x4) {
writePinHigh(COL_C);
} else {
writePinLow(COL_C);
}
wait_us(5);
changed = readColumn(current_matrix, i) || changed;
}
return changed;
}
bool scan_d215_a(matrix_row_t current_matrix[]) {
return scan_d215(current_matrix, D215_A_START, D215_A_PINS);
}
bool scan_d215_b(matrix_row_t current_matrix[]) {
return scan_d215(current_matrix, D215_B_START, D215_B_PINS);
}
bool scan_demux(matrix_row_t current_matrix[], enum Demux demux) {
switch (demux) {
case D139: return scan_d139(current_matrix);
case D215_A: return scan_d215_a(current_matrix);
case D215_B: return scan_d215_b(current_matrix);
default: return false;
}
}
void matrix_init_custom(void) {
setPinInputHigh(RD_A);
setPinInputHigh(RD_B);
setPinInputHigh(RD_C);
setPinInputHigh(RD_D);
setPinInputHigh(RD_E);
setPinInputHigh(RD_F);
setPinInputHigh(RD_G);
setPinInputHigh(RD_H);
setPinOutput(COL_A);
setPinOutput(COL_B);
setPinOutput(COL_C);
setPinOutput(COL_D);
setPinOutput(COL_E);
writePinLow(COL_A);
writePinLow(COL_B);
writePinLow(COL_C);
writePinLow(COL_D);
writePinLow(COL_E);
wait_us(20);
dprintf("Init finished");
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool matrix_has_changed = false;
enum Demux active_demux = D139;
do {
select_demux(active_demux);
matrix_has_changed = scan_demux(current_matrix, active_demux) || matrix_has_changed;
dprintf("Checking demux %d, %i", active_demux, matrix_has_changed);
active_demux = next_demux(active_demux);
} while (active_demux != END);
return matrix_has_changed;
}

View file

@ -0,0 +1,26 @@
# fujitsu/fmr60kb111
![fujitsu/fmr60kb111](imgur.com image replace me!)
_A short description of the keyboard/project_
- Keyboard Maintainer: [Mikko Ahlroth](https://gitlab.com/Nicd)
- Hardware Supported: Arduino Nano
Make example for this keyboard (after setting up your build environment):
make fujitsu/fmr60kb111:default
Flashing example for this keyboard:
make fujitsu/fmr60kb111:default:flash
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).
## Bootloader
Enter the bootloader in 3 ways:
- **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
- **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead
- **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

View file

@ -0,0 +1,4 @@
CUSTOM_MATRIX = lite
SRC += matrix.c
CONSOLE_ENABLE = yes