[Keyboard] Convert Cradio config to data driven model (#18412)

master
Albert Y 2022-09-24 23:44:50 +08:00 committed by GitHub
parent fa1388a42e
commit 0dca9a1f62
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 87 additions and 185 deletions

View File

@ -1,54 +1,9 @@
/* Copyright 2018-2021
* ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
* David Philip Barr <@davidphilipbarr>
* Pierre Chevalier <pierrechevalier83@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Copyright 2018-2021
// ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
// David Philip Barr <@davidphilipbarr>
// Pierre Chevalier <pierrechevalier83@gmail.com>
// SPDX-License-Identifier: GPL-2.0+
#pragma once
#include "config_common.h"
/* key matrix size */
#define MATRIX_ROWS 8
#define MATRIX_COLS 5
#define DIRECT_PINS { \
{ E6, F7, F6, F5, F4 }, \
{ B1, B3, B2, B6, D3 }, \
{ D1, D0, D4, C6, D7 }, \
{ B4, B5, NO_PIN, NO_PIN, NO_PIN } \
}
#define DIRECT_PINS_RIGHT { \
{ F4, F5, F6, F7, E6 }, \
{ D3, B6, B2, B3, B1 }, \
{ D7, C6, D4, D0, D1 }, \
{ B5, B4, NO_PIN, NO_PIN, NO_PIN } \
}
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* Serial settings */
#define USE_SERIAL
/* serial.c configuration for split keyboard */
#define SOFT_SERIAL_PIN D2
/* Top left key on left half */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0
/* Top right key on right half */

View File

@ -1,24 +1,10 @@
/* Copyright 2018-2021
* ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
* David Philip Barr <@davidphilipbarr>
* Pierre Chevalier <pierrechevalier83@gmail.com>
* @filterpaper
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Copyright 2018-2021
// ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
// David Philip Barr <@davidphilipbarr>
// Pierre Chevalier <pierrechevalier83@gmail.com>
// SPDX-License-Identifier: GPL-2.0+
#include "cradio.h"
#include "quantum.h"
#ifdef SWAP_HANDS_ENABLE
__attribute__ ((weak))
@ -35,4 +21,3 @@ const keypos_t PROGMEM hand_swap_config[MATRIX_ROWS][MATRIX_COLS] = {
{{1, 3}, {0, 3}, {2, 3}, {3, 3}, {4, 3}}
};
#endif

View File

@ -1,52 +0,0 @@
/* Copyright 2018-2021
* ENDO Katsuhiro <ka2hiro@curlybracket.co.jp>
* David Philip Barr <@davidphilipbarr>
* Pierre Chevalier <pierrechevalier83@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
// readability
#define ___ KC_NO
#define LAYOUT_split_3x5_2( \
L01, L02, L03, L04, L05, R01, R02, R03, R04, R05, \
L06, L07, L08, L09, L10, R06, R07, R08, R09, R10, \
L11, L12, L13, L14, L15, R11, R12, R13, R14, R15, \
L16, L17, R16, R17 \
) \
{ \
{ L01, L02, L03, L04, L05 }, \
{ L06, L07, L08, L09, L10 }, \
{ L11, L12, L13, L14, L15 }, \
{ L16, L17, ___, ___, ___ }, \
{ R01, R02, R03, R04, R05 }, \
{ R06, R07, R08, R09, R10 }, \
{ R11, R12, R13, R14, R15 }, \
{ R16, R17, ___, ___, ___ } \
}
#define LAYOUT LAYOUT_split_3x5_2

View File

@ -8,50 +8,84 @@
"pid": "0x3988",
"device_version": "0.0.1"
},
"processor": "atmega32u4",
"protocol": "atmel-dfu",
"debounce": 5,
"features": {
"bootmagic": true,
"command": false,
"console": false,
"extrakey": true,
"mousekey": true,
"nkro": false,
"unicode": true
},
"matrix_pins": {
"direct": [
["E6", "F7", "F6", "F5", "F4"],
["B1", "B3", "B2", "B6", "D3"],
["D1", "D0", "D4", "C6", "D7"],
["B4", "B5", null, null, null]
]
},
"split": {
"enabled": true,
"matrix_pins": {
"right": {
"direct": [
["F4", "F5", "F6", "F7", "E6"],
["D3", "B6", "B2", "B3", "B1"],
["D7", "C6", "D4", "D0", "D1"],
["B5", "B4", null, null, null]
]
}
},
"soft_serial_pin": "D2",
"transport": {
"protocol": "serial"
}
},
"community_layouts": ["split_3x5_2"],
"layout_aliases": {
"LAYOUT": "LAYOUT_split_3x5_2"
},
"layouts": {
"LAYOUT_split_3x5_2": {
"layout": [
{"x": 0, "y": 1.27},
{"x": 1, "y": 0.31},
{"x": 2, "y": 0},
{"x": 3, "y": 0.28},
{"x": 4, "y": 0.42},
{"x": 8, "y": 0.42},
{"x": 9, "y": 0.28},
{"x": 10, "y": 0},
{"x": 11, "y": 0.31},
{"x": 12, "y": 1.27},
{"x": 0, "y": 2.27},
{"x": 1, "y": 1.31},
{"x": 2, "y": 1},
{"x": 3, "y": 1.28},
{"x": 4, "y": 1.42},
{"x": 8, "y": 1.42},
{"x": 9, "y": 1.28},
{"x": 10, "y": 1},
{"x": 11, "y": 1.31},
{"x": 12, "y": 2.27},
{"x": 0, "y": 3.27},
{"x": 1, "y": 2.31},
{"x": 2, "y": 2},
{"x": 3, "y": 2.28},
{"x": 4, "y": 2.42},
{"x": 8, "y": 2.42},
{"x": 9, "y": 2.28},
{"x": 10, "y": 2},
{"x": 11, "y": 2.31},
{"x": 12, "y": 3.27},
{"x": 4, "y": 3.9},
{"x": 5, "y": 3.7},
{"x": 7, "y": 3.7},
{"x": 8, "y": 3.9}
{ "label": "L01", "matrix": [0, 0], "w": 1, "x": 0, "y": 1.27 },
{ "label": "L02", "matrix": [0, 1], "w": 1, "x": 1, "y": 0.31 },
{ "label": "L03", "matrix": [0, 2], "w": 1, "x": 2, "y": 0 },
{ "label": "L04", "matrix": [0, 3], "w": 1, "x": 3, "y": 0.28 },
{ "label": "L05", "matrix": [0, 4], "w": 1, "x": 4, "y": 0.42 },
{ "label": "L06", "matrix": [1, 0], "w": 1, "x": 0, "y": 2.27 },
{ "label": "L07", "matrix": [1, 1], "w": 1, "x": 1, "y": 1.31 },
{ "label": "L08", "matrix": [1, 2], "w": 1, "x": 2, "y": 1 },
{ "label": "L09", "matrix": [1, 3], "w": 1, "x": 3, "y": 1.28 },
{ "label": "L10", "matrix": [1, 4], "w": 1, "x": 4, "y": 1.42 },
{ "label": "L11", "matrix": [2, 0], "w": 1, "x": 0, "y": 3.27 },
{ "label": "L12", "matrix": [2, 1], "w": 1, "x": 1, "y": 2.31 },
{ "label": "L13", "matrix": [2, 2], "w": 1, "x": 2, "y": 2 },
{ "label": "L14", "matrix": [2, 3], "w": 1, "x": 3, "y": 2.28 },
{ "label": "L15", "matrix": [2, 4], "w": 1, "x": 4, "y": 2.42 },
{ "label": "L16", "matrix": [3, 0], "w": 1, "x": 4, "y": 3.9 },
{ "label": "L17", "matrix": [3, 1], "w": 1, "x": 5, "y": 3.7 },
{ "label": "R01", "matrix": [4, 0], "w": 1, "x": 8, "y": 0.42 },
{ "label": "R02", "matrix": [4, 1], "w": 1, "x": 9, "y": 0.28 },
{ "label": "R03", "matrix": [4, 2], "w": 1, "x": 10, "y": 0 },
{ "label": "R04", "matrix": [4, 3], "w": 1, "x": 11, "y": 0.31 },
{ "label": "R05", "matrix": [4, 4], "w": 1, "x": 12, "y": 1.27 },
{ "label": "R06", "matrix": [5, 0], "w": 1, "x": 8, "y": 1.42 },
{ "label": "R07", "matrix": [5, 1], "w": 1, "x": 9, "y": 1.28 },
{ "label": "R08", "matrix": [5, 2], "w": 1, "x": 10, "y": 1 },
{ "label": "R09", "matrix": [5, 3], "w": 1, "x": 11, "y": 1.31 },
{ "label": "R10", "matrix": [5, 4], "w": 1, "x": 12, "y": 2.27 },
{ "label": "R11", "matrix": [6, 0], "w": 1, "x": 8, "y": 2.42 },
{ "label": "R12", "matrix": [6, 1], "w": 1, "x": 9, "y": 2.28 },
{ "label": "R13", "matrix": [6, 2], "w": 1, "x": 10, "y": 2 },
{ "label": "R14", "matrix": [6, 3], "w": 1, "x": 11, "y": 2.31 },
{ "label": "R15", "matrix": [6, 4], "w": 1, "x": 12, "y": 3.27 },
{ "label": "R16", "matrix": [7, 0], "w": 1, "x": 7, "y": 3.7 },
{ "label": "R17", "matrix": [7, 1], "w": 1, "x": 8, "y": 3.9 }
]
}
}

View File

@ -1,21 +1 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
NKRO_ENABLE = no # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
UNICODE_ENABLE = yes # Unicode
AUDIO_ENABLE = no # Audio output
SPLIT_KEYBOARD = yes # Use shared split_common code
LAYOUTS = split_3x5_2
# This file intentionally left blank