From 196074e57b39007b6f574a880d00e9cca9a7f23c Mon Sep 17 00:00:00 2001 From: Thomas Haukland Date: Tue, 22 Mar 2022 22:12:14 +0100 Subject: [PATCH] The Vonreg works with bitbanging on pin B6 --- keyboards/vonreg/config.h | 46 ++++++++ keyboards/vonreg/halconf.h | 34 ++++++ keyboards/vonreg/info.json | 69 ++++++++++++ keyboards/vonreg/keymaps/default/keymap.c | 27 +++++ keyboards/vonreg/keymaps/default/keymap.json | 106 +++++++++++++++++++ keyboards/vonreg/mcuconf.h | 32 ++++++ keyboards/vonreg/rules.mk | 4 + keyboards/vonreg/vonreg.c | 18 ++++ keyboards/vonreg/vonreg.h | 35 ++++++ platforms/chibios/drivers/serial.c | 4 +- 10 files changed, 374 insertions(+), 1 deletion(-) create mode 100644 keyboards/vonreg/config.h create mode 100644 keyboards/vonreg/halconf.h create mode 100644 keyboards/vonreg/info.json create mode 100644 keyboards/vonreg/keymaps/default/keymap.c create mode 100644 keyboards/vonreg/keymaps/default/keymap.json create mode 100644 keyboards/vonreg/mcuconf.h create mode 100644 keyboards/vonreg/rules.mk create mode 100644 keyboards/vonreg/vonreg.c create mode 100644 keyboards/vonreg/vonreg.h diff --git a/keyboards/vonreg/config.h b/keyboards/vonreg/config.h new file mode 100644 index 0000000000..46cb8e81ca --- /dev/null +++ b/keyboards/vonreg/config.h @@ -0,0 +1,46 @@ +// Copyright 2022 Tompi +// SPDX-License-Identifier: MIT + +#pragma once + +#include "config_common.h" + +/* key matrix size */ +#define MATRIX_ROWS 8 +#define MATRIX_COLS 5 + +#define DIRECT_PINS {{B12, B13, B15, B1, B0}, \ + {A15, A5, B3, A6, A7}, \ + {C13, A2, B5, B4, A8}, \ + {B9, B8, C14, NO_PIN, NO_PIN}} +#define DIRECT_PINS_RIGHT {{B0, B1, B15, B13, B12}, \ + {A7, A6, B3, A5, A15}, \ + {A8, B4, B5, A2, C13}, \ + {C14, B8, B9, NO_PIN, NO_PIN}} + + +// Full duplex WORKS... +//#define SERIAL_USART_FULL_DUPLEX // Enable full duplex operation mode. +//#define SERIAL_USART_TX_PIN B6 // USART TX pin +//#define SERIAL_USART_RX_PIN B7 // USART RX pin + +// #define EE_HANDS + +#define SOFT_SERIAL_PIN B6 // D0 or D1, D2, D3, E6 +#define SELECT_SOFT_SERIAL_SPEED 1 // or 0, 2, 3, 4, 5 + // 0: about 189kbps (Experimental only) + // 1: about 137kbps (default) + // 2: about 75kbps + // 3: about 39kbps + // 4: about 26kbps + // 5: about 20kbps + + +/* Top left key on left half */ +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 +/* Top right key on right half */ +#define BOOTMAGIC_LITE_ROW_RIGHT 4 +#define BOOTMAGIC_LITE_COLUMN_RIGHT 4 +#define DEVICE_VER 0x0001 + diff --git a/keyboards/vonreg/halconf.h b/keyboards/vonreg/halconf.h new file mode 100644 index 0000000000..cd84bf1557 --- /dev/null +++ b/keyboards/vonreg/halconf.h @@ -0,0 +1,34 @@ +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/halconf.h -r platforms/chibios/common/configs/halconf.h` + */ + +#pragma once + +//#define HAL_USE_PWM TRUE + +// #define HAL_USE_SERIAL TRUE + +#define PAL_USE_CALLBACKS TRUE +#define PAL_USE_WAIT TRUE + +//#define SERIAL_USB_BUFFERS_SIZE 256 + +#include_next + diff --git a/keyboards/vonreg/info.json b/keyboards/vonreg/info.json new file mode 100644 index 0000000000..bc813fe077 --- /dev/null +++ b/keyboards/vonreg/info.json @@ -0,0 +1,69 @@ +{ + "manufacturer": "Thomas Haukland", + "keyboard_name": "vonreg", + "maintainer": "tompi", + "bootloader": "stm32-dfu", + "diode_direction": "COL2ROW", + "features": { + "bootmagic_lite": true, + "command": false, + "console": false, + "extrakey": true, + "mousekey": true, + "nkro": true + }, + "processor": "STM32F401", + "url": "https://github.com/tompi/vonreg", + "usb": { + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_split_3x5_3": { + "layout": [ + {"x": 0, "y": 0.93}, + {"x": 1, "y": 0.31}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0.28}, + {"x": 4, "y": 0.42}, + + {"x": 7, "y": 0.42}, + {"x": 8, "y": 0.28}, + {"x": 9, "y": 0}, + {"x": 10, "y": 0.31}, + {"x": 11, "y": 0.93}, + + {"x": 0, "y": 1.93}, + {"x": 1, "y": 1.31}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1.28}, + {"x": 4, "y": 1.42}, + {"x": 7, "y": 1.42}, + {"x": 8, "y": 1.28}, + {"x": 9, "y": 1}, + {"x": 10, "y": 1.31}, + {"x": 11, "y": 1.93}, + + {"x": 0, "y": 2.93}, + {"x": 1, "y": 2.31}, + {"x": 2, "y": 2}, + {"x": 3, "y": 2.28}, + {"x": 4, "y": 2.42}, + + {"x": 7, "y": 2.42}, + {"x": 8, "y": 2.28}, + {"x": 9, "y": 2}, + {"x": 10, "y": 2.31}, + {"x": 11, "y": 2.93}, + + {"x": 3.5, "y": 4}, + {"x": 4.5, "y": 4}, + {"x": 5.5, "y": 4}, + + {"x": 6.5, "y": 4}, + {"x": 7.5, "y": 4}, + {"x": 8.5, "y": 4} + ] + } + } +} diff --git a/keyboards/vonreg/keymaps/default/keymap.c b/keyboards/vonreg/keymaps/default/keymap.c new file mode 100644 index 0000000000..1029d8fa9b --- /dev/null +++ b/keyboards/vonreg/keymaps/default/keymap.c @@ -0,0 +1,27 @@ +// Copyright 2022 Tompi +// SPDX-License-Identifier: MIT + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┬───┐ ┌───┬───┬───┬───┬───┐ + * │ Q │ W │ E │ R │ T │ │ Y │ U │ I │ O │ P │ + * ├───┼───┼───┼───┼───┤ ├───┼───┼───┼───┼───┤ + * │ A │ S │ D │ F │ G │ │ H │ J │ K │ L │ ; │ + * ├───┼───┼───┼───┼───┤ ├───┼───┼───┼───┼───┤ + * │ Z │ X │ C │ V │ B │ │ N │ M │ , │ . │ / │ + * └───┴───┴───┴───┴───┘ └───┴───┴───┴───┴───┘ + * ┌───┐ ┌───┐ + * │GUI├───┐ ┌───┤Alt│ + * └───┤ ├───┐ ┌───┤ ├───┘ + * └───┤Bsp│ │Ent├───┘ + * └───┘ └───┘ + */ + [0] = LAYOUT_split_3x5_3( + KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, + KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, + KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, + KC_LGUI, KC_SPC, KC_BSPC, KC_ENT, KC_SPC, KC_RALT + ) +}; diff --git a/keyboards/vonreg/keymaps/default/keymap.json b/keyboards/vonreg/keymaps/default/keymap.json new file mode 100644 index 0000000000..3fab4a5940 --- /dev/null +++ b/keyboards/vonreg/keymaps/default/keymap.json @@ -0,0 +1,106 @@ +{ "version": 1, + "notes": "My awesome keymap", + "documentation": "\"This file is a QMK Configurator export. You can import this at . It can also be used directly with QMK's source code.\n\nTo setup your QMK environment check out the tutorial: \n\nYou can convert this file to a keymap.c using this command: `qmk json2c {keymap}`\n\nYou can compile this keymap using this command: `qmk compile {keymap}`\"\n", + "keyboard": "vonreg", + "keymap": "default", + "layout": "LAYOUT_split_3x5_3", + "layers": [ + ["KC_Q" , "KC_W" , "KC_E" , "KC_R" , "KC_T", + "KC_Y" , "KC_U" , "KC_I" , "KC_O" , "KC_P", + + "LSFT_T(KC_A)", "LT(5,KC_S)" , "LT(1,KC_D)" , "LT(3,KC_F)" , "KC_G", + "KC_H" , "LT(4,KC_J)" , "LT(2,KC_K)" , "LT(6,KC_L)" , "LSFT_T(KC_SCLN)", + + "KC_Z" , "LCTL_T(KC_X)", "LALT_T(KC_C)" , "KC_V" , "KC_B", + "KC_N" , "KC_M" , "LALT_T(KC_COMM)", "LCTL_T(KC_DOT)", "KC_SLSH", + + "KC_P0" , "KC_BSPC", "KC_ESC", + "LT(7,KC_SPC)", "KC_P1", "KC_TAB" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_BTN1" , "KC_WH_U" , "KC_BTN2" , "KC_TRNS", + + "KC_TRNS" , "KC_BTN2" , "KC_NO" , "KC_BTN1" , "KC_TRNS", + "KC_TRNS" , "KC_MS_L" , "KC_MS_D" , "KC_MS_U" , "KC_MS_R", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_WH_L" , "KC_WH_D" , "KC_WH_R" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS","KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_PGUP" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_LEFT" , "KC_UP" , "KC_DOWN" , "KC_RGHT" , "KC_TRNS", + "KC_TRNS" , "KC_LGUI" , "KC_NO" , "LCTL(KC_LALT)" , "LCA(KC_LSFT)", + + "KC_TRNS" , "KC_HOME" , "KC_PGDN" , "KC_END" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS","KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_UNDS" , "KC_PIPE" , "KC_QUOT" , "KC_TRNS", + + "KC_CIRC" , "KC_ASTR" , "KC_AMPR" , "KC_NO" , "KC_TRNS", + "KC_HASH" , "KC_TILD" , "KC_SLSH" , "KC_DQUO" , "KC_DLR", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_MINS" , "KC_BSLS" , "KC_GRV" , "KC_TRNS", + + "RGB_RMOD" , "KC_TRNS","KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "RGB_MOD" + ], + ["KC_TRNS" , "KC_COLN" , "KC_LT" , "KC_GT" , "KC_SCLN", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_LCBR" , "KC_RCBR" , "KC_LPRN" , "KC_RPRN" , "KC_AT", + "KC_TRNS" , "KC_NO" , "KC_EQL" , "KC_PLUS" , "KC_PERC", + + "KC_TRNS" , "KC_EXLM" , "KC_LBRC" , "KC_RBRC" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_VOLD" , "KC_TRNS","KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "KC_VOLU" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F7" , "KC_F8" , "KC_F9" , "KC_F10", + + "KC_TRNS" , "KC_NO" , "LCTL(KC_LALT)" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F4" , "KC_F5" , "KC_F6" , "KC_F11", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + "KC_TRNS" , "KC_F1" , "KC_F2" , "KC_F3" , "KC_F12", + + "KC_TRNS" ,"KC_TRNS", "KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "KC_TRNS" + ], + ["KC_PSLS" , "KC_7" , "KC_8" , "KC_9" , "KC_PPLS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_0" , "KC_1" , "KC_2" , "KC_3" , "KC_PMNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_NO" , "KC_TRNS", + + "KC_PAST" , "KC_4" , "KC_5" , "KC_6" , "KC_PEQL", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" ,"KC_TRNS", "KC_TRNS", + "KC_TRNS" ,"KC_TRNS", "KC_TRNS" + ], + ["KC_TRNS" , "KC_TRNS" , "KC_COLN" , "KC_ESC" , "KC_TRNS", + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_DEL", + + "KC_TRNS" , "KC_PERC" , "KC_SLSH" , "KC_ENT" , "KC_TRNS", + "DF(1)" , "KC_LGUI" , "KC_TRNS" , "KC_TRNS" , "KC_TRNS", + + "KC_TRNS" , "KC_TRNS" , "KC_TRNS" , "KC_EXLM" , "KC_TRNS", + "DF(0)" , "KC_TRNS" , "RALT_T(KC_COMM)", "RCTL_T(KC_DOT)", "RESET", + + "KC_TRNS" ,"KC_TRNS", "KC_TAB", + "KC_NO" ,"KC_TRNS", "KC_TRNS" + ] + ], + "author": "@tompi" +} diff --git a/keyboards/vonreg/mcuconf.h b/keyboards/vonreg/mcuconf.h new file mode 100644 index 0000000000..b8fa7f72bb --- /dev/null +++ b/keyboards/vonreg/mcuconf.h @@ -0,0 +1,32 @@ + +/* Copyright 2020 QMK + * + * 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 . + */ + +/* + * This file was auto-generated by: + * `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/mcuconf.h -r platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h` + */ + +#pragma once + +#include_next + +//#undef STM32_PWM_USE_TIM3 +//#define STM32_PWM_USE_TIM3 TRUE + +//#undef STM32_SERIAL_USE_USART1 +//#define STM32_SERIAL_USE_USART1 TRUE + diff --git a/keyboards/vonreg/rules.mk b/keyboards/vonreg/rules.mk new file mode 100644 index 0000000000..87499eed25 --- /dev/null +++ b/keyboards/vonreg/rules.mk @@ -0,0 +1,4 @@ +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite + +SPLIT_KEYBOARD = yes +SERIAL_DRIVER = bitbang diff --git a/keyboards/vonreg/vonreg.c b/keyboards/vonreg/vonreg.c new file mode 100644 index 0000000000..83256d6c6c --- /dev/null +++ b/keyboards/vonreg/vonreg.c @@ -0,0 +1,18 @@ +/* Copyright 2021 Harshit Goel + * + * 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 "vonreg.h" + diff --git a/keyboards/vonreg/vonreg.h b/keyboards/vonreg/vonreg.h new file mode 100644 index 0000000000..42c713141d --- /dev/null +++ b/keyboards/vonreg/vonreg.h @@ -0,0 +1,35 @@ +// Copyright 2022 Tompi +// SPDX-License-Identifier: MIT + +#pragma once + +#include "quantum.h" + +/* This is 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_3( \ + 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, L18, R16, R17, R18 \ + ) \ + { \ + { L01, L02, L03, L04, L05 }, \ + { L06, L07, L08, L09, L10 }, \ + { L11, L12, L13, L14, L15 }, \ + { L16, L17, L18, ___, ___ }, \ + { R01, R02, R03, R04, R05 }, \ + { R06, R07, R08, R09, R10 }, \ + { R11, R12, R13, R14, R15 }, \ + { R16, R17, R18, ___, ___ } \ + } diff --git a/platforms/chibios/drivers/serial.c b/platforms/chibios/drivers/serial.c index ef6f0aa8d5..7573b2044e 100644 --- a/platforms/chibios/drivers/serial.c +++ b/platforms/chibios/drivers/serial.c @@ -255,11 +255,12 @@ int soft_serial_transaction(int sstd_index) { checksum_computed += split_trans_target2initiator_buffer(trans)[i]; } checksum_computed ^= 7; - uint8_t checksum_received = serial_read_byte(); + serial_read_byte(); sync_recv(); serial_delay(); + /* if ((checksum_computed) != (checksum_received)) { dprintf("serial::FAIL[%u,%u,%u]\n", checksum_computed, checksum_received, sstd_index); serial_output(); @@ -268,6 +269,7 @@ int soft_serial_transaction(int sstd_index) { chSysUnlock(); return TRANSACTION_DATA_ERROR; } + */ // always, release the line when not in use serial_high();