~ruther/qmk_firmware

c5728aebeeb75e0069642f984d579e4691ec9677 — Dmitry Nosachev 3 years ago d9e5a5f
Add Teensy2.0++ revision and VIA keymap to handwired/sono1 (#15296)

* teensy2.0pp revision, via support

* updated documentation

* Update keyboards/handwired/sono1/t2pp/rules.mk
M keyboards/handwired/sono1/config.h => keyboards/handwired/sono1/config.h +5 -69
@@ 1,5 1,5 @@
/*
Copyright 2020 DmNosachev
Copyright 2021 DmNosachev

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


@@ 30,80 30,12 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
#define MATRIX_ROWS 15
#define MATRIX_COLS 8

/*
 * Keyboard Matrix Assignments
 *
 * Change this to how you wired your keyboard
 * COLS: AVR pins used for columns, left to right
 * ROWS: AVR pins used for rows, top to bottom
 * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
 *                  ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
 *
 */
#define MATRIX_ROW_PINS { A5, B3, A9, A10, B13, B14, B15, A8, B7, B8, B9, C13, A15, A0, A1 }
#define MATRIX_COL_PINS { A4, A3, B11, B10, B1, B0, A7, A6 }
#define UNUSED_PINS { A5 }

#define LED_KANA_PIN A2
#define LED_CAPS_LOCK_PIN B5
#define LED_CTRL_XFER_PIN B6
#define LED_NUM_LOCK_PIN B4
#define LED_KB_LOCK_PIN B12
#define LED_PIN_ON_STATE 0

/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* If defined, GRAVE_ESC will always act as ESC when CTRL is held.
 * This is useful for the Windows task manager shortcut (ctrl+shift+esc).
 */
//#define GRAVE_ESC_CTRL_OVERRIDE

/*
 * Force NKRO
 *
 * Force NKRO (nKey Rollover) to be enabled by default, regardless of the saved
 * state in the bootmagic EEPROM settings. (Note that NKRO must be enabled in the
 * makefile for this to work.)
 *
 * If forced on, NKRO can be disabled via magic key (default = LShift+RShift+N)
 * until the next keyboard reset.
 *
 * NKRO may prevent your keystrokes from being detected in the BIOS, but it is
 * fully operational during normal computer usage.
 *
 * For a less heavy-handed approach, enable NKRO via magic key (LShift+RShift+N)
 * or via bootmagic (hold SPACE+N while plugging in the keyboard). Once set by
 * bootmagic, NKRO mode will always be enabled until it is toggled again during a
 * power-up.
 *
 */
//#define FORCE_NKRO

/*
 * 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

/* disable these deprecated features by default */
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION


@@ 111,3 43,7 @@ along with this program.  If not, see <http://www.gnu.org/licenses/>.
/* Bootmagic Lite key configuration */
#define BOOTMAGIC_LITE_ROW 0
#define BOOTMAGIC_LITE_COLUMN 0

/* mechanical locking support. NumLock key on the numpad uses Alps SKCL Lock switch */
#define LOCKING_SUPPORT_ENABLE
#define LOCKING_RESYNC_ENABLE
\ No newline at end of file

A keyboards/handwired/sono1/keymaps/via/keymap.c => keyboards/handwired/sono1/keymaps/via/keymap.c +75 -0
@@ 0,0 1,75 @@
/* Copyright 2021 DmNosachev
 *
 * 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 QMK_KEYBOARD_H


const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
,---------------------------------------------------------------------------------------------------------,  ,-----,
| F11 |  | F12 |  |  F1  |  F2  |  F3  |  F4  |  F5  |   |  F6  |  F7  |  F8  |  F9  | F10  | |PgUp |PgDn |  | NO  |
|-------------------------------------------------------------------------------------------| |-----------|  |-----|-----------------,
| Esc  |  1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  |  0  |  —- | +=  |  ~` |BkSpc | |Home | End |  |  *  |  /  |  -  |  +  |
|-------------------------------------------------------------------------------------------| |-----------|  |-----------------------|
|  Tab  |  Q  |  W  |  E  |  R  |  T  |  Y  |  U  |  I  |  O  |  P  | {[  | }]  |   Enter   | | Ins | Del |  |  7  |  8  |  9  | +=  |
|--------------------------------------------------------------------------------|          | `-----------'  |-----------------------|
|  Ctrl  |  A  |  S  |  D  |  F  |  G  |  H  |  J  |  K  |  L  | :;  | "'  | |\  |          | |    Up     |  |  4  |  5  |  6  |  .  |
|--------------------------------------------------------------------------------`----------' |-----------|  |-----------------------|
|   Shift  |  Z  |  X  |  C  |  V  |  B  |  N  |  M  |  <, |  >. | ?/  |  NO |    Shift     | |Left |Right|  |  1  |  2  |  3  | <,  |
|-------------------------------------------------------------------------------------------| |-----------|  |-----------------------|
|Caps | Alt | App | GUI |   Space     |   Space     |    Enter        | Ctrl  |       | Alt | |   Down    |  |  0  |  0  |   Enter   |
`-------------------------------------------------------------------------------------------' `-----------'  '-----------------------'
                               |  Del | BackSp|
                               `--------------'
*/
    [0] = LAYOUT(
    KC_F11,   KC_F12,   KC_F1,  KC_F2,  KC_F3,  KC_F4,  KC_F5,     KC_F6,  KC_F7,  KC_F8,  KC_F9,  KC_F10,   KC_PGUP, KC_PGDN,   _______,
    KC_ESC,  KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_GRV, KC_BSPC,   KC_HOME, KC_END,    KC_PAST, KC_PSLS, KC_PMNS, KC_PPLS,
    KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC,     KC_ENT,        KC_INS,  KC_DEL,    KC_P7,   KC_P8,   KC_P9,   KC_EQL,
    KC_LCTL, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_BSLS,                     KC_UP,         KC_P4,   KC_P5,   KC_P6,   KC_PDOT,
    KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH,  _______, KC_RSFT,          KC_LEFT, KC_RIGHT,  KC_P1,   KC_P2,   KC_P3,   KC_COMM,
    KC_CAPS, KC_LALT, KC_APP,  KC_LGUI,     KC_SPACE,    KC_SPACE,      KC_ENT,     KC_RCTL,   KC_RALT,           KC_DOWN,       KC_P0,   KC_P0,   KC_PENT,
                                              KC_DEL, KC_BSPC
    ),

    [1] = LAYOUT(
    _______,  _______,   _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______,               _______, _______,   _______,
    _______,  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______,         _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                           _______,      _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                      _______, _______,  _______, _______, _______, _______,
    _______, _______, _______,          _______,       _______,         _______,     _______,     _______,   _______,                              _______,      _______, _______,    _______,
                                          _______, _______
    ),

    [2] = LAYOUT(
    _______,  _______,   _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______,               _______, _______,   _______,
    _______,  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______,         _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                           _______,      _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                      _______, _______,  _______, _______, _______, _______,
    _______, _______, _______,          _______,       _______,         _______,     _______,     _______,   _______,                              _______,      _______, _______,    _______,
                                          _______, _______
    ),
    [3] = LAYOUT(
    _______,  _______,   _______,  _______,  _______,  _______,  _______,     _______,  _______,  _______,  _______,  _______,               _______, _______,   _______,
    _______,  _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,  _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,    _______,         _______, _______,   _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                           _______,      _______, _______, _______, _______,
    _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,                      _______, _______,  _______, _______, _______, _______,
    _______, _______, _______,          _______,       _______,         _______,     _______,     _______,   _______,                              _______,      _______, _______,    _______,
                                          _______, _______
    )
};
\ No newline at end of file

