mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-21 10:59:29 +00:00
Compare commits
7 Commits
7709149845
...
cf49bd3dc4
Author | SHA1 | Date | |
---|---|---|---|
|
cf49bd3dc4 | ||
|
9c86583981 | ||
|
e66fce38b2 | ||
|
c843ad1268 | ||
|
0853a8ea35 | ||
|
0988523851 | ||
|
c02591b90a |
@ -456,6 +456,10 @@ ifeq ($(strip $(RGB_MATRIX_ENABLE)), yes)
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations
|
||||
COMMON_VPATH += $(QUANTUM_DIR)/rgb_matrix/animations/runners
|
||||
POST_CONFIG_H += $(QUANTUM_DIR)/rgb_matrix/post_config.h
|
||||
|
||||
# TODO: Remove this
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_underglow.c
|
||||
|
||||
SRC += $(QUANTUM_DIR)/process_keycode/process_rgb_matrix.c
|
||||
SRC += $(QUANTUM_DIR)/color.c
|
||||
SRC += $(QUANTUM_DIR)/rgb_matrix/rgb_matrix.c
|
||||
|
@ -4,7 +4,7 @@ This page attempts to introduce developers to the QMK Compiler. It does not go i
|
||||
|
||||
# Overview
|
||||
|
||||
The QMK Compile API consists of a few movings parts:
|
||||
The QMK Compile API consists of a few moving parts:
|
||||
|
||||
![Architecture Diagram](https://raw.githubusercontent.com/qmk/qmk_api/master/docs/architecture.svg)
|
||||
|
||||
|
@ -59,6 +59,10 @@ Changing the **Value** sets the overall brightness.<br>
|
||||
|
||||
## Keycodes
|
||||
|
||||
::: warning
|
||||
These keycodes also simultaneously control [RGB Matrix](rgb_matrix), if enabled. This behaviour is in the process of being deprecated, so during this time it is recommended to additionally include the dedicated RGB Matrix keycodes to your keymap, and add `#define RGB_MATRIX_DISABLE_SHARED_KEYCODES` to `config.h`.
|
||||
:::
|
||||
|
||||
|Key |Aliases |Description |
|
||||
|------------------------------|----------|---------------------------------------------------------------------|
|
||||
|`QK_UNDERGLOW_TOGGLE` |`UG_TOGG` |Toggle RGB lighting on or off |
|
||||
|
@ -60,6 +60,14 @@
|
||||
"resync": true
|
||||
}
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2},
|
||||
{"pin_a": "B12", "pin_b": "B11", "resolution": 2}
|
||||
]
|
||||
},
|
||||
"layouts": {
|
||||
"LAYOUT_default": {
|
||||
"layout": [
|
||||
|
@ -44,3 +44,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS
|
||||
)
|
||||
};
|
||||
|
||||
#if defined(ENCODER_MAP_ENABLE)
|
||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
|
||||
[0] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN), ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(UG_HUED, UG_HUEU), ENCODER_CCW_CW(UG_SATD, UG_SATU) },
|
||||
[1] = { ENCODER_CCW_CW(UG_VALD, UG_VALU), ENCODER_CCW_CW(UG_SPDD, UG_SPDU), ENCODER_CCW_CW(UG_PREV, UG_NEXT), ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
|
||||
};
|
||||
#endif
|
||||
|
@ -0,0 +1,2 @@
|
||||
ENCODER_ENABLE = yes
|
||||
ENCODER_MAP_ENABLE = yes
|
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
40
keyboards/cannonkeys/sagittarius/sagittarius.c
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright 2024 Nick Brassel (@tzarc)
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include QMK_KEYBOARD_H
|
||||
|
||||
#if defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
||||
|
||||
# if !defined(ENCODER_SETTLE_PIN_STATE_DELAY_US)
|
||||
# define ENCODER_SETTLE_PIN_STATE_DELAY_US 2
|
||||
# endif
|
||||
|
||||
static pin_t matrix_row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
|
||||
|
||||
void encoder_driver_task(void) {
|
||||
// Set all relevant rows to output, which is different to the matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_output(matrix_row_pins[i]);
|
||||
}
|
||||
|
||||
// Read each encoder
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
// Set the row pin low for the corresponding encoder...
|
||||
for (uint8_t j = 0; j < 4; j++) {
|
||||
gpio_write_pin(matrix_row_pins[j], (i == j) ? 0 : 1);
|
||||
}
|
||||
// ...and let them settle.
|
||||
wait_us(ENCODER_SETTLE_PIN_STATE_DELAY_US);
|
||||
|
||||
// Run the normal encoder handling
|
||||
extern void encoder_quadrature_handle_read(uint8_t index, uint8_t pin_a_state, uint8_t pin_b_state);
|
||||
extern uint8_t encoder_quadrature_read_pin(uint8_t index, bool pad_b);
|
||||
encoder_quadrature_handle_read(i, encoder_quadrature_read_pin(i, false), encoder_quadrature_read_pin(i, true));
|
||||
}
|
||||
|
||||
// Set all rows back to input-high as per matrix expectations
|
||||
for (uint8_t i = 0; i < 4; i++) {
|
||||
gpio_set_pin_input_high(matrix_row_pins[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif // defined(ENCODER_ENABLE) || defined(ENCODER_MAP_ENABLE)
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_VCC
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -16,3 +16,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3733_I2C_ADDRESS_1 IS31FL3733_I2C_ADDRESS_GND_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -17,3 +17,5 @@
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -2,3 +2,5 @@
|
||||
|
||||
#define IS31FL3731_I2C_ADDRESS_1 IS31FL3731_I2C_ADDRESS_GND
|
||||
#define IS31FL3731_I2C_ADDRESS_2 IS31FL3731_I2C_ADDRESS_SDA
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -30,3 +30,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2
|
||||
|
||||
#define IS31FL3741_I2C_ADDRESS_1 IS31FL3741_I2C_ADDRESS_GND
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN E6
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -9,3 +9,5 @@
|
||||
#define WORK_LOUDER_LED_PIN_1 B6
|
||||
#define WORK_LOUDER_LED_PIN_2 B7
|
||||
#define WORK_LOUDER_LED_PIN_3 B5
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -18,3 +18,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#pragma once
|
||||
|
||||
#define RGBLIGHT_DI_PIN C7
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -5,3 +5,5 @@
|
||||
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -20,3 +20,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define RGBLIGHT_DI_PIN D2
|
||||
|
||||
#define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_GRADIENT + 9
|
||||
|
||||
#define RGB_MATRIX_DISABLE_SHARED_KEYCODES
|
||||
|
@ -213,7 +213,7 @@ if sys.version_info[0] != 3 or sys.version_info[1] < 9:
|
||||
|
||||
milc_version = __VERSION__.split('.')
|
||||
|
||||
if int(milc_version[0]) < 2 and int(milc_version[1]) < 4:
|
||||
if int(milc_version[0]) < 2 and int(milc_version[1]) < 9:
|
||||
requirements = Path('requirements.txt').resolve()
|
||||
|
||||
_eprint(f'Your MILC library is too old! Please upgrade: python3 -m pip install -U -r {str(requirements)}')
|
||||
|
@ -2,87 +2,200 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "process_underglow.h"
|
||||
#include "rgblight.h"
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
# include "rgblight.h"
|
||||
#endif
|
||||
#include "action_util.h"
|
||||
#include "keycodes.h"
|
||||
#include "modifiers.h"
|
||||
|
||||
// TODO: Remove this
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
# include "rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
bool process_underglow(uint16_t keycode, keyrecord_t *record) {
|
||||
if (record->event.pressed) {
|
||||
uint8_t shifted = get_mods() & MOD_MASK_SHIFT;
|
||||
switch (keycode) {
|
||||
case QK_UNDERGLOW_TOGGLE:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
rgblight_toggle();
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
rgb_matrix_toggle();
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_NEXT:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_step_reverse();
|
||||
} else {
|
||||
rgblight_step();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_step_reverse();
|
||||
} else {
|
||||
rgb_matrix_step();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_MODE_PREVIOUS:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_step();
|
||||
} else {
|
||||
rgblight_step_reverse();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_step();
|
||||
} else {
|
||||
rgb_matrix_step_reverse();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_hue();
|
||||
} else {
|
||||
rgblight_increase_hue();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_hue();
|
||||
} else {
|
||||
rgb_matrix_increase_hue();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_HUE_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_hue();
|
||||
} else {
|
||||
rgb_matrix_decrease_hue();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_sat();
|
||||
} else {
|
||||
rgblight_increase_sat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_sat();
|
||||
} else {
|
||||
rgb_matrix_increase_sat();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SATURATION_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_sat();
|
||||
} else {
|
||||
rgblight_decrease_sat();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_sat();
|
||||
} else {
|
||||
rgb_matrix_decrease_sat();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_val();
|
||||
} else {
|
||||
rgblight_increase_val();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_val();
|
||||
} else {
|
||||
rgb_matrix_increase_val();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_VALUE_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_hue();
|
||||
rgblight_increase_val();
|
||||
} else {
|
||||
rgblight_decrease_hue();
|
||||
rgblight_decrease_val();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_val();
|
||||
} else {
|
||||
rgb_matrix_decrease_val();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_UP:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_decrease_speed();
|
||||
} else {
|
||||
rgblight_increase_speed();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_decrease_speed();
|
||||
} else {
|
||||
rgb_matrix_increase_speed();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
case QK_UNDERGLOW_SPEED_DOWN:
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
if (shifted) {
|
||||
rgblight_increase_speed();
|
||||
} else {
|
||||
rgblight_decrease_speed();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(RGB_MATRIX_ENABLE) && !defined(RGB_MATRIX_DISABLE_SHARED_KEYCODES)
|
||||
if (shifted) {
|
||||
rgb_matrix_increase_speed();
|
||||
} else {
|
||||
rgb_matrix_decrease_speed();
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@
|
||||
# include "process_rgb_matrix.h"
|
||||
#endif
|
||||
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
# include "process_underglow.h"
|
||||
#endif
|
||||
|
||||
@ -382,7 +382,7 @@ bool process_record_quantum(keyrecord_t *record) {
|
||||
#ifdef GRAVE_ESC_ENABLE
|
||||
process_grave_esc(keycode, record) &&
|
||||
#endif
|
||||
#if defined(RGBLIGHT_ENABLE)
|
||||
#if defined(RGBLIGHT_ENABLE) || defined(RGB_MATRIX_ENABLE)
|
||||
process_underglow(keycode, record) &&
|
||||
#endif
|
||||
#if defined(RGB_MATRIX_ENABLE)
|
||||
|
@ -6,7 +6,7 @@ dotty-dict
|
||||
hid
|
||||
hjson
|
||||
jsonschema>=4
|
||||
milc>=1.4.2
|
||||
milc>=1.9.0
|
||||
pygments
|
||||
pyserial
|
||||
pyusb
|
||||
|
Loading…
Reference in New Issue
Block a user