Compare commits

...

8 Commits

Author SHA1 Message Date
Takeshi ISHII
3edfb93d5d Add build debug option to tmk_core/rules.mk (#11324)
* Add DUMP_C_MACROS to tmk_core/rules.mk

* update DUMP_C_MACROS

* add VERBOSE_LD_CMD, VERBOSE_AS_CMD

* add VERBOSE_C_CMD, VERBOSE_C_INCLUDE

* update DUMP_C_MACROS, VERBOSE_C_INCLUDE, VERBOSE_C_CMD
2021-01-06 07:27:10 +09:00
Zach White
34513b4665 enable LTO to bring firmware size down 2021-01-05 13:13:47 -08:00
Drashna Jael're
3d1e7bd36f [Keyboard] Disable music mode on OctoPad to reduce size 2021-01-05 10:55:28 -08:00
Drashna Jaelre
375ef0b8c3 [Keyboard] Fix compiler errors for Kingly Key boards (#11100) 2021-01-05 15:14:10 +11:00
Joel Challis
f03b10b6c1 Migrate python tests away from onekey (#11367)
* Migrate python tests away from onekey

* Add stub files to stop lint complaints

* Make all the pytest keymaps compile
2021-01-05 00:52:31 +00:00
Drashna Jaelre
810eafad12 Fix Tap-Hold Configs (#11127)
* Add proper prototypes for Tap-Hold Per Key functions

* Fix handwired/tennie default keymap

* Remove unneeded references

* Fix tapping term per key check in space cadet

* Pre-emptive fix for tap dance

* Fix marksard/leftover30

* Replace hard coded tapping term with define
2021-01-04 16:37:20 -08:00
fauxpark
c38fe49242 Update MXSS custom rgblight and fix compilation error 2021-01-04 16:27:16 -08:00
YangPiCui
d1e10a067b [Keyboard] Add handwired/evk (#11034)
* Add the Ergonomic Vertical Keyboards

* generic update

* Update readme.md

* Update readme.md

* Update readme.md

* Update info.json

* put into handwired

* Update readme.md

* Update readme.md

* i

* Change copy author from RedForty to Yang Cui

* add version 1.3

* rename keyboard version

* Update config.h

* j

* h

* fix bugs

* Update config.h

* Update config.h

* Update keymap.c

* update default keymap

* Update keymap.c

* Add handwired/evk

* Add handwired/evk

* Update v1_3.c

* Update keyboards/handwired/evk/v1_3/config.h

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keyboards/handwired/evk/v1_3/rules.mk

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update keyboards/handwired/evk/v1_3/v1_3.c

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update config.h

* Commit change requests from the pull request

* remove copy right

* Update v1_3.c

* Update v1_3.c

* Update keyboards/handwired/evk/v1_3/config.h

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/handwired/evk/v1_3/rules.mk

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/handwired/evk/v1_3/rules.mk

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/handwired/evk/v1_3/info.json

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update keyboards/handwired/evk/info.json

Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>

* Update info.json

* change all names to YangPiCui

* Update keyboards/handwired/evk/v1_3/keymaps/default/keymap.c

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/handwired/evk/v1_3/readme.md

Co-authored-by: Ryan <fauxpark@gmail.com>

* Update keyboards/handwired/evk/v1_3/config.h

Co-authored-by: Ryan <fauxpark@gmail.com>

* Delete config.h

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: James Young <18669334+noroadsleft@users.noreply.github.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2021-01-04 10:58:36 -08:00
52 changed files with 914 additions and 603 deletions

View File

@@ -0,0 +1,4 @@
{
"manufacturer": "YangPiCui",
"maintainer": "YangPiCui"
}

View File

@@ -0,0 +1,6 @@
# [Ergonomic Vertical Keyboard (EVK)](https://github.com/YangPiCui/ErgonomicVerticalKeyboard)
The Ergonomic Vertical Keyboard (EVK) deletes our humpback.
* Maintainer: [YangPiCui](https://github.com/YangPiCui)
* Hardware Availability: Upon Custom Ordering

View File

@@ -0,0 +1,148 @@
/*
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 0xFEED
#define PRODUCT_ID 0x0000
#define DEVICE_VER 0x0001
#define MANUFACTURER Yang Cui
#define PRODUCT evk v1_3
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
/*
* 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 \
{ B0, B1, B2, B3, B7, D0 }
#define MATRIX_COL_PINS \
{ D1, D2, D3, C6, C7, F0, F1, F4, F5, F6, F7, B6, B5, B4, D7, D6 }
#define UNUSED_PINS
/* COL2ROW, ROW2COL*/
#define DIODE_DIRECTION ROW2COL // the current flows into the rows and then out of the columns
/* define whiche Pins to use for the status LEDs*/
#define LED_CAPS_LOCK_PIN D4
/*
* Split Keyboard specific options, make sure you have 'SPLIT_KEYBOARD = yes' in your rules.mk, and define SOFT_SERIAL_PIN.
*/
// #define SOFT_SERIAL_PIN D2 // or D1, D2, D3, E6
// #define BACKLIGHT_PIN B7
// #define BACKLIGHT_BREATHING
// #define BACKLIGHT_LEVELS 3
// #define RGB_DI_PIN E2
// #ifdef RGB_DI_PIN
// #define RGBLED_NUM 16
// #define RGBLIGHT_HUE_STEP 8
// #define RGBLIGHT_SAT_STEP 8
// #define RGBLIGHT_VAL_STEP 8
// #define RGBLIGHT_LIMIT_VAL 255 /* The maximum brightness level */
// #define RGBLIGHT_SLEEP /* If defined, the RGB lighting will be switched off when the host goes to sleep */
// /*== all animations enable ==*/
// #define RGBLIGHT_ANIMATIONS
// /*== or choose animations ==*/
// #define RGBLIGHT_EFFECT_BREATHING
// #define RGBLIGHT_EFFECT_RAINBOW_MOOD
// #define RGBLIGHT_EFFECT_RAINBOW_SWIRL
// #define RGBLIGHT_EFFECT_SNAKE
// #define RGBLIGHT_EFFECT_KNIGHT
// #define RGBLIGHT_EFFECT_CHRISTMAS
// #define RGBLIGHT_EFFECT_STATIC_GRADIENT
// #define RGBLIGHT_EFFECT_RGB_TEST
// #define RGBLIGHT_EFFECT_ALTERNATING
// /*== customize breathing effect ==*/
// /*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/
// #define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64
// /*==== use exp() and sin() ====*/
// #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7
// #define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255
// #endif
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
/* define if matrix has ghost (lacks anti-ghosting diodes) */
//#define MATRIX_HAS_GHOST
/* 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 userful 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
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION
/* Bootmagic Lite key configuration */
// #define BOOTMAGIC_LITE_ROW 0
// #define BOOTMAGIC_LITE_COLUMN 0

View File

@@ -0,0 +1,101 @@
{
"keyboard_name": "Ergonomic Vertical Keyboard (EVK) version 1.3 with Teensy 2.0",
"url": "https://github.com/YangPiCui/ErgonomicVerticalKeyboard",
"maintainer": "YangPiCui",
"width": 22.75,
"height": 7.5,
"layouts": {
"LAYOUT": {
"layout": [
{"label":"k0A", "x":0, "y":0.5, "w":1.25, "h":1.25},
{"label":"k0B", "x":1.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0C", "x":2.5, "y":0, "w":1.25, "h":1.25},
{"label":"k0D", "x":3.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0E", "x":5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0F", "x":6.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0G", "x":8.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0H", "x":10, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0I", "x":11.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0J", "x":12.5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0K", "x":15.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0L", "x":16.5, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0M", "x":17.75, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0N", "x":19, "y":0, "w":1.25, "h":1.25},
{"label":"k0O", "x":20.25, "y":0.25, "w":1.25, "h":1.25},
{"label":"k0P", "x":21.5, "y":0.5, "w":1.25, "h":1.25},
{"label":"k1A", "x":0, "y":1.75, "w":1.25, "h":1.25},
{"label":"k1B", "x":1.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1C", "x":2.5, "y":1.25, "w":1.25, "h":1.25},
{"label":"k1D", "x":3.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1E", "x":5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1F", "x":6.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1G", "x":8.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1H", "x":10, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1I", "x":11.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1J", "x":12.5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1K", "x":15.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1L", "x":16.5, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1M", "x":17.75, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1N", "x":19, "y":1.25, "w":1.25, "h":1.25},
{"label":"k1O", "x":20.25, "y":1.5, "w":1.25, "h":1.25},
{"label":"k1P", "x":21.5, "y":1.75, "w":1.25, "h":1.25},
{"label":"k2A", "x":0, "y":3, "w":1.25, "h":1.25},
{"label":"k2B", "x":1.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2C", "x":2.5, "y":2.5, "w":1.25, "h":1.25},
{"label":"k2D", "x":3.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2E", "x":5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2F", "x":6.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2G", "x":8.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2H", "x":10, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2I", "x":11.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2J", "x":12.5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2K", "x":15.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2L", "x":16.5, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2M", "x":17.75, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2N", "x":19, "y":2.5, "w":1.25, "h":1.25},
{"label":"k2O", "x":20.25, "y":2.75, "w":1.25, "h":1.25},
{"label":"k2P", "x":21.5, "y":3, "w":1.25, "h":1.25},
{"label":"k3A", "x":0, "y":4.25, "w":1.25, "h":1.25},
{"label":"k3B", "x":1.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3C", "x":2.5, "y":3.75, "w":1.25, "h":1.25},
{"label":"k3D", "x":3.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3E", "x":5, "y":4, "w":1.25, "h":1.25},
{"label":"k3F", "x":6.75, "y":4.5, "w":1.25, "h":1.25},
{"label":"k3G", "x":8.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3H", "x":10, "y":4, "w":1.25, "h":1.25},
{"label":"k3I", "x":11.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3J", "x":12.5, "y":4, "w":1.25, "h":1.25},
{"label":"k3K", "x":14.75, "y":4.5, "w":1.25, "h":1.25},
{"label":"k3L", "x":16.5, "y":4, "w":1.25, "h":1.25},
{"label":"k3M", "x":17.75, "y":4, "w":1.25, "h":1.25},
{"label":"k3N", "x":19, "y":3.75, "w":1.25, "h":1.25},
{"label":"k3O", "x":20.25, "y":4, "w":1.25, "h":1.25},
{"label":"k3P", "x":21.5, "y":4.25, "w":1.25, "h":1.25},
{"label":"k4A", "x":0, "y":5.5, "w":1.25, "h":1.25},
{"label":"k4B", "x":1.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4C", "x":2.5, "y":5, "w":1.25, "h":1.25},
{"label":"k4D", "x":3.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4E", "x":5.5, "y":5.75, "w":1.25, "h":1.25},
{"label":"k4F", "x":6.75, "y":5.75, "w":1.25, "h":1.25},
{"label":"k4G", "x":8.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4H", "x":10, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4I", "x":11.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4J", "x":12.5, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4K", "x":14.75, "y":5.75, "w":1.25, "h":1.25},
{"label":"k4L", "x":16, "y":5.75, "w":1.25, "h":1.25},
{"label":"k4M", "x":17.75, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4N", "x":19, "y":5, "w":1.25, "h":1.25},
{"label":"k4O", "x":20.25, "y":5.25, "w":1.25, "h":1.25},
{"label":"k4P", "x":21.5, "y":5.5, "w":1.25, "h":1.25},
{"label":"k5B", "x":1.25, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5C", "x":2.5, "y":6.25, "w":1.25, "h":1.25},
{"label":"k5G", "x":8.75, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5H", "x":10, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5I", "x":11.25, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5J", "x":12.5, "y":6.5, "w":1.25, "h":1.25},
{"label":"k5N", "x":19, "y":6.25, "w":1.25, "h":1.25},
{"label":"k5O", "x":20.25, "y":6.5, "w":1.25, "h":1.25}
]
}
}
}

View File

@@ -0,0 +1,34 @@
/*
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] = {
[0] = LAYOUT(/* Base Layer (0th Layer) - default Layout */
KC_1, KC_2, KC_3, KC_4, KC_5, KC_ESC, TG(1), KC_PSCR, KC_INS, KC_APP, KC_CAPS, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_Q, KC_H, KC_R, KC_F, KC_X, KC_LBRC, KC_F1, KC_F2, KC_F3, KC_F4, KC_RBRC, KC_BSPC, KC_Y, KC_O, KC_U, KC_J,
KC_L, KC_S, KC_N, KC_T, KC_D, KC_END, KC_F5, KC_F6, KC_F7, KC_F8, KC_DEL, KC_P, KC_I, KC_A, KC_E, KC_K,
KC_Z, KC_M, KC_C, KC_V, KC_B, KC_LCTL, KC_F9, KC_F10, KC_F11, KC_F12, KC_RCTL, KC_W, KC_G, KC_COMM, KC_DOT, KC_ENT,
KC_LALT, KC_MINS, KC_EQL, KC_TAB, KC_SPC, KC_LGUI, KC_HOME, KC_UP, KC_END, KC_PGUP, KC_RGUI, KC_SPC, KC_QUOT, KC_SCLN, KC_SLSH, KC_RALT,
KC_LSFT, KC_GRV, KC_LEFT, KC_DOWN, KC_RGHT, KC_PGDN, KC_BSLS, KC_RSFT
),
[1] = LAYOUT(/* 1st Layer - Numpad Keys */
_______, _______, _______, _______, _______, _______, _______, KC_SLCK, KC_PAUS, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, KC_PSLS, KC_PAST, KC_PMNS, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_P7, KC_P8, KC_P9, KC_PPLS, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_P4, KC_P5, KC_P6, KC_PPLS, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, KC_P1, KC_P2, KC_P3, KC_PEQL, _______, _______, _______, _______, _______, _______,
_______, _______, KC_P0, KC_P0, KC_PDOT, KC_PENT, _______, _______
)
};

View File

@@ -0,0 +1 @@
# The default keymap for this version of the EVK

View File

@@ -0,0 +1,10 @@
# [Ergonomic Vertical Keyboard (EVK)](https://github.com/YangPiCui/ErgonomicVerticalKeyboard) version 1.3 with Teensy 2.0
* Keyboard Maintainer: [YangPiCui](https://github.com/YangPiCui)
* Hardware Supported: Ergonomic Vertical Keyboard (EVK) version 1.3 with Teensy 2.0
Make example for this keyboard (after setting up your build environment):
make handwired/evk/v1_3: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).

View File

@@ -0,0 +1,22 @@
# MCU name
MCU = atmega32u4
# Bootloader selection
BOOTLOADER = halfkay
# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = no # Virtual DIP switch configuration
MOUSEKEY_ENABLE = yes # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = yes # Console for debug
COMMAND_ENABLE = yes # 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 = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
BLUETOOTH_ENABLE = no # Enable Bluetooth
AUDIO_ENABLE = no # Audio output

View File

@@ -0,0 +1,58 @@
/*
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 "v1_3.h"
// Optional override functions below.
// You can leave any or all of these undefined.
// These are only required if you want to perform custom actions.
// For reference, visit https://docs.qmk.fm/#/custom_quantum_functions?id=layer-change-code
// keyboard start-up codes
// runs once when the firmware starts up
void matrix_init_kb(void) {
// Set the LEDs pins
setPinOutput(D5); // Layer 1 Status LED
matrix_init_user();
}
// looping keyboard codes
// runs every cycle (a lot)
/*void matrix_scan_kb(void) {
matrix_scan_user();
}*/
// per-action keyboard codes
// runs for every key-press action, just before processing by the firmware
/*bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
return process_record_user(keycode, record);
}*/
// Set LED based on layer
__attribute__((weak)) layer_state_t layer_state_set_user(layer_state_t state) {
writePin(D5, layer_state_cmp(state, 1));
return state;
}
bool led_update_kb(led_t led_state) {
bool res = led_update_user(led_state);
if (res) {
// writePin sets the pin high for 1 and low for 0.
writePin(D4, led_state.caps_lock);
}
return res;
}

View File

@@ -0,0 +1,43 @@
/*
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"
#define XXX KC_NO
/* 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.
*/
#define LAYOUT(\
k0A, k0B, k0C, k0D, k0E, k0F, k0G, k0H, k0I, k0J, k0K, k0L, k0M, k0N, k0O, k0P, \
k1A, k1B, k1C, k1D, k1E, k1F, k1G, k1H, k1I, k1J, k1K, k1L, k1M, k1N, k1O, k1P, \
k2A, k2B, k2C, k2D, k2E, k2F, k2G, k2H, k2I, k2J, k2K, k2L, k2M, k2N, k2O, k2P, \
k3A, k3B, k3C, k3D, k3E, k3F, k3G, k3H, k3I, k3J, k3K, k3L, k3M, k3N, k3O, k3P, \
k4A, k4B, k4C, k4D, k4E, k4F, k4G, k4H, k4I, k4J, k4K, k4L, k4M, k4N, k4O, k4P, \
k5B, k5C, k5G, k5H, k5I, k5J, k5N, k5O \
) { \
{ k0A, k0B, k0C, k0D, k0E, k0F, k0G, k0H, k0I, k0J, k0K, k0L, k0M, k0N, k0O, k0P }, \
{ k1A, k1B, k1C, k1D, k1E, k1F, k1G, k1H, k1I, k1J, k1K, k1L, k1M, k1N, k1O, k1P }, \
{ k2A, k2B, k2C, k2D, k2E, k2F, k2G, k2H, k2I, k2J, k2K, k2L, k2M, k2N, k2O, k2P }, \
{ k3A, k3B, k3C, k3D, k3E, k3F, k3G, k3H, k3I, k3J, k3K, k3L, k3M, k3N, k3O, k3P }, \
{ k4A, k4B, k4C, k4D, k4E, k4F, k4G, k4H, k4I, k4J, k4K, k4L, k4M, k4N, k4O, k4P }, \
{ XXX, k5B, k5C, XXX, XXX, XXX, k5G, k5H, k5I, k5J, XXX, XXX, XXX, k5N, k5O, XXX } \
}

View File

@@ -1,23 +0,0 @@
/* Copyright 2019
*
* 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"
#define MATRIX_COL_PINS { A3 }
#define MATRIX_ROW_PINS { A2 }
#define UNUSED_PINS

View File

@@ -1,3 +0,0 @@
# PyTest onekey
This is used by the python test framework. It's probably not useful otherwise.

View File

@@ -1,2 +0,0 @@
# MCU name
MCU = STM32F303

View File

View File

@@ -0,0 +1,5 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_ortho_1x1(KC_A)
};

View File

@@ -1,9 +1,9 @@
{
"keyboard": "handwired/onekey/pytest",
"keyboard": "handwired/pytest/basic",
"keymap": "default_json",
"layout": "LAYOUT_ortho_1x1",
"layers": [["KC_A"]],
"author": "qmk",
"notes": "This file is a keymap.json file for handwired/onekey/pytest",
"notes": "This file is a keymap.json file for handwired/pytest/basic",
"version": 1
}

View File

@@ -0,0 +1 @@
MCU = atmega32u4

View File

@@ -0,0 +1,18 @@
#pragma once
#include "config_common.h"
/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0x6465
#define DEVICE_VER 0x0001
#define MANUFACTURER none
#define PRODUCT pytest
/* key matrix size */
#define MATRIX_ROWS 1
#define MATRIX_COLS 1
#define MATRIX_COL_PINS { F4 }
#define MATRIX_ROW_PINS { F5 }
#define DIODE_DIRECTION COL2ROW

View File

@@ -0,0 +1,3 @@
MCU = atmega32u4
LAYOUTS = ortho_1x1

View File

@@ -0,0 +1,5 @@
#include QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
LAYOUT_ortho_1x1(KC_A)
};

View File

@@ -0,0 +1,9 @@
{
"keyboard": "handwired/pytest/has_template",
"keymap": "default_json",
"layout": "LAYOUT_ortho_1x1",
"layers": [["KC_A"]],
"author": "qmk",
"notes": "This file is a keymap.json file for handwired/pytest/has_template",
"version": 1
}

View File

@@ -0,0 +1 @@
MCU = atmega32u4

View File

@@ -1,3 +1,3 @@
{
"documentation": "This file is a keymap.json file for handwired/onekey/pytest"
"documentation": "This file is a keymap.json file for handwired/pytest/has_template"
}

View File

@@ -0,0 +1,11 @@
#pragma once
#include "quantum.h"
#define LAYOUT_ortho_1x1( \
k00 \
) { \
{ k00 } \
}
#define LAYOUT LAYOUT_ortho_1x1

View File

@@ -17,3 +17,4 @@
#pragma once
// place overrides here
#define TAPPING_TOGGLE 2

View File

@@ -15,9 +15,6 @@
*/
#include QMK_KEYBOARD_H
#define TAPPING_TOGGLE 2
// Layer names
#define base 0
#define shrek 1

View File

@@ -1,19 +1,19 @@
/*
/*
Copyright 2020 Garret Gartner
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/>.
*/
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
@@ -159,7 +159,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// KEYMAP TEMPLATE:
//
//
// /* <_LAYER>:
// *
// * ┌────┐ ┌────┐ ┌────┬────┬────┐
@@ -185,16 +185,15 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// Per-Key Tapping Term Definitions:
uint16_t get_tapping_term(uint16_t keycode) {
switch (keycode) {
case TD(TD_DBQT):
return 235;
default:
return TAPPING_TERM;
}
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TD(TD_DBQT):
return 235;
default:
return TAPPING_TERM;
}
}
// Encoder Customization: (*Order-of-Keycode Specific)
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {

View File

@@ -1,19 +1,19 @@
/*
/*
Copyright 2020 Garret Gartner
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/>.
*/
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
@@ -184,19 +184,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
// )
// Per-Key Tapping Term Definitions:
uint16_t get_tapping_term(uint16_t keycode) {
switch (keycode) {
case TD(TD_DBQT):
return 235;
default:
return TAPPING_TERM;
}
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case TD(TD_DBQT):
return 235;
default:
return TAPPING_TERM;
}
}
// Encoder Customization: (*Order-of-Keycode Specific)
void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {

View File

@@ -99,7 +99,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
)
};
uint16_t get_tapping_term(uint16_t keycode) {
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case KC_SPRA:
return TAPPING_LAYER_TERM;

View File

@@ -15,13 +15,16 @@
*/
#include <math.h>
#include <string.h>
#include <stdlib.h>
#ifdef __AVR__
# include <avr/eeprom.h>
# include <avr/interrupt.h>
#endif
#ifdef EEPROM_ENABLE
# include "eeprom.h"
#endif
#ifdef STM32_EEPROM_ENABLE
# include <hal.h>
# include "eeprom.h"
# include "eeprom_stm32.h"
#endif
#include "wait.h"
@@ -38,17 +41,23 @@
// MxSS custom
#include "mxss_frontled.h"
#ifndef MIN
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifdef RGBLIGHT_SPLIT
/* for split keyboard */
# define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE
# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS
# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS rgblight_status.change_flags |= (RGBLIGHT_STATUS_CHANGE_MODE | RGBLIGHT_STATUS_CHANGE_HSVS)
# define RGBLIGHT_SPLIT_SET_CHANGE_LAYERS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_LAYERS
# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER
# define RGBLIGHT_SPLIT_ANIMATION_TICK rgblight_status.change_flags |= RGBLIGHT_STATUS_ANIMATION_TICK
#else
# define RGBLIGHT_SPLIT_SET_CHANGE_MODE
# define RGBLIGHT_SPLIT_SET_CHANGE_HSVS
# define RGBLIGHT_SPLIT_SET_CHANGE_MODEHSVS
# define RGBLIGHT_SPLIT_SET_CHANGE_LAYERS
# define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE
# define RGBLIGHT_SPLIT_ANIMATION_TICK
#endif
@@ -97,11 +106,11 @@ LED_TYPE led[RGBLED_NUM];
# define LED_ARRAY led
#endif
static uint8_t clipping_start_pos = 0;
static uint8_t clipping_num_leds = RGBLED_NUM;
static uint8_t effect_start_pos = 0;
static uint8_t effect_end_pos = RGBLED_NUM;
static uint8_t effect_num_leds = RGBLED_NUM;
#ifdef RGBLIGHT_LAYERS
rgblight_segment_t const *const *rgblight_layers = NULL;
#endif
rgblight_ranges_t rgblight_ranges = {0, RGBLED_NUM, 0, RGBLED_NUM, RGBLED_NUM};
// MxSS custom
extern uint8_t fled_mode;
@@ -116,18 +125,20 @@ void copyrgb(LED_TYPE *src, LED_TYPE *dst) {
}
void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds) {
clipping_start_pos = start_pos;
clipping_num_leds = num_leds;
rgblight_ranges.clipping_start_pos = start_pos;
rgblight_ranges.clipping_num_leds = num_leds;
}
void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds) {
if (start_pos >= RGBLED_NUM) return;
if (start_pos + num_leds > RGBLED_NUM) return;
effect_start_pos = start_pos;
effect_end_pos = start_pos + num_leds;
effect_num_leds = num_leds;
rgblight_ranges.effect_start_pos = start_pos;
rgblight_ranges.effect_end_pos = start_pos + num_leds;
rgblight_ranges.effect_num_leds = num_leds;
}
__attribute__((weak)) RGB rgblight_hsv_to_rgb(HSV hsv) { return hsv_to_rgb(hsv); }
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
HSV hsv = {hue, sat, val};
// MxSS custom
@@ -138,7 +149,8 @@ void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1) {
} else if (led1 == &led[RGBLIGHT_FLED2]) {
fled_hs[1].hue = hue;
fled_hs[1].sat = sat;
} RGB rgb = hsv_to_rgb(hsv);
}
RGB rgb = rgblight_hsv_to_rgb(hsv);
setrgb(rgb.r, rgb.g, rgb.b, led1);
}
@@ -168,7 +180,7 @@ void rgblight_check_config(void) {
}
uint32_t eeconfig_read_rgblight(void) {
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
#ifdef EEPROM_ENABLE
return eeprom_read_dword(EECONFIG_RGBLIGHT);
#else
return 0;
@@ -176,15 +188,13 @@ uint32_t eeconfig_read_rgblight(void) {
}
void eeconfig_update_rgblight(uint32_t val) {
#if defined(__AVR__) || defined(STM32_EEPROM_ENABLE) || defined(PROTOCOL_ARM_ATSAM) || defined(EEPROM_SIZE)
#ifdef EEPROM_ENABLE
rgblight_check_config();
eeprom_update_dword(EECONFIG_RGBLIGHT, val);
#endif
}
void eeconfig_update_rgblight_current(void) {
eeconfig_update_rgblight(rgblight_config.raw);
}
void eeconfig_update_rgblight_current(void) { eeconfig_update_rgblight(rgblight_config.raw); }
void eeconfig_update_rgblight_default(void) {
rgblight_config.enable = 1;
@@ -233,9 +243,7 @@ void rgblight_init(void) {
eeconfig_debug_rgblight(); // display current eeprom values
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_init(); // setup the timer
#endif
if (rgblight_config.enable) {
rgblight_mode_noeeprom(rgblight_config.mode);
@@ -252,9 +260,7 @@ void rgblight_update_dword(uint32_t dword) {
if (rgblight_config.enable)
rgblight_mode_noeeprom(rgblight_config.mode);
else {
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_disable();
#endif
rgblight_set();
}
}
@@ -322,13 +328,9 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) {
dprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode);
}
if (is_static_effect(rgblight_config.mode)) {
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_disable();
#endif
} else {
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_enable();
#endif
}
#ifdef RGBLIGHT_USE_TIMER
animation_status.restart = true;
@@ -376,9 +378,7 @@ void rgblight_disable(void) {
rgblight_config.enable = 0;
eeconfig_update_rgblight(rgblight_config.raw);
dprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_disable();
#endif
RGBLIGHT_SPLIT_SET_CHANGE_MODE;
wait_ms(50);
rgblight_set();
@@ -387,14 +387,14 @@ void rgblight_disable(void) {
void rgblight_disable_noeeprom(void) {
rgblight_config.enable = 0;
dprintf("rgblight disable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable);
#ifdef RGBLIGHT_USE_TIMER
rgblight_timer_disable();
#endif
RGBLIGHT_SPLIT_SET_CHANGE_MODE;
wait_ms(50);
rgblight_set();
}
bool rgblight_is_enabled(void) { return rgblight_config.enable; }
void rgblight_increase_hue_helper(bool write_to_eeprom) {
uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP;
rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom);
@@ -431,17 +431,25 @@ void rgblight_decrease_val_helper(bool write_to_eeprom) {
}
void rgblight_decrease_val_noeeprom(void) { rgblight_decrease_val_helper(false); }
void rgblight_decrease_val(void) { rgblight_decrease_val_helper(true); }
void rgblight_increase_speed(void) {
void rgblight_increase_speed_helper(bool write_to_eeprom) {
if (rgblight_config.speed < 3) rgblight_config.speed++;
// RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED?
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
if (write_to_eeprom) {
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
}
}
void rgblight_decrease_speed(void) {
void rgblight_increase_speed(void) { rgblight_increase_speed_helper(true); }
void rgblight_increase_speed_noeeprom(void) { rgblight_increase_speed_helper(false); }
void rgblight_decrease_speed_helper(bool write_to_eeprom) {
if (rgblight_config.speed > 0) rgblight_config.speed--;
// RGBLIGHT_SPLIT_SET_CHANGE_HSVS; // NEED??
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
if (write_to_eeprom) {
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
}
}
void rgblight_decrease_speed(void) { rgblight_decrease_speed_helper(true); }
void rgblight_decrease_speed_noeeprom(void) { rgblight_decrease_speed_helper(false); }
void rgblight_sethsv_noeeprom_old(uint8_t hue, uint8_t sat, uint8_t val) {
if (rgblight_config.enable) {
@@ -502,15 +510,15 @@ void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool w
# else
uint8_t range = RGBLED_GRADIENT_RANGES[delta / 2];
# endif
for (uint8_t i = 0; i < effect_num_leds; i++) {
uint8_t _hue = ((uint16_t)i * (uint16_t)range) / effect_num_leds;
for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) {
uint8_t _hue = ((uint16_t)i * (uint16_t)range) / rgblight_ranges.effect_num_leds;
if (direction) {
_hue = hue + _hue;
} else {
_hue = hue - _hue;
}
dprintf("rgblight rainbow set hsv: %d,%d,%d,%u\n", i, _hue, direction, range);
sethsv(_hue, sat, val, (LED_TYPE *)&led[i + effect_start_pos]);
sethsv(_hue, sat, val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
}
rgblight_set();
}
@@ -542,7 +550,7 @@ uint8_t rgblight_get_speed(void) { return rgblight_config.speed; }
void rgblight_set_speed_eeprom_helper(uint8_t speed, bool write_to_eeprom) {
rgblight_config.speed = speed;
if (write_to_eeprom) {
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
eeconfig_update_rgblight(rgblight_config.raw); // EECONFIG needs to be increased to support this
dprintf("rgblight set speed [EEPROM]: %u\n", rgblight_config.speed);
} else {
dprintf("rgblight set speed [NOEEPROM]: %u\n", rgblight_config.speed);
@@ -559,12 +567,14 @@ uint8_t rgblight_get_sat(void) { return rgblight_config.sat; }
uint8_t rgblight_get_val(void) { return rgblight_config.val; }
HSV rgblight_get_hsv(void) { return (HSV){rgblight_config.hue, rgblight_config.sat, rgblight_config.val}; }
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
if (!rgblight_config.enable) {
return;
}
for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) {
for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
@@ -599,7 +609,7 @@ void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index) {
rgblight_setrgb_at(tmp_led.r, tmp_led.g, tmp_led.b, index);
}
#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT)
#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) || defined(RGBLIGHT_EFFECT_TWINKLE)
static uint8_t get_interval_time(const uint8_t *default_interval_address, uint8_t velocikey_min, uint8_t velocikey_max) {
return
@@ -648,13 +658,97 @@ void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_se
void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val) { rgblight_sethsv_range(hue, sat, val, (uint8_t)RGBLED_NUM / 2, (uint8_t)RGBLED_NUM); }
#endif // ifndef RGBLIGHT_SPLIT
#ifdef RGBLIGHT_LAYERS
void rgblight_set_layer_state(uint8_t layer, bool enabled) {
rgblight_layer_mask_t mask = 1 << layer;
if (enabled) {
rgblight_status.enabled_layer_mask |= mask;
} else {
rgblight_status.enabled_layer_mask &= ~mask;
}
RGBLIGHT_SPLIT_SET_CHANGE_LAYERS;
// Static modes don't have a ticker running to update the LEDs
if (rgblight_status.timer_enabled == false) {
rgblight_mode_noeeprom(rgblight_config.mode);
}
# ifdef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
// If not enabled, then nothing else will actually set the LEDs...
if (!rgblight_config.enable) {
rgblight_set();
}
# endif
}
bool rgblight_get_layer_state(uint8_t layer) {
rgblight_layer_mask_t mask = 1 << layer;
return (rgblight_status.enabled_layer_mask & mask) != 0;
}
// Write any enabled LED layers into the buffer
static void rgblight_layers_write(void) {
uint8_t i = 0;
// For each layer
for (const rgblight_segment_t *const *layer_ptr = rgblight_layers; i < RGBLIGHT_MAX_LAYERS; layer_ptr++, i++) {
if (!rgblight_get_layer_state(i)) {
continue; // Layer is disabled
}
const rgblight_segment_t *segment_ptr = pgm_read_ptr(layer_ptr);
if (segment_ptr == NULL) {
break; // No more layers
}
// For each segment
while (1) {
rgblight_segment_t segment;
memcpy_P(&segment, segment_ptr, sizeof(rgblight_segment_t));
if (segment.index == RGBLIGHT_END_SEGMENT_INDEX) {
break; // No more segments
}
// Write segment.count LEDs
LED_TYPE *const limit = &led[MIN(segment.index + segment.count, RGBLED_NUM)];
for (LED_TYPE *led_ptr = &led[segment.index]; led_ptr < limit; led_ptr++) {
sethsv(segment.hue, segment.sat, segment.val, led_ptr);
}
segment_ptr++;
}
}
}
# ifdef RGBLIGHT_LAYER_BLINK
rgblight_layer_mask_t _blinked_layer_mask = 0;
uint16_t _blink_duration = 0;
static uint16_t _blink_timer;
void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) {
rgblight_set_layer_state(layer, true);
_blinked_layer_mask |= 1 << layer;
_blink_timer = timer_read();
_blink_duration = duration_ms;
}
void rgblight_unblink_layers(void) {
if (_blinked_layer_mask != 0 && timer_elapsed(_blink_timer) > _blink_duration) {
for (uint8_t layer = 0; layer < RGBLIGHT_MAX_LAYERS; layer++) {
if ((_blinked_layer_mask & 1 << layer) != 0) {
rgblight_set_layer_state(layer, false);
}
}
_blinked_layer_mask = 0;
}
}
# endif
#endif
__attribute__((weak)) void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) { ws2812_setleds(start_led, num_leds); }
#ifndef RGBLIGHT_CUSTOM_DRIVER
void rgblight_set(void) {
LED_TYPE *start_led;
uint16_t num_leds = clipping_num_leds;
uint8_t num_leds = rgblight_ranges.clipping_num_leds;
if (!rgblight_config.enable) {
for (uint8_t i = effect_start_pos; i < effect_end_pos; i++) {
for (uint8_t i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
if (i == RGBLIGHT_FLED1 && i == RGBLIGHT_FLED2)
continue;
@@ -667,54 +761,63 @@ void rgblight_set(void) {
}
}
# ifdef RGBLIGHT_LAYERS
if (rgblight_layers != NULL
# ifndef RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
&& rgblight_config.enable
# endif
) {
rgblight_layers_write();
}
# endif
# ifdef RGBLIGHT_LED_MAP
LED_TYPE led0[RGBLED_NUM];
for (uint8_t i = 0; i < RGBLED_NUM; i++) {
led0[i] = led[pgm_read_byte(&led_map[i])];
}
start_led = led0 + clipping_start_pos;
start_led = led0 + rgblight_ranges.clipping_start_pos;
# else
start_led = led + clipping_start_pos;
start_led = led + rgblight_ranges.clipping_start_pos;
# endif
#ifdef RGBW
# ifdef RGBW
for (uint8_t i = 0; i < num_leds; i++) {
convert_rgb_to_rgbw(&start_led[i]);
}
#endif
# endif
// MxSS custom
switch (fled_mode) {
case FLED_OFF:
setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]);
setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
break;
case FLED_INDI:
copyrgb(&fleds[0], &led[RGBLIGHT_FLED1]);
copyrgb(&fleds[1], &led[RGBLIGHT_FLED2]);
break;
case FLED_RGB:
if (fled_hs[0].hue == 0 && fled_hs[0].hue == 0 &&
(rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE ||
rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT))
case FLED_OFF:
setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]);
else
sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]);
setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
break;
if (fled_hs[1].hue == 0 && fled_hs[1].hue == 0 &&
case FLED_INDI:
copyrgb(&fleds[0], &led[RGBLIGHT_FLED1]);
copyrgb(&fleds[1], &led[RGBLIGHT_FLED2]);
break;
case FLED_RGB:
if (fled_hs[0].hue == 0 && fled_hs[0].hue == 0 &&
(rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE ||
rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT))
setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
else
sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]);
break;
setrgb(0, 0, 0, &led[RGBLIGHT_FLED1]);
else
sethsv(fled_hs[0].hue, fled_hs[0].sat, fled_val, &led[RGBLIGHT_FLED1]);
default:
break;
}
if (fled_hs[1].hue == 0 && fled_hs[1].hue == 0 &&
(rgblight_status.base_mode == RGBLIGHT_MODE_SNAKE ||
rgblight_status.base_mode == RGBLIGHT_MODE_KNIGHT))
setrgb(0, 0, 0, &led[RGBLIGHT_FLED2]);
else
sethsv(fled_hs[1].hue, fled_hs[1].sat, fled_val, &led[RGBLIGHT_FLED2]);
break;
default:
break;
}
ws2812_setleds(start_led, num_leds);
rgblight_call_driver(start_led, num_leds);
}
#endif
@@ -731,6 +834,11 @@ void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo) {
/* for split keyboard slave side */
void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom) {
# ifdef RGBLIGHT_LAYERS
if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_LAYERS) {
rgblight_status.enabled_layer_mask = syncinfo->status.enabled_layer_mask;
}
# endif
if (syncinfo->status.change_flags & RGBLIGHT_STATUS_CHANGE_MODE) {
if (syncinfo->config.enable) {
rgblight_config.enable = 1; // == rgblight_enable_noeeprom();
@@ -892,6 +1000,12 @@ void rgblight_task(void) {
interval_time = 500;
effect_func = (effect_func_t)rgblight_effect_alternating;
}
# endif
# ifdef RGBLIGHT_EFFECT_TWINKLE
else if (rgblight_status.base_mode == RGBLIGHT_MODE_TWINKLE) {
interval_time = get_interval_time(&RGBLED_TWINKLE_INTERVALS[delta % 3], 5, 50);
effect_func = (effect_func_t)rgblight_effect_twinkle;
}
# endif
if (animation_status.restart) {
animation_status.restart = false;
@@ -922,6 +1036,10 @@ void rgblight_task(void) {
# endif
}
}
# ifdef RGBLIGHT_LAYER_BLINK
rgblight_unblink_layers();
# endif
}
#endif /* RGBLIGHT_USE_TIMER */
@@ -972,9 +1090,9 @@ void rgblight_effect_rainbow_swirl(animation_status_t *anim) {
uint8_t hue;
uint8_t i;
for (i = 0; i < effect_num_leds; i++) {
hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / effect_num_leds * i + anim->current_hue);
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]);
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
hue = (RGBLIGHT_RAINBOW_SWIRL_RANGE / rgblight_ranges.effect_num_leds * i + anim->current_hue);
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
}
rgblight_set();
@@ -1002,7 +1120,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
if (anim->pos == 0) { // restart signal
if (increment == 1) {
pos = effect_num_leds - 1;
pos = rgblight_ranges.effect_num_leds - 1;
} else {
pos = 0;
}
@@ -1014,8 +1132,8 @@ void rgblight_effect_snake(animation_status_t *anim) {
fled_hs[0].hue = fled_hs[1].hue = 0;
fled_hs[0].sat = fled_hs[1].sat = 0;
for (i = 0; i < effect_num_leds; i++) {
LED_TYPE *ledp = led + i + effect_start_pos;
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos;
ledp->r = 0;
ledp->g = 0;
ledp->b = 0;
@@ -1028,7 +1146,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
k = k % RGBLED_NUM;
}
if (k < 0) {
k = k + effect_num_leds;
k = k + rgblight_ranges.effect_num_leds;
}
if (i == k) {
sethsv(rgblight_config.hue, rgblight_config.sat, (uint8_t)(rgblight_config.val * (RGBLIGHT_EFFECT_SNAKE_LENGTH - j) / RGBLIGHT_EFFECT_SNAKE_LENGTH), ledp);
@@ -1038,7 +1156,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
rgblight_set();
if (increment == 1) {
if (pos - 1 < 0) {
pos = effect_num_leds - 1;
pos = rgblight_ranges.effect_num_leds - 1;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = 0;
# endif
@@ -1049,7 +1167,7 @@ void rgblight_effect_snake(animation_status_t *anim) {
# endif
}
} else {
pos = (pos + 1) % effect_num_leds;
pos = (pos + 1) % rgblight_ranges.effect_num_leds;
# if defined(RGBLIGHT_SPLIT) && !defined(RGBLIGHT_SPLIT_NO_ANIMATION_SYNC)
anim->pos = pos;
# endif
@@ -1075,7 +1193,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
}
# endif
// Set all the LEDs to 0
for (i = effect_start_pos; i < effect_end_pos; i++) {
for (i = rgblight_ranges.effect_start_pos; i < rgblight_ranges.effect_end_pos; i++) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
@@ -1085,7 +1203,7 @@ void rgblight_effect_knight(animation_status_t *anim) {
}
// Determine which LEDs should be lit up
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % effect_num_leds + effect_start_pos;
cur = (i + RGBLIGHT_EFFECT_KNIGHT_OFFSET) % rgblight_ranges.effect_num_leds + rgblight_ranges.effect_start_pos;
if (i >= low_bound && i <= high_bound) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[cur]);
@@ -1124,16 +1242,39 @@ void rgblight_effect_knight(animation_status_t *anim) {
#endif
#ifdef RGBLIGHT_EFFECT_CHRISTMAS
void rgblight_effect_christmas(animation_status_t *anim) {
uint8_t hue;
uint8_t i;
# define CUBED(x) ((x) * (x) * (x))
anim->current_offset = (anim->current_offset + 1) % 2;
for (i = 0; i < effect_num_leds; i++) {
hue = 0 + ((i / RGBLIGHT_EFFECT_CHRISTMAS_STEP + anim->current_offset) % 2) * 85;
sethsv(hue, rgblight_config.sat, rgblight_config.val, (LED_TYPE *)&led[i + effect_start_pos]);
/**
* Christmas lights effect, with a smooth animation between red & green.
*/
void rgblight_effect_christmas(animation_status_t *anim) {
static int8_t increment = 1;
const uint8_t max_pos = 32;
const uint8_t hue_green = 85;
uint32_t xa;
uint8_t hue, val;
uint8_t i;
// The effect works by animating anim->pos from 0 to 32 and back to 0.
// The pos is used in a cubic bezier formula to ease-in-out between red and green, leaving the interpolated colors visible as short as possible.
xa = CUBED((uint32_t)anim->pos);
hue = ((uint32_t)hue_green) * xa / (xa + CUBED((uint32_t)(max_pos - anim->pos)));
// Additionally, these interpolated colors get shown with a slightly darker value, to make them less prominent than the main colors.
val = 255 - (3 * (hue < hue_green / 2 ? hue : hue_green - hue) / 2);
for (i = 0; i < rgblight_ranges.effect_num_leds; i++) {
uint8_t local_hue = (i / RGBLIGHT_EFFECT_CHRISTMAS_STEP) % 2 ? hue : hue_green - hue;
sethsv(local_hue, rgblight_config.sat, val, (LED_TYPE *)&led[i + rgblight_ranges.effect_start_pos]);
}
rgblight_set();
if (anim->pos == 0) {
increment = 1;
} else if (anim->pos == max_pos) {
increment = -1;
}
anim->pos += increment;
}
#endif
@@ -1183,11 +1324,11 @@ void rgblight_effect_rgbtest(animation_status_t *anim) {
#ifdef RGBLIGHT_EFFECT_ALTERNATING
void rgblight_effect_alternating(animation_status_t *anim) {
for (int i = 0; i < effect_num_leds; i++) {
LED_TYPE *ledp = led + i + effect_start_pos;
if (i < effect_num_leds / 2 && anim->pos) {
for (int i = 0; i < rgblight_ranges.effect_num_leds; i++) {
LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos;
if (i < rgblight_ranges.effect_num_leds / 2 && anim->pos) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
} else if (i >= effect_num_leds / 2 && !anim->pos) {
} else if (i >= rgblight_ranges.effect_num_leds / 2 && !anim->pos) {
sethsv(rgblight_config.hue, rgblight_config.sat, rgblight_config.val, ledp);
} else {
sethsv(rgblight_config.hue, rgblight_config.sat, 0, ledp);
@@ -1197,3 +1338,58 @@ void rgblight_effect_alternating(animation_status_t *anim) {
anim->pos = (anim->pos + 1) % 2;
}
#endif
#ifdef RGBLIGHT_EFFECT_TWINKLE
__attribute__((weak)) const uint8_t RGBLED_TWINKLE_INTERVALS[] PROGMEM = {50, 25, 10};
typedef struct PACKED {
HSV hsv;
uint8_t life;
bool up;
} TwinkleState;
static TwinkleState led_twinkle_state[RGBLED_NUM];
void rgblight_effect_twinkle(animation_status_t *anim) {
bool random_color = anim->delta / 3;
bool restart = anim->pos == 0;
anim->pos = 1;
for (uint8_t i = 0; i < rgblight_ranges.effect_num_leds; i++) {
TwinkleState *t = &(led_twinkle_state[i]);
HSV * c = &(t->hsv);
if (restart) {
// Restart
t->life = 0;
t->hsv.v = 0;
} else if (t->life) {
// This LED is already on, either brightening or dimming
t->life--;
uint8_t on = t->up ? RGBLIGHT_EFFECT_TWINKLE_LIFE - t->life : t->life;
c->v = (uint16_t)rgblight_config.val * on / RGBLIGHT_EFFECT_TWINKLE_LIFE;
if (t->life == 0 && t->up) {
t->up = false;
t->life = RGBLIGHT_EFFECT_TWINKLE_LIFE;
}
if (!random_color) {
c->h = rgblight_config.hue;
c->s = rgblight_config.sat;
}
} else if (rand() < RAND_MAX * RGBLIGHT_EFFECT_TWINKLE_PROBABILITY) {
// This LED is off, but was randomly selected to start brightening
c->h = random_color ? rand() % 0xFF : rgblight_config.hue;
c->s = random_color ? (rand() % (rgblight_config.sat / 2)) + (rgblight_config.sat / 2) : rgblight_config.sat;
c->v = 0;
t->life = RGBLIGHT_EFFECT_TWINKLE_LIFE;
t->up = true;
} else {
// This LED is off, and was NOT selected to start brightening
}
LED_TYPE *ledp = led + i + rgblight_ranges.effect_start_pos;
sethsv(c->h, c->s, c->v, ledp);
}
rgblight_set();
}
#endif

View File

@@ -1,358 +0,0 @@
/* Copyright 2017 Yang Liu
*
* 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/>.
*/
#ifndef RGBLIGHT_H
#define RGBLIGHT_H
/***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) ****
old mode number (before 0.6.117) to new mode name table
|-----------------|-----------------------------------|
| old mode number | new mode name |
|-----------------|-----------------------------------|
| 1 | RGBLIGHT_MODE_STATIC_LIGHT |
| 2 | RGBLIGHT_MODE_BREATHING |
| 3 | RGBLIGHT_MODE_BREATHING + 1 |
| 4 | RGBLIGHT_MODE_BREATHING + 2 |
| 5 | RGBLIGHT_MODE_BREATHING + 3 |
| 6 | RGBLIGHT_MODE_RAINBOW_MOOD |
| 7 | RGBLIGHT_MODE_RAINBOW_MOOD + 1 |
| 8 | RGBLIGHT_MODE_RAINBOW_MOOD + 2 |
| 9 | RGBLIGHT_MODE_RAINBOW_SWIRL |
| 10 | RGBLIGHT_MODE_RAINBOW_SWIRL + 1 |
| 11 | RGBLIGHT_MODE_RAINBOW_SWIRL + 2 |
| 12 | RGBLIGHT_MODE_RAINBOW_SWIRL + 3 |
| 13 | RGBLIGHT_MODE_RAINBOW_SWIRL + 4 |
| 14 | RGBLIGHT_MODE_RAINBOW_SWIRL + 5 |
| 15 | RGBLIGHT_MODE_SNAKE |
| 16 | RGBLIGHT_MODE_SNAKE + 1 |
| 17 | RGBLIGHT_MODE_SNAKE + 2 |
| 18 | RGBLIGHT_MODE_SNAKE + 3 |
| 19 | RGBLIGHT_MODE_SNAKE + 4 |
| 20 | RGBLIGHT_MODE_SNAKE + 5 |
| 21 | RGBLIGHT_MODE_KNIGHT |
| 22 | RGBLIGHT_MODE_KNIGHT + 1 |
| 23 | RGBLIGHT_MODE_KNIGHT + 2 |
| 24 | RGBLIGHT_MODE_CHRISTMAS |
| 25 | RGBLIGHT_MODE_STATIC_GRADIENT |
| 26 | RGBLIGHT_MODE_STATIC_GRADIENT + 1 |
| 27 | RGBLIGHT_MODE_STATIC_GRADIENT + 2 |
| 28 | RGBLIGHT_MODE_STATIC_GRADIENT + 3 |
| 29 | RGBLIGHT_MODE_STATIC_GRADIENT + 4 |
| 30 | RGBLIGHT_MODE_STATIC_GRADIENT + 5 |
| 31 | RGBLIGHT_MODE_STATIC_GRADIENT + 6 |
| 32 | RGBLIGHT_MODE_STATIC_GRADIENT + 7 |
| 33 | RGBLIGHT_MODE_STATIC_GRADIENT + 8 |
| 34 | RGBLIGHT_MODE_STATIC_GRADIENT + 9 |
| 35 | RGBLIGHT_MODE_RGB_TEST |
| 36 | RGBLIGHT_MODE_ALTERNATING |
|-----------------|-----------------------------------|
*****/
#ifdef RGBLIGHT_ANIMATIONS
// for backward compatibility
# define RGBLIGHT_EFFECT_BREATHING
# define RGBLIGHT_EFFECT_RAINBOW_MOOD
# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
# define RGBLIGHT_EFFECT_SNAKE
# define RGBLIGHT_EFFECT_KNIGHT
# define RGBLIGHT_EFFECT_CHRISTMAS
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
# define RGBLIGHT_EFFECT_RGB_TEST
# define RGBLIGHT_EFFECT_ALTERNATING
#endif
#ifdef RGBLIGHT_STATIC_PATTERNS
# define RGBLIGHT_EFFECT_STATIC_GRADIENT
#endif
// clang-format off
// check dynamic animation effects chose ?
#if defined(RGBLIGHT_EFFECT_BREATHING) \
|| defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) \
|| defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) \
|| defined(RGBLIGHT_EFFECT_SNAKE) \
|| defined(RGBLIGHT_EFFECT_KNIGHT) \
|| defined(RGBLIGHT_EFFECT_CHRISTMAS) \
|| defined(RGBLIGHT_EFFECT_RGB_TEST) \
|| defined(RGBLIGHT_EFFECT_ALTERNATING)
# define RGBLIGHT_USE_TIMER
#endif
// clang-format on
#define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym,
#define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym,
#define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym,
#define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_##sym,
#define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_##sym,
#define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_##sym,
enum RGBLIGHT_EFFECT_MODE {
RGBLIGHT_MODE_zero = 0,
#include "rgblight_modes.h"
RGBLIGHT_MODE_last
};
#ifndef RGBLIGHT_H_DUMMY_DEFINE
# define RGBLIGHT_MODES (RGBLIGHT_MODE_last - 1)
// sample: #define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85
# ifndef RGBLIGHT_EFFECT_BREATHE_MAX
# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0-255
# endif
# ifndef RGBLIGHT_EFFECT_SNAKE_LENGTH
# define RGBLIGHT_EFFECT_SNAKE_LENGTH 4
# endif
# ifndef RGBLIGHT_EFFECT_KNIGHT_LENGTH
# define RGBLIGHT_EFFECT_KNIGHT_LENGTH 3
# endif
# ifndef RGBLIGHT_EFFECT_KNIGHT_OFFSET
# define RGBLIGHT_EFFECT_KNIGHT_OFFSET 0
# endif
# ifndef RGBLIGHT_EFFECT_KNIGHT_LED_NUM
# define RGBLIGHT_EFFECT_KNIGHT_LED_NUM (effect_num_leds)
# endif
# ifndef RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL
# define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 1000
# endif
# ifndef RGBLIGHT_EFFECT_CHRISTMAS_STEP
# define RGBLIGHT_EFFECT_CHRISTMAS_STEP 2
# endif
# ifndef RGBLIGHT_HUE_STEP
# define RGBLIGHT_HUE_STEP 8
# endif
# ifndef RGBLIGHT_SAT_STEP
# define RGBLIGHT_SAT_STEP 17
# endif
# ifndef RGBLIGHT_VAL_STEP
# define RGBLIGHT_VAL_STEP 17
# endif
# ifndef RGBLIGHT_LIMIT_VAL
# define RGBLIGHT_LIMIT_VAL 255
# endif
# define RGBLED_TIMER_TOP F_CPU / (256 * 64)
// #define RGBLED_TIMER_TOP 0xFF10
# include <stdint.h>
# include <stdbool.h>
# include "eeconfig.h"
# ifndef RGBLIGHT_CUSTOM_DRIVER
# include "ws2812.h"
# endif
# include "color.h"
# include "rgblight_list.h"
# if defined(__AVR__)
# include <avr/pgmspace.h>
# endif
extern LED_TYPE led[RGBLED_NUM];
extern const uint8_t RGBLED_BREATHING_INTERVALS[4] PROGMEM;
extern const uint8_t RGBLED_RAINBOW_MOOD_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_RAINBOW_SWIRL_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_SNAKE_INTERVALS[3] PROGMEM;
extern const uint8_t RGBLED_KNIGHT_INTERVALS[3] PROGMEM;
extern const uint16_t RGBLED_RGBTEST_INTERVALS[1] PROGMEM;
extern bool is_rgblight_initialized;
// Should stay in sycn with rgb matrix config as we reuse eeprom storage for both (for now)
typedef union {
uint32_t raw;
struct {
bool enable : 1;
uint8_t mode : 7;
uint8_t hue : 8;
uint8_t sat : 8;
uint8_t val : 8;
uint8_t speed : 8; // EECONFIG needs to be increased to support this
};
} rgblight_config_t;
typedef struct _rgblight_status_t {
uint8_t base_mode;
bool timer_enabled;
# ifdef RGBLIGHT_SPLIT
uint8_t change_flags;
# endif
} rgblight_status_t;
/* === Utility Functions ===*/
void sethsv(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1);
void sethsv_raw(uint8_t hue, uint8_t sat, uint8_t val, LED_TYPE *led1); // without RGBLIGHT_LIMIT_VAL check
void setrgb(uint8_t r, uint8_t g, uint8_t b, LED_TYPE *led1);
/* === Low level Functions === */
void rgblight_set(void);
void rgblight_set_clipping_range(uint8_t start_pos, uint8_t num_leds);
/* === Effects and Animations Functions === */
/* effect range setting */
void rgblight_set_effect_range(uint8_t start_pos, uint8_t num_leds);
/* direct operation */
void rgblight_setrgb_at(uint8_t r, uint8_t g, uint8_t b, uint8_t index);
void rgblight_sethsv_at(uint8_t hue, uint8_t sat, uint8_t val, uint8_t index);
void rgblight_setrgb_range(uint8_t r, uint8_t g, uint8_t b, uint8_t start, uint8_t end);
void rgblight_sethsv_range(uint8_t hue, uint8_t sat, uint8_t val, uint8_t start, uint8_t end);
void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b);
# ifndef RGBLIGHT_SPLIT
void rgblight_setrgb_master(uint8_t r, uint8_t g, uint8_t b);
void rgblight_setrgb_slave(uint8_t r, uint8_t g, uint8_t b);
void rgblight_sethsv_master(uint8_t hue, uint8_t sat, uint8_t val);
void rgblight_sethsv_slave(uint8_t hue, uint8_t sat, uint8_t val);
# endif
/* effect mode change */
void rgblight_mode(uint8_t mode);
void rgblight_mode_noeeprom(uint8_t mode);
void rgblight_increase(void);
void rgblight_decrease(void);
void rgblight_step(void);
void rgblight_step_noeeprom(void);
void rgblight_step_reverse(void);
void rgblight_step_reverse_noeeprom(void);
/* effects mode disable/enable */
void rgblight_toggle(void);
void rgblight_toggle_noeeprom(void);
void rgblight_enable(void);
void rgblight_enable_noeeprom(void);
void rgblight_disable(void);
void rgblight_disable_noeeprom(void);
/* hue, sat, val change */
void rgblight_increase_hue(void);
void rgblight_increase_hue_noeeprom(void);
void rgblight_decrease_hue(void);
void rgblight_decrease_hue_noeeprom(void);
void rgblight_increase_sat(void);
void rgblight_increase_sat_noeeprom(void);
void rgblight_decrease_sat(void);
void rgblight_decrease_sat_noeeprom(void);
void rgblight_increase_val(void);
void rgblight_increase_val_noeeprom(void);
void rgblight_decrease_val(void);
void rgblight_decrease_val_noeeprom(void);
void rgblight_increase_speed(void);
void rgblight_decrease_speed(void);
void rgblight_sethsv(uint8_t hue, uint8_t sat, uint8_t val);
void rgblight_sethsv_noeeprom(uint8_t hue, uint8_t sat, uint8_t val);
/* effect speed */
uint8_t rgblight_get_speed(void);
void rgblight_set_speed(uint8_t speed);
void rgblight_set_speed_noeeprom(uint8_t speed);
/* query */
uint8_t rgblight_get_mode(void);
uint8_t rgblight_get_hue(void);
uint8_t rgblight_get_sat(void);
uint8_t rgblight_get_val(void);
/* === qmk_firmware (core)internal Functions === */
void rgblight_init(void);
uint32_t rgblight_read_dword(void);
void rgblight_update_dword(uint32_t dword);
uint32_t eeconfig_read_rgblight(void);
void eeconfig_update_rgblight(uint32_t val);
void eeconfig_update_rgblight_current(void);
void eeconfig_update_rgblight_default(void);
void eeconfig_debug_rgblight(void);
void rgb_matrix_increase(void);
void rgb_matrix_decrease(void);
void rgblight_sethsv_eeprom_helper(uint8_t hue, uint8_t sat, uint8_t val, bool write_to_eeprom);
void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom);
# define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF)
void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b);
# ifdef RGBLIGHT_USE_TIMER
void rgblight_task(void);
void rgblight_timer_init(void);
void rgblight_timer_enable(void);
void rgblight_timer_disable(void);
void rgblight_timer_toggle(void);
# else
# define rgblight_task()
# define rgblight_timer_init()
# define rgblight_timer_enable()
# define rgblight_timer_disable()
# define rgblight_timer_toggle()
# endif
# ifdef RGBLIGHT_SPLIT
# define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0)
# define RGBLIGHT_STATUS_CHANGE_HSVS (1 << 1)
# define RGBLIGHT_STATUS_CHANGE_TIMER (1 << 2)
# define RGBLIGHT_STATUS_ANIMATION_TICK (1 << 3)
typedef struct _rgblight_syncinfo_t {
rgblight_config_t config;
rgblight_status_t status;
} rgblight_syncinfo_t;
/* for split keyboard master side */
uint8_t rgblight_get_change_flags(void);
void rgblight_clear_change_flags(void);
void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo);
/* for split keyboard slave side */
void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom);
# endif
# ifdef RGBLIGHT_USE_TIMER
typedef struct _animation_status_t {
uint16_t last_timer;
uint8_t delta; /* mode - base_mode */
bool restart;
union {
uint16_t pos16;
uint8_t pos;
int8_t current_hue;
uint16_t current_offset;
};
} animation_status_t;
extern animation_status_t animation_status;
void rgblight_effect_breathing(animation_status_t *anim);
void rgblight_effect_rainbow_mood(animation_status_t *anim);
void rgblight_effect_rainbow_swirl(animation_status_t *anim);
void rgblight_effect_snake(animation_status_t *anim);
void rgblight_effect_knight(animation_status_t *anim);
void rgblight_effect_christmas(animation_status_t *anim);
void rgblight_effect_rgbtest(animation_status_t *anim);
void rgblight_effect_alternating(animation_status_t *anim);
# endif
#endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE
#endif // RGBLIGHT_H

View File

@@ -69,7 +69,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define B5_AUDIO
#define AUDIO_CLICKY
#define NO_MUSIC_MODE
/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5
@@ -81,5 +81,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

View File

@@ -15,6 +15,7 @@ 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
LTO_ENABLE = yes # Link Time Optimization, makes the firmware smaller but some features may not work
NKRO_ENABLE = no # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
@@ -23,4 +24,4 @@ AUDIO_ENABLE = yes # Audio output
ENCODER_ENABLE = yes # Enable Rotary Encoders
# Added encoder Action
SRC += encoder_action.c
SRC += encoder_action.c

View File

@@ -1,5 +1,5 @@
{
"keyboard":"handwired/onekey/pytest",
"keyboard":"handwired/pytest/basic",
"keymap":"pytest_unittest",
"layout":"LAYOUT",
"layers":[["KC_A"]]

View File

@@ -38,17 +38,17 @@ def test_cformat():
def test_compile():
result = check_subcommand('compile', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n')
result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n')
check_returncode(result)
def test_compile_json():
result = check_subcommand('compile', '-kb', 'handwired/onekey/pytest', '-km', 'default_json', '-n')
result = check_subcommand('compile', '-kb', 'handwired/pytest/basic', '-km', 'default_json', '-n')
check_returncode(result)
def test_flash():
result = check_subcommand('flash', '-kb', 'handwired/onekey/pytest', '-km', 'default', '-n')
result = check_subcommand('flash', '-kb', 'handwired/pytest/basic', '-km', 'default', '-n')
check_returncode(result)
@@ -92,20 +92,26 @@ def test_list_keyboards():
result = check_subcommand('list-keyboards')
check_returncode(result)
# check to see if a known keyboard is returned
# this will fail if handwired/onekey/pytest is removed
assert 'handwired/onekey/pytest' in result.stdout
# this will fail if handwired/pytest/basic is removed
assert 'handwired/pytest/basic' in result.stdout
def test_list_keymaps():
result = check_subcommand('list-keymaps', '-kb', 'handwired/onekey/pytest')
result = check_subcommand('list-keymaps', '-kb', 'handwired/pytest/basic')
check_returncode(result)
assert 'default' and 'test' in result.stdout
assert 'default' and 'default_json' in result.stdout
def test_list_keymaps_long():
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/onekey/pytest')
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/basic')
check_returncode(result)
assert 'default' and 'test' in result.stdout
assert 'default' and 'default_json' in result.stdout
def test_list_keymaps_community():
result = check_subcommand('list-keymaps', '--keyboard', 'handwired/pytest/has_community')
check_returncode(result)
assert 'test' in result.stdout
def test_list_keymaps_kb_only():
@@ -133,40 +139,40 @@ def test_list_keymaps_no_keyboard_found():
def test_json2c():
result = check_subcommand('json2c', 'keyboards/handwired/onekey/keymaps/default_json/keymap.json')
result = check_subcommand('json2c', 'keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json')
check_returncode(result)
assert result.stdout == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT_ortho_1x1(KC_A)};\n\n'
def test_json2c_stdin():
result = check_subcommand_stdin('keyboards/handwired/onekey/keymaps/default_json/keymap.json', 'json2c', '-')
result = check_subcommand_stdin('keyboards/handwired/pytest/has_template/keymaps/default_json/keymap.json', 'json2c', '-')
check_returncode(result)
assert result.stdout == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT_ortho_1x1(KC_A)};\n\n'
def test_info():
result = check_subcommand('info', '-kb', 'handwired/onekey/pytest')
result = check_subcommand('info', '-kb', 'handwired/pytest/basic')
check_returncode(result)
assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout
assert 'Processor: STM32F303' in result.stdout
assert 'Keyboard Name: handwired/pytest/basic' in result.stdout
assert 'Processor: atmega32u4' in result.stdout
assert 'Layout:' not in result.stdout
assert 'k0' not in result.stdout
def test_info_keyboard_render():
result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-l')
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-l')
check_returncode(result)
assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout
assert 'Processor: STM32F303' in result.stdout
assert 'Keyboard Name: handwired/pytest/basic' in result.stdout
assert 'Processor: atmega32u4' in result.stdout
assert 'Layouts:' in result.stdout
assert 'k0' in result.stdout
def test_info_keymap_render():
result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-km', 'default_json')
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-km', 'default_json')
check_returncode(result)
assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout
assert 'Processor: STM32F303' in result.stdout
assert 'Keyboard Name: handwired/pytest/basic' in result.stdout
assert 'Processor: atmega32u4' in result.stdout
if is_windows:
assert '|A |' in result.stdout
@@ -175,10 +181,10 @@ def test_info_keymap_render():
def test_info_matrix_render():
result = check_subcommand('info', '-kb', 'handwired/onekey/pytest', '-m')
result = check_subcommand('info', '-kb', 'handwired/pytest/basic', '-m')
check_returncode(result)
assert 'Keyboard Name: handwired/onekey/pytest' in result.stdout
assert 'Processor: STM32F303' in result.stdout
assert 'Keyboard Name: handwired/pytest/basic' in result.stdout
assert 'Processor: atmega32u4' in result.stdout
assert 'LAYOUT_ortho_1x1' in result.stdout
if is_windows:
@@ -190,27 +196,27 @@ def test_info_matrix_render():
def test_c2json():
result = check_subcommand("c2json", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/default/keymap.c")
result = check_subcommand("c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/default/keymap.c")
check_returncode(result)
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
def test_c2json_nocpp():
result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/onekey/pytest", "-km", "default", "keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c")
result = check_subcommand("c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c")
check_returncode(result)
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
def test_c2json_stdin():
result = check_subcommand_stdin("keyboards/handwired/onekey/keymaps/default/keymap.c", "c2json", "-kb", "handwired/onekey/pytest", "-km", "default", "-")
result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/default/keymap.c", "c2json", "-kb", "handwired/pytest/has_template", "-km", "default", "-")
check_returncode(result)
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT_ortho_1x1", "layers": [["KC_A"]]}'
def test_c2json_nocpp_stdin():
result = check_subcommand_stdin("keyboards/handwired/onekey/keymaps/pytest_nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/onekey/pytest", "-km", "default", "-")
result = check_subcommand_stdin("keyboards/handwired/pytest/has_template/keymaps/nocpp/keymap.c", "c2json", "--no-cpp", "-kb", "handwired/pytest/has_template", "-km", "default", "-")
check_returncode(result)
assert result.stdout.strip() == '{"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
assert result.stdout.strip() == '{"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_ENTER"]]}'
def test_clean():

View File

@@ -1,38 +1,38 @@
import qmk.keymap
def test_template_c_onekey_proton_c():
templ = qmk.keymap.template_c('handwired/onekey/proton_c')
def test_template_c_pytest_basic():
templ = qmk.keymap.template_c('handwired/pytest/basic')
assert templ == qmk.keymap.DEFAULT_KEYMAP_C
def test_template_json_onekey_proton_c():
templ = qmk.keymap.template_json('handwired/onekey/proton_c')
assert templ == {'keyboard': 'handwired/onekey/proton_c'}
def test_template_json_pytest_basic():
templ = qmk.keymap.template_json('handwired/pytest/basic')
assert templ == {'keyboard': 'handwired/pytest/basic'}
def test_template_c_onekey_pytest():
templ = qmk.keymap.template_c('handwired/onekey/pytest')
def test_template_c_pytest_has_template():
templ = qmk.keymap.template_c('handwired/pytest/has_template')
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {__KEYMAP_GOES_HERE__};\n'
def test_template_json_onekey_pytest():
templ = qmk.keymap.template_json('handwired/onekey/pytest')
assert templ == {'keyboard': 'handwired/onekey/pytest', "documentation": "This file is a keymap.json file for handwired/onekey/pytest"}
def test_template_json_pytest_has_template():
templ = qmk.keymap.template_json('handwired/pytest/has_template')
assert templ == {'keyboard': 'handwired/pytest/has_template', "documentation": "This file is a keymap.json file for handwired/pytest/has_template"}
def test_generate_c_onekey_pytest():
templ = qmk.keymap.generate_c('handwired/onekey/pytest', 'LAYOUT', [['KC_A']])
def test_generate_c_pytest_has_template():
templ = qmk.keymap.generate_c('handwired/pytest/has_template', 'LAYOUT', [['KC_A']])
assert templ == '#include QMK_KEYBOARD_H\nconst uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {\t[0] = LAYOUT(KC_A)};\n'
def test_generate_json_onekey_pytest():
templ = qmk.keymap.generate_json('default', 'handwired/onekey/pytest', 'LAYOUT', [['KC_A']])
assert templ == {"keyboard": "handwired/onekey/pytest", "documentation": "This file is a keymap.json file for handwired/onekey/pytest", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]}
def test_generate_json_pytest_has_template():
templ = qmk.keymap.generate_json('default', 'handwired/pytest/has_template', 'LAYOUT', [['KC_A']])
assert templ == {"keyboard": "handwired/pytest/has_template", "documentation": "This file is a keymap.json file for handwired/pytest/has_template", "keymap": "default", "layout": "LAYOUT", "layers": [["KC_A"]]}
def test_parse_keymap_c():
parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/onekey/keymaps/default/keymap.c')
parsed_keymap_c = qmk.keymap.parse_keymap_c('keyboards/handwired/pytest/basic/keymaps/default/keymap.c')
assert parsed_keymap_c == {'layers': [{'name': '0', 'layout': 'LAYOUT_ortho_1x1', 'keycodes': ['KC_A']}]}

View File

@@ -4,9 +4,9 @@ from pathlib import Path
import qmk.path
def test_keymap_onekey_pytest():
path = qmk.path.keymap('handwired/onekey/pytest')
assert path.samefile('keyboards/handwired/onekey/keymaps')
def test_keymap_pytest_basic():
path = qmk.path.keymap('handwired/pytest/basic')
assert path.samefile('keyboards/handwired/pytest/basic/keymaps')
def test_normpath():

View File

@@ -16,10 +16,6 @@
#include "process_space_cadet.h"
#include "action_tapping.h"
#ifdef NO_ACTION_TAPPING
__attribute__((weak)) uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record) { return TAPPING_TERM; };
#endif
// ********** OBSOLETE DEFINES, STOP USING! (pls?) **********
// Shift / paren setup
#ifndef LSPO_KEY
@@ -97,7 +93,12 @@ void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdM
register_mods(MOD_BIT(holdMod));
}
} else {
if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record)) {
#ifdef TAPPING_TERM_PER_KEY
if (sc_last == holdMod && timer_elapsed(sc_timer) < get_tapping_term(sc_keycode, record))
#else
if (sc_last == holdMod && timer_elapsed(sc_timer) < TAPPING_TERM)
#endif
{
if (holdMod != tapMod) {
if (IS_MOD(holdMod)) {
unregister_mods(MOD_BIT(holdMod));

View File

@@ -19,6 +19,3 @@
void perform_space_cadet(keyrecord_t *record, uint16_t sc_keycode, uint8_t holdMod, uint8_t tapMod, uint8_t keycode);
bool process_space_cadet(uint16_t keycode, keyrecord_t *record);
#ifdef NO_ACTION_TAPPING
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
#endif

View File

@@ -14,7 +14,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "quantum.h"
#include "action_tapping.h"
#ifndef NO_ACTION_ONESHOT
uint8_t get_oneshot_mods(void);
@@ -167,7 +166,11 @@ void matrix_scan_tap_dance() {
if (action->custom_tapping_term > 0) {
tap_user_defined = action->custom_tapping_term;
} else {
#ifdef TAPPING_TERM_PER_KEY
tap_user_defined = get_tapping_term(action->state.keycode, NULL);
#else
tap_user_defined = TAPPING_TERM;
#endif
}
if (action->state.count && timer_elapsed(action->state.timer) > tap_user_defined) {
process_tap_dance_action_on_dance_finished(action);

View File

@@ -56,6 +56,7 @@
#include "config_common.h"
#include "led.h"
#include "action_util.h"
#include "action_tapping.h"
#include "print.h"
#include "send_string_keycodes.h"
#include "suspend.h"

View File

@@ -22,8 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
# define TAPPING_TERM 200
#endif
//#define RETRO_TAPPING // Tap anyway, even after TAPPING_TERM, as long as there was no interruption
/* tap count needed for toggling a feature */
#ifndef TAPPING_TOGGLE
# define TAPPING_TOGGLE 5
@@ -33,6 +31,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef NO_ACTION_TAPPING
uint16_t get_event_keycode(keyevent_t event, bool update_layer_cache);
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
void action_tapping_process(keyrecord_t record);
uint16_t get_tapping_term(uint16_t keycode, keyrecord_t *record);
bool get_permissive_hold(uint16_t keycode, keyrecord_t *record);
bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record);
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record);
bool get_retro_tapping(uint16_t keycode, keyrecord_t *record);
#endif

View File

@@ -150,6 +150,9 @@ ifeq ($(strip $(DEBUG_ENABLE)),yes)
else
ASFLAGS += -Wa,-adhlns=$(@:%.o=%.lst),--listing-cont-lines=100
endif
ifeq ($(VERBOSE_AS_CMD),yes)
ASFLAGS += -v
endif
#---------------- Library Options ----------------
# Minimalistic printf version
@@ -192,6 +195,9 @@ CREATE_MAP ?= yes
ifeq ($(CREATE_MAP),yes)
LDFLAGS += -Wl,-Map=$(BUILD_DIR)/$(TARGET).map,--cref
endif
ifeq ($(VERBOSE_LD_CMD),yes)
LDFLAGS += -v
endif
#LDFLAGS += -Wl,--relax
LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
@@ -327,8 +333,19 @@ $1_ASFLAGS = $$(ALL_ASFLAGS) $$($1_DEFS) $$($1_INCFLAGS) $$($1_CONFIG_FLAGS)
$1/%.o : %.c $1/%.d $1/cflags.txt $1/compiler.txt | $(BEGIN)
@mkdir -p $$(@D)
@$$(SILENT) || printf "$$(MSG_COMPILING) $$<" | $$(AWK_CMD)
$$(eval CMD := $$(CC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
$$(eval CC_EXEC := $$(CC))
ifneq ($$(VERBOSE_C_CMD),)
$$(if $$(filter $$(notdir $$(VERBOSE_C_CMD)),$$(notdir $$<)),$$(eval CC_EXEC += -v))
endif
ifneq ($$(VERBOSE_C_INCLUDE),)
$$(if $$(filter $$(notdir $$(VERBOSE_C_INCLUDE)),$$(notdir $$<)),$$(eval CC_EXEC += -H))
endif
$$(eval CMD := $$(CC_EXEC) -c $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$< -o $$@ && $$(MOVE_DEP))
@$$(BUILD_CMD)
ifneq ($$(DUMP_C_MACROS),)
$$(eval CMD := $$(CC) -E -dM $$($1_CFLAGS) $$(INIT_HOOK_CFLAGS) $$(GENDEPFLAGS) $$<)
@$$(if $$(filter $$(notdir $$(DUMP_C_MACROS)),$$(notdir $$<)),$$(BUILD_CMD))
endif
# Compile: create object files from C++ source files.
$1/%.o : %.cpp $1/%.d $1/cxxflags.txt $1/compiler.txt | $(BEGIN)