[Keyboard] Add basic Keyhive Sofle support (#14296)

Co-authored-by: Ryan <fauxpark@gmail.com>
Co-authored-by: Sergey Vlasov <sigprof@gmail.com>
master
Drashna Jaelre 2021-10-05 17:49:39 -07:00 committed by GitHub
parent e8db309613
commit 22470f0302
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 385 additions and 31 deletions

View File

@ -0,0 +1,105 @@
/* Copyright
* 2021 solartempest
* 2021 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "config_common.h"
// USB Device descriptor parameter
#define VENDOR_ID 0xFC32
#define PRODUCT_ID 0x1287
#define DEVICE_VER 0x0002
#define MANUFACTURER Keyhive
#define PRODUCT Sofle // VIA version for this PCB is incorrect for the bottom row
// Key matrix size
// Rows are doubled-up. Added extra column for rotary encoder VIA mapping.
#define MATRIX_ROWS 10
#define MATRIX_COLS 6
// wiring of each half
#define MATRIX_ROW_PINS \
{ C6, D7, E6, B4, B5 }
#define MATRIX_COL_PINS \
{ B6, B2, B3, B1, F7, F6 }
#define MATRIX_ROW_PINS_RIGHT \
{ C6, D7, E6, B4, B5 }
#define MATRIX_COL_PINS_RIGHT \
{ F6, F7, B1, B3, B2, B6 }
#define DIODE_DIRECTION COL2ROW
#define DEBOUNCE 5
// Encoder support
#define ENCODERS_PAD_A \
{ F5 }
#define ENCODERS_PAD_B \
{ F4 }
#define ENCODERS_PAD_A_RIGHT \
{ F4 }
#define ENCODERS_PAD_B_RIGHT \
{ F5 }
#define ENCODER_RESOLUTIONS \
{ 4, 2 } // Left encoder seems to have double-output issue but right does not.
#define TAP_CODE_DELAY 10
// Communication between sides
#define SOFT_SERIAL_PIN D2
// OLED settings
#define OLED_TIMEOUT 80000
#define OLED_BRIGHTNESS 90
#define SPLIT_WPM_ENABLE
#define SPLIT_OLED_ENABLE
#define SPLIT_TRANSPORT_MIRROR
// Add RGB underglow
#define RGB_DI_PIN D3
#define RGBLED_NUM 74
#define RGBLED_SPLIT \
{ 37, 37 }
#define RGBLIGHT_LIMIT_VAL 160 // Power draw may exceed 0.6A at max brightness with white colour.
#define RGBLIGHT_LAYERS
#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
#define RGBLIGHT_SLEEP
#define DRIVER_LED_TOTAL RGBLED_NUM
#define RGB_MATRIX_SPLIT RGBLED_SPLIT
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES // reacts to keypresses
// # define RGB_MATRIX_KEYRELEASES // reacts to keyreleases (instead of keypresses)
// # define RGB_DISABLE_AFTER_TIMEOUT 0 // number of ticks to wait until disabling effects
#define RGB_DISABLE_WHEN_USB_SUSPENDED // turn off effects when suspended
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
// # define RGB_MATRIX_LED_PROCESS_LIMIT (DRIVER_LED_TOTAL + 4) / 5 // limits the number of LEDs to process in an animation per task run (increases keyboard responsiveness)
// # define RGB_MATRIX_LED_FLUSH_LIMIT 16 // limits in milliseconds how frequently an animation will update the LEDs. 16 (16ms) is equivalent to limiting to 60fps (increases keyboard responsiveness)
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 150 // limits maximum brightness of LEDs to 150 out of 255. Higher may cause the controller to crash.
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_GRADIENT_LEFT_RIGHT
#define RGB_MATRIX_HUE_STEP 8
#define RGB_MATRIX_SAT_STEP 8
#define RGB_MATRIX_VAL_STEP 8
#define RGB_MATRIX_SPD_STEP 10

View File

@ -0,0 +1,14 @@
{
"keyboard_name": "Sofle",
"layouts": {
"LAYOUT": {
"layout": [
{"x":0, "y":0.5}, {"x":1, "y":0.375}, {"x":2, "y":0.125}, {"x":3, "y":0}, {"x":4, "y":0.125}, {"x":5, "y":0.25}, {"x":10.5, "y":0.25}, {"x":11.5, "y":0.125}, {"x":12.5, "y":0}, {"x":13.5, "y":0.125}, {"x":14.5, "y":0.375}, {"x":15.5, "y":0.5},
{"x":0, "y":1.5}, {"x":1, "y":1.375}, {"x":2, "y":1.125}, {"x":3, "y":1}, {"x":4, "y":1.125}, {"x":5, "y":1.25}, {"x":10.5, "y":1.25}, {"x":11.5, "y":1.125}, {"x":12.5, "y":1}, {"x":13.5, "y":1.125}, {"x":14.5, "y":1.375}, {"x":15.5, "y":1.5},
{"x":0, "y":2.5}, {"x":1, "y":2.375}, {"x":2, "y":2.125}, {"x":3, "y":2}, {"x":4, "y":2.125}, {"x":5, "y":2.25}, {"x":10.5, "y":2.25}, {"x":11.5, "y":2.125}, {"x":12.5, "y":2}, {"x":13.5, "y":2.125}, {"x":14.5, "y":2.375}, {"x":15.5, "y":2.5},
{"x":0, "y":3.5}, {"x":1, "y":3.375}, {"x":2, "y":3.125}, {"x":3, "y":3}, {"x":4, "y":3.125}, {"x":5, "y":3.25}, {"x":6, "y":2.75}, {"x":9.5, "y":2.75}, {"x":10.5, "y":3.25}, {"x":11.5, "y":3.125}, {"x":12.5, "y":3}, {"x":13.5, "y":3.125}, {"x":14.5, "y":3.375}, {"x":15.5, "y":3.5},
{"x":1.5, "y":4.375}, {"x":2.5, "y":4.125}, {"x":3.5, "y":4.15}, {"x":4.5, "y":4.25}, {"x":6, "y":4.25, "h":1.5}, {"x":9.5, "y":4.25, "h":1.5}, {"x":11, "y":4.25}, {"x":12, "y":4.15}, {"x":13, "y":4.125}, {"x":14, "y":4.375}
]
}
}
}

View File

@ -0,0 +1,90 @@
/* Copyright
* 2021 solartempest
* 2021 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 <http://www.gnu.org/licenses/>.
*/
#include "keyhive.h"
#ifdef RGB_MATRIX_ENABLE
// Physical Layout
// Columns
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13
// ROWS
// 12 13 22 23 32 33 33 32 23 22 13 12 0
// 02 03 04 04 03 02
// 11 14 21 24 31 34 34 31 24 21 14 11 1
// 01 01
// 10 15 20 25 30 35 35 30 25 20 15 10 2
//
// 09 16 19 26 29 36 36 29 26 19 16 09 3
//
// 08 17 18 27 28 28 27 18 17 08 4
// 07 06 05 05 06 07
// clang-format off
led_config_t g_led_config = {
{
{ 11, 12, 21, 22, 31, 32 },
{ 10, 13, 20, 23, 30, 33 },
{ 9, 14, 19, 24, 29, 34},
{ 8, 15, 18, 25, 28, 35},
{ 7, 16, 17, 26, 27, NO_LED },
{ 47, 48, 57, 58, 67, 68},
{ 46, 49, 56, 59, 66, 69},
{ 45, 50, 55, 60, 65, 70},
{ 44, 51, 54, 61, 64, 71},
{ 43, 52, 53, 62, 63, NO_LED }
},
{
// Left side underglow
{96, 40}, {16, 20}, {48, 10}, {80, 18}, {88, 60}, {56, 57}, {24,60},
// Left side Matrix
{32, 57}, { 0, 48}, { 0, 36}, { 0, 24}, { 0, 12},
{16, 12}, {16, 24}, {16, 36}, {16, 48}, {48, 55},
{64, 57}, {32, 45}, {32, 33}, {32, 21}, {32, 9},
{48, 7}, {48, 19}, {48, 31}, {48, 43}, {80, 59},
{96, 64}, {64, 45}, {64, 33}, {64, 21}, {64, 9},
{80, 10}, {80, 22}, {80, 34}, {80, 47},
// Right side underglow
{128, 40}, {208, 20}, {176, 10}, {144, 18}, {136, 60}, {168, 57}, {200,60},
// Right side Matrix
{192, 57}, {224, 48}, {224, 36}, {224, 24}, {224, 12},
{208, 12}, {208, 24}, {208, 36}, {208, 48}, {176, 55},
{160, 57}, {192, 45}, {192, 33}, {192, 21}, {192, 9},
{176, 7}, {176, 19}, {176, 31}, {176, 43}, {144, 59},
{128, 64}, {160, 45}, {160, 33}, {160, 21}, {160, 9},
{144, 10}, {144, 22}, {144, 34}, {144, 47},
},
{
LED_FLAG_NONE, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_NONE, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW, LED_FLAG_UNDERGLOW,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT,
LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT, LED_FLAG_KEYLIGHT
}
};
#endif

View File

@ -0,0 +1,47 @@
/* Copyright
* 2021 solartempest
* 2021 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "quantum.h"
// clang-format off
// Extra keys are added for rotary encoder support in VIA
#define LAYOUT( \
LA1, LA2, LA3, LA4, LA5, LA6, RA6, RA5, RA4, RA3, RA2, RA1, \
LB1, LB2, LB3, LB4, LB5, LB6, RB6, RB5, RB4, RB3, RB2, RB1, \
LC1, LC2, LC3, LC4, LC5, LC6, RC6, RC5, RC4, RC3, RC2, RC1, \
LD1, LD2, LD3, LD4, LD5, LD6, LE1, RE6, RD6, RD5, RD4, RD3, RD2, RD1, \
LE2, LE3, LE4, LE5, LE6, RE5, RE4, RE3, RE2, RE1 \
) \
{ \
{ LA1, LA2, LA3, LA4, LA5, LA6 }, \
{ LB1, LB2, LB3, LB4, LB5, LB6 }, \
{ LC1, LC2, LC3, LC4, LC5, LC6 }, \
{ LD1, LD2, LD3, LD4, LD5, LD6 }, \
{ LE1, LE2, LE3, LE4, LE5, LE6 }, \
{ RA1, RA2, RA3, RA4, RA5, RA6 }, \
{ RB1, RB2, RB3, RB4, RB5, RB6 }, \
{ RC1, RC2, RC3, RC4, RC5, RC6 }, \
{ RD1, RD2, RD3, RD4, RD5, RD6 }, \
{ RE1, RE2, RE3, RE4, RE5, RE6 } \
}
//RGB LED Conversion macro from physical array to electric array (+146 to firmware size)
// clang-format on

View File

@ -0,0 +1,66 @@
# Sofle Keyboard
![SofleKeyboard version 2.1 RGB Keyhive](https://i.imgur.com/WH9OoWuh.jpg)
Sofle is 6×4+5 keys column-staggered split keyboard. Based on Lily58, Corne and Helix keyboards.
For detailed instructions on using VIA and flashing, please refer to the sections further down the page!
For details about the keyboard design, refer to Josef's blog: [Sofle Keyboard - a split keyboard based on Lily58 and Crkbd](https://josef-adamcik.cz/electronics/let-me-introduce-you-sofle-keyboard-split-keyboard-based-on-lily58.html)
Build guide: [Keyhive Sofle RGB build guide](https://github.com/keyhive/build_guides/blob/master/docs/keyboards/sofle-rgb.md)
* Keyboard Maintainer: [Solartempest]
* Hardware Supported: SofleKeyboard V2.1 RGB PCB, ProMicro / Elite-C
* Hardware Availability: [Keyhive](https://keyhive.xyz/shop/sofle)
# Custom Features:
### OLED Features:
- Includes Snakey keyboard pet! Slithers according to WPM, bites, and sticks its tongue out at you!
- OLED displays current layer, lock key status, WPM, custom logo, and custom name.
- OLED shuts off on idle and when computer is sleeping.
- Includes working Luna keyboard pet.
- Includes working Bongocat (disable RGB for sufficient space).
- Includes stock OLED code as well.
### RGB Features:
- Adds custom layer lighting with custom gradients for each layer.
- RGB underglow support and remapped to physical locations (nicer gradients and effects).
- Adds white caps lock, scroll lock, and num lock key indicators using the top row/underglow LEDs.
### Rotary Encoder and VIA Features:
- Fully emappable left encoder controls volume up/down/mute. Right encoder PGUP/PGDOWN.
- Allows for live remapping of per-layer rotary encoder functions in VIA.
- VIA support included by default.
- This fixes the Keyhive left bottom row offset issue in VIA. You will need to import sofle.json in VIA.
- Custom macro key in VIA for Super Alt Tab, which is fully compatible with rotary encoders.
- Custom macro key in VIA for moving windows to other monitors in Windows, which is fully compatible with rotary encoders.
### Tap and Other Features:
- Push left-shift + backspace to delete whole words. Right-shift + backspace to delete whole words in the opposite direction.
- Double tap layers to stay on a layer instead of momentary push.
- Adds key combo functionality.
- Symmetric modifiers (CMD/Super, Alt/Opt, Ctrl, Shift).
## Using with VIA
- After flashing, in VIA make sure to Import Keymap, which is "sofle VIA keymap.json". This will alow VIA to recognize the updated layout and custom functions. VIA will not auto-recognize the keyboard with this firmware because of the necessary customization.
- Go to Save+Load to Load Saved Layout. You can import my own layout "sofle VIA layout.json" or just use the Keymap tab to assign your own keys. Having another keyboard connected can be handy for doing this step.
- It is a good idea to Save Current Layout after you decide on your mapping.
Make example for this keyboard (after setting up your build environment):
make sofle/keyhive:default
Flashing example for this keyboard:
make sofle/keyhive:default:flash
Press reset button on he keyboard when asked.
Disconnect the first half, connect the second one and repeat the process.
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).

View File

@ -0,0 +1,26 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = atmel-dfu
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes
LTO_ENABLE = yes
SPLIT_KEYBOARD = yes
OLED_ENABLE = yes
OLED_DRIVER = SSD1306

View File

@ -22,16 +22,21 @@ see https://docs.qmk.fm/#/feature_split_keyboard?id=setting-handedness
for more options.
*/
#if defined(KEYBOARD_sofle_rev1)
// Add RGB underglow and top facing lighting
# define RGB_DI_PIN D3
#ifdef RGB_MATRIX_ENABLE
#define RGBLED_NUM 36 // Number of LEDs
#define DRIVER_LED_TOTAL RGBLED_NUM
#endif
# define RGBLED_NUM 70
#define RGBLED_SPLIT {36,36}
# define RGBLED_SPLIT \
{ 36, 36 }
# ifdef RGB_MATRIX_ENABLE
# define DRIVER_LED_TOTAL RGBLED_NUM
# define RGB_MATRIX_SPLIT RGBLED_SPLIT
# define SPLIT_TRANSPORT_MIRROR
# else
# define RGBLIGHT_ANIMATIONS
# define RGBLIGHT_LIMIT_VAL 120
# define RGBLIGHT_HUE_STEP 10
# define RGBLIGHT_SAT_STEP 17
# define RGBLIGHT_VAL_STEP 17
# endif
#endif

View File

@ -36,4 +36,3 @@
#define NO_ACTION_MACRO
#define NO_ACTION_FUNCTION

View File

@ -1,5 +1,7 @@
#pragma once
#ifdef KEYBOARD_sofle_rev1
#if defined(KEYBOARD_sofle_rev1)
# include "rev1.h"
#elif defined(KEYBOARD_sofle_keyhive)
# include "keyhive.h"
#endif