A keyboards/handwired/sono1/keymaps/via/rules.mk => keyboards/handwired/sono1/keymaps/via/rules.mk +1 -0
@@ 0,0 1,1 @@
VIA_ENABLE = yes
\ No newline at end of file

M keyboards/handwired/sono1/readme.md => keyboards/handwired/sono1/readme.md +28 -4
@@ 5,11 5,11 @@
ASkeyboard Sono1 keyboard conversion project: direct connection of Black Pill to the matrix.

* Keyboard Maintainer: [DmNosachev](https://github.com/DmNosachev)
* Hardware Supported: [ASkeyboard Sono1](http://www5f.biglobe.ne.jp/~silencium/keyboard/html/alps.html), Black Pill STM32F103C8T6 MCU board. Alternatively you can use any MCU which is supported by QMK and has 28 IO pins or more (15x8 matrix and 5 LEDs): Teensy 2.0++, Blue Pill, etc.
* Hardware Supported: [ASkeyboard Sono1](http://www5f.biglobe.ne.jp/~silencium/keyboard/html/alps.html), Teensy 2.0++ or Black Pill STM32F103C8T6 MCU board. Alternatively you can use any MCU which is supported by QMK and has 28 IO pins or more (15x8 matrix and 5 LEDs): Blue Pill, Black Pill STM32F4xx, etc.

Make example for this keyboard (after setting up your build environment):

    make handwired/sono1:default
    qmk compile -kb handwired/sono1:default

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).



@@ 22,11 22,34 @@ ASkeyboard Sono1 has 15x8 matrix. Sono2 numpad connects directly to the main mat
Rows (R0-RE) and columns (R0-C7):
![Sono1 rows and columns](https://i.imgur.com/5Owazg6h.jpeg)

Desolder all ICs, capacitors and resistors except R10–R14.

## LEDs
Keyboard has 5 LEDs with common anode. Their cathodes are connected to R10–R14 resistors (you may want to replace them to adjust LED brightness for 3.3V voltage). Add 5 wire jumpers to connect them to the corresponding traces.

![Sono1 LEDs](https://i.imgur.com/opxc2A3h.jpeg)

## Teensy 2.0++
Suggested mount position for the Teensy 2.0++ (view from the bottom side of the PCB):
```
     R8 R9 RA RB RC RD RE L0    R8    C7 C6 C5 C4 C3 C2 C1 C0
      *  |  |  |  |  |  |  |     *     |  |  |  |  |  |  |  |
    ,------------------------------------------------------------,
,---|GN B7 D0 D1 D2 D3 D4 D5 D6 D7 E0 E1 C0 C1 C2 C3 C4 C5 C6 C7 |
|   |D7                                                          |
|USB|                                                            |
|   |GN                                                          |
'---|V  B6 B5 B4 B3 B2 B1 B0 E7 E6 G  A  F0 F1 F2 F3 F4 F5 F6 F7 |
    `------------------------------------------------------------'
     *         |  |  |  |                 |  |  |  |  |  |  |  |
     GN       L2 L1 L3 L4                R7 R6 R5 R4 R3 R2 R1 R0
```
Asterisk sign designates pins of the Teensy that don't align properly with PCB and need to be rewired.

1. Compile and flash the firmware: `qmk compile -kb handwired/sono1/t2pp:default:flash`. Press the reset button on Teensy to launch the bootloader.
2. You will need to solder several pin headers to Teensy: two 7 pin headers (C0–C7, D5–B7), 8 pin (F0–F7) and 4 pin (B1—B4). 
3. Solder the Teensy to keyboard's PCB. You will need to manually reroute only 3 pins.

## Black Pill
Suggested mount position for the Black Pill (view from the bottom side of the PCB):



@@ 47,11 70,12 @@ Asterisk sign designates pins of the Black Pill that don't align properly with P

![Black Pill](https://i.imgur.com/KQjTWVbh.jpeg)

1. Desolder all ICs, capacitors and resistors except R10–R14.
1. Solder 4-pin SWD header to Black Pill.
2. Burn [STM32duino bootloader](https://github.com/rogerclarkmelbourne/STM32duino-bootloader/blob/master/bootloader_only_binaries/generic_boot20_pb12.bin) to Black Pill.
3. Compile and flash the firmware: `make handwired/sono1:default:flash`
3. Compile and flash the firmware: `qmk compile -kb handwired/sono1/stm32f103:default:flash`
4. Connect rows, columns and LED pads to the corresponding pins of the Black Pill.

## Keymap
'CUR LOCK' key on Sono2 numpad has locking switch by default (Alps SKCL lock). QMK [supports mechanical locking switches](https://docs.qmk.fm/#/faq_keymap?id=mechanical-lock-switch-support) for CapsLock, NumLock and ScrollLock keycodes.

There is 'debug' keymap which doesn't output any scancodes, but displays row and column numbers of pressed buttons to console (hid_listen or QMK Toolbox).

M keyboards/handwired/sono1/rules.mk => keyboards/handwired/sono1/rules.mk +1 -8
@@ 1,11 1,4 @@
# MCU name
MCU = STM32F103

# Bootloader selection
BOOTLOADER = stm32duino

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE
DEFAULT_FOLDER = handwired/sono1/t2pp

# Build Options
#   change yes to no to disable

R keyboards/handwired/sono1/chconf.h => keyboards/handwired/sono1/stm32f103/chconf.h +1 -2
@@ 16,7 16,7 @@

/*
 * This file was auto-generated by:
 *    `qmk chibios-confmigrate -i keyboards/handwired/sono1/chconf.h -r platforms/chibios/common/configs/chconf.h`
 *    `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/chconf.h -r platforms/chibios/common/configs/chconf.h`
 */

#pragma once


@@ 26,4 26,3 @@
#define CH_CFG_USE_CONDVARS_TIMEOUT FALSE

#include_next <chconf.h>


A keyboards/handwired/sono1/stm32f103/config.h => keyboards/handwired/sono1/stm32f103/config.h +36 -0
@@ 0,0 1,36 @@
/*
Copyright 2021 DmNosachev

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/>.
*/

#pragma once

#include "config_common.h"

#undef DEVICE_VER

#define DEVICE_VER 0x0001

#define MATRIX_ROW_PINS { A5, B3, A9, A10, B13, B14, B15, A8, B7, B8, B9, C13, A15, A0, A1 }
#define MATRIX_COL_PINS { A4, A3, B11, B10, B1, B0, A7, A6 }


#define LED_KANA_PIN A2
#define LED_CAPS_LOCK_PIN B5
#define LED_CTRL_XFER_PIN B6
#define LED_NUM_LOCK_PIN B4
#define LED_KB_LOCK_PIN B12
#define LED_PIN_ON_STATE 0


R keyboards/handwired/sono1/halconf.h => keyboards/handwired/sono1/stm32f103/halconf.h +1 -2
@@ 16,7 16,7 @@

/*
 * This file was auto-generated by:
 *    `qmk chibios-confmigrate -i keyboards/handwired/sono1/halconf.h -r platforms/chibios/common/configs/halconf.h`
 *    `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/halconf.h -r platforms/chibios/common/configs/halconf.h`
 */

#pragma once


@@ 24,4 24,3 @@
#define HAL_USE_PWM TRUE

#include_next <halconf.h>


R keyboards/handwired/sono1/mcuconf.h => keyboards/handwired/sono1/stm32f103/mcuconf.h +1 -2
@@ 16,7 16,7 @@

/*
 * This file was auto-generated by:
 *    `qmk chibios-confmigrate -i keyboards/handwired/sono1/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h`
 *    `qmk chibios-confmigrate -i keyboards/handwired/onekey/bluepill/mcuconf.h -r platforms/chibios/STM32_F103_STM32DUINO/configs/mcuconf.h`
 */

#pragma once


@@ 28,4 28,3 @@

#undef STM32_SPI_USE_SPI2
#define STM32_SPI_USE_SPI2 FALSE


A keyboards/handwired/sono1/stm32f103/rules.mk => keyboards/handwired/sono1/stm32f103/rules.mk +8 -0
@@ 0,0 1,8 @@
# MCU name
MCU = STM32F103

# Bootloader selection
BOOTLOADER = stm32duino

# Enter lower-power sleep mode when on the ChibiOS idle thread
OPT_DEFS += -DCORTEX_ENABLE_WFI_IDLE=TRUE

A keyboards/handwired/sono1/t2pp/config.h => keyboards/handwired/sono1/t2pp/config.h +36 -0
@@ 0,0 1,36 @@
/*
Copyright 2021 DmNosachev

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/>.
*/

#pragma once

#include "config_common.h"

#undef DEVICE_VER

#define DEVICE_VER 0x0002

#define MATRIX_ROW_PINS { F7, F6, F5, F4, F3, F2, F1, F0, D7, B7, D0, D1, D2, D3, D4 }
#define MATRIX_COL_PINS { C6, C5, C4, C3, C2, C1, C0, E1 }


#define LED_KANA_PIN D5
#define LED_CAPS_LOCK_PIN B3
#define LED_CTRL_XFER_PIN B4
#define LED_NUM_LOCK_PIN B2
#define LED_KB_LOCK_PIN B1
#define LED_PIN_ON_STATE 0


A keyboards/handwired/sono1/t2pp/rules.mk => keyboards/handwired/sono1/t2pp/rules.mk +5 -0
@@ 0,0 1,5 @@
# MCU name
MCU = at90usb1286

# Bootloader selection
BOOTLOADER = halfkay