From 0dca9a1f62aaa85340b2605a9ae4ea7eb84a5c62 Mon Sep 17 00:00:00 2001 From: Albert Y <76888457+filterpaper@users.noreply.github.com> Date: Sat, 24 Sep 2022 23:44:50 +0800 Subject: [PATCH] [Keyboard] Convert Cradio config to data driven model (#18412) --- keyboards/cradio/config.h | 55 ++---------------- keyboards/cradio/cradio.c | 27 ++------- keyboards/cradio/cradio.h | 52 ----------------- keyboards/cradio/info.json | 116 ++++++++++++++++++++++++------------- keyboards/cradio/rules.mk | 22 +------ 5 files changed, 87 insertions(+), 185 deletions(-) delete mode 100644 keyboards/cradio/cradio.h diff --git a/keyboards/cradio/config.h b/keyboards/cradio/config.h index 90a54015901..e4ecd295396 100644 --- a/keyboards/cradio/config.h +++ b/keyboards/cradio/config.h @@ -1,54 +1,9 @@ -/* Copyright 2018-2021 - * ENDO Katsuhiro - * David Philip Barr <@davidphilipbarr> - * Pierre Chevalier - * - * 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 . - */ +// Copyright 2018-2021 +// ENDO Katsuhiro +// David Philip Barr <@davidphilipbarr> +// Pierre Chevalier +// 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 */ diff --git a/keyboards/cradio/cradio.c b/keyboards/cradio/cradio.c index 76c64cbb8cc..99a69ff7559 100644 --- a/keyboards/cradio/cradio.c +++ b/keyboards/cradio/cradio.c @@ -1,24 +1,10 @@ -/* Copyright 2018-2021 - * ENDO Katsuhiro - * David Philip Barr <@davidphilipbarr> - * Pierre Chevalier - * @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 . - */ +// Copyright 2018-2021 +// ENDO Katsuhiro +// David Philip Barr <@davidphilipbarr> +// Pierre Chevalier +// 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 - diff --git a/keyboards/cradio/cradio.h b/keyboards/cradio/cradio.h deleted file mode 100644 index f013386bf83..00000000000 --- a/keyboards/cradio/cradio.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2018-2021 - * ENDO Katsuhiro - * David Philip Barr <@davidphilipbarr> - * Pierre Chevalier - * - * 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 . - */ - -#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 - diff --git a/keyboards/cradio/info.json b/keyboards/cradio/info.json index 9a99ee7c3ec..0b9cbb1fed2 100644 --- a/keyboards/cradio/info.json +++ b/keyboards/cradio/info.json @@ -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 } ] } } diff --git a/keyboards/cradio/rules.mk b/keyboards/cradio/rules.mk index 1e4940ca7d1..6e7633bfe01 100644 --- a/keyboards/cradio/rules.mk +++ b/keyboards/cradio/rules.mk @@ -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