Merge remote-tracking branch 'qmk/master' into merge-2023-03-12
This commit is contained in:
commit
06a2fdcc9c
19466 changed files with 296791 additions and 222541 deletions
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* Used to set host for remote KB if VUSB detect doesn't work. */
|
||||
// #define KEYBOARD_HOST // Force host mode
|
||||
|
|
@ -29,9 +28,6 @@
|
|||
#define MATRIX_COLS 16
|
||||
#define MATRIX_MUX_COLS 4
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 10
|
||||
|
||||
/*
|
||||
* Keyboard Matrix Assignments
|
||||
* The nibble uses a demultiplexer for the cols.
|
||||
|
|
@ -45,9 +41,14 @@
|
|||
/* Optional SMT LED pins */
|
||||
#define RGB_DI_PIN E6
|
||||
#define RGBLED_NUM 10
|
||||
#define RGBLIGHT_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
|
||||
#define RGBLIGHT_EFFECT_TWINKLE
|
||||
#define RGBLIGHT_SLEEP
|
||||
|
||||
/* Optional encoder pins */
|
||||
#define ENCODERS_PAD_A { B5 }
|
||||
#define ENCODERS_PAD_B { B4 }
|
||||
|
|
@ -7,6 +7,14 @@
|
|||
"pid": "0x6060",
|
||||
"device_version": "0.0.1"
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "B5", "pin_b": "B4"}
|
||||
]
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"debounce": 10,
|
||||
"layouts": {
|
||||
"LAYOUT_all": {
|
||||
"layout": [
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ enum layer_names {
|
|||
#define KC_DISC_DEAF KC_F24
|
||||
|
||||
enum custom_keycodes {
|
||||
PROG = USER00,
|
||||
PROG = QK_KB_0,
|
||||
DISC_MUTE,
|
||||
DISC_DEAF,
|
||||
SUPER_ALT_TAB,
|
||||
|
|
@ -44,7 +44,7 @@ bool deafened = false;
|
|||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_BASE] = LAYOUT_all(
|
||||
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
|
||||
QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
|
||||
KC_F13, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
|
||||
KC_F14, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
|
||||
KC_F15, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
|
||||
|
|
|
|||
|
|
@ -51,11 +51,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
_______, _______, _______, _______, KC_0, KC_PSLS, _______, _______, _______, _______, _______
|
||||
),
|
||||
[_L3] = LAYOUT_ansi(
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
|
||||
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
KC_SYSREQ, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______,
|
||||
RGB_TOG, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
KC_SYRQ, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -24,11 +24,9 @@ enum layer_names {
|
|||
|
||||
#define KC_DISC_MUTE KC_F23
|
||||
#define KC_DISC_DEAF KC_F24
|
||||
#define NUM_CUST_KEYCODES (_NUM_CUST_KCS - SAFE_RANGE)
|
||||
#define VIA_KEYCODE_RANGE 0x5F80
|
||||
|
||||
enum custom_keycodes {
|
||||
PROG = SAFE_RANGE,
|
||||
PROG = QK_KB_0,
|
||||
DISC_MUTE,
|
||||
DISC_DEAF,
|
||||
SUPER_ALT_TAB,
|
||||
|
|
@ -43,7 +41,7 @@ bool deafened = false;
|
|||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
[_BASE] = LAYOUT_all(
|
||||
KC_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
|
||||
QK_GESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_HOME,
|
||||
KC_F13, KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL,
|
||||
KC_F14, KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT, KC_PGUP,
|
||||
KC_F15, KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
|
||||
|
|
@ -76,17 +74,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
|
||||
};
|
||||
|
||||
void map_via_keycode(uint16_t * keycode) {
|
||||
if (abs(*keycode - VIA_KEYCODE_RANGE) < NUM_CUST_KEYCODES) { //make into macro?
|
||||
dprintf("VIA custom keycode found, mapping to QMK keycode.\n");
|
||||
uint16_t new_keycode = (*keycode - VIA_KEYCODE_RANGE) + SAFE_RANGE;
|
||||
dprintf("VIA KC: %u QMK KC: %u\n", *keycode, new_keycode);
|
||||
*keycode = new_keycode;
|
||||
}
|
||||
}
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
map_via_keycode(&keycode);
|
||||
// Send keystrokes to host keyboard, if connected (see readme)
|
||||
process_record_remote_kb(keycode, record);
|
||||
switch(keycode) {
|
||||
|
|
|
|||
|
|
@ -16,10 +16,6 @@
|
|||
#include QMK_KEYBOARD_H
|
||||
|
||||
// Use Bit-C LED to show CAPS LOCK status
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
set_bitc_LED(led_state.caps_lock ? LED_DIM : LED_OFF);
|
||||
}
|
||||
return res;
|
||||
void led_update_ports(led_t led_state) {
|
||||
set_bitc_LED(led_state.caps_lock ? LED_DIM : LED_OFF);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
|
|
|
|||
|
|
@ -8,34 +8,16 @@
|
|||
"pid": "0x6062",
|
||||
"device_version": "0.0.1"
|
||||
},
|
||||
"debounce": 10,
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
{
|
||||
"label": "n",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 1,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 2,
|
||||
"y": 0
|
||||
},
|
||||
{
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
{
|
||||
"x": 1,
|
||||
"y": 1
|
||||
},
|
||||
{
|
||||
"x": 2,
|
||||
"y": 1
|
||||
}
|
||||
{"x": 0, "y": 0, "matrix": [0, 0]},
|
||||
{"x": 1, "y": 0, "matrix": [0, 1]},
|
||||
{"x": 2, "y": 0, "matrix": [0, 2]},
|
||||
{"x": 0, "y": 1, "matrix": [1, 0]},
|
||||
{"x": 1, "y": 1, "matrix": [1, 1]},
|
||||
{"x": 2, "y": 1, "matrix": [1, 2]}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +1,4 @@
|
|||
# MCU name
|
||||
MCU = atmega328p
|
||||
# NOTE: This file is shared and only exists to set the default build
|
||||
# The real build rules are set in the v1/v2 directories
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = usbasploader
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
ENCODER_ENABLE = yes # Use rotary encoder
|
||||
DEFAULT_FOLDER = nullbitsco/scramble/v2
|
||||
|
|
|
|||
|
|
@ -1,39 +0,0 @@
|
|||
/* Copyright 2021 Jay Greco
|
||||
*
|
||||
* 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"
|
||||
|
||||
// Indication LED settings
|
||||
#define LED_ON 2
|
||||
#define LED_DIM 1
|
||||
#define LED_OFF 0
|
||||
|
||||
#define GPIO_STATE_LOW 0
|
||||
#define GPIO_STATE_HIGH 1
|
||||
|
||||
#define PIN_LED B2
|
||||
|
||||
void set_scramble_LED(uint8_t mode);
|
||||
|
||||
#define LAYOUT( \
|
||||
K01, K02, K03, \
|
||||
K11, K12, K13 \
|
||||
) { \
|
||||
{K01, K02, K03}, \
|
||||
{K11, K12, K13}, \
|
||||
}
|
||||
|
|
@ -15,26 +15,8 @@ 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
|
||||
/* NOTE: This config file is specific to AVR builds. */
|
||||
|
||||
// place overrides here
|
||||
void set_scramble_LED(uint8_t mode) {
|
||||
switch(mode) {
|
||||
case LED_ON:
|
||||
setPinOutput(PIN_LED);
|
||||
writePin(PIN_LED, GPIO_STATE_HIGH);
|
||||
break;
|
||||
#pragma once
|
||||
|
||||
case LED_DIM:
|
||||
setPinInput(PIN_LED);
|
||||
break;
|
||||
|
||||
case LED_OFF:
|
||||
setPinOutput(PIN_LED);
|
||||
writePin(PIN_LED, GPIO_STATE_LOW);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#define TAP_CODE_DELAY 10
|
||||
15
keyboards/nullbitsco/scramble/v1/info.json
Normal file
15
keyboards/nullbitsco/scramble/v1/info.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "D6", "pin_b": "D7"}
|
||||
]
|
||||
},
|
||||
"processor": "atmega328p",
|
||||
"bootloader": "usbasploader",
|
||||
"matrix_pins": {
|
||||
"direct": [
|
||||
["D4", "D5", "B1"],
|
||||
["C3", "C2", "C1"]
|
||||
]
|
||||
}
|
||||
}
|
||||
13
keyboards/nullbitsco/scramble/v1/rules.mk
Normal file
13
keyboards/nullbitsco/scramble/v1/rules.mk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
ENCODER_ENABLE = yes # Use rotary encoder
|
||||
25
keyboards/nullbitsco/scramble/v1/v1.c
Normal file
25
keyboards/nullbitsco/scramble/v1/v1.c
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "v1.h"
|
||||
|
||||
void set_scramble_LED(uint8_t mode) {
|
||||
switch(mode) {
|
||||
case LED_ON:
|
||||
setPinOutput(PIN_LED);
|
||||
writePin(PIN_LED, GPIO_STATE_HIGH);
|
||||
break;
|
||||
|
||||
case LED_DIM:
|
||||
setPinInput(PIN_LED);
|
||||
break;
|
||||
|
||||
case LED_OFF:
|
||||
setPinOutput(PIN_LED);
|
||||
writePin(PIN_LED, GPIO_STATE_LOW);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
18
keyboards/nullbitsco/scramble/v1/v1.h
Normal file
18
keyboards/nullbitsco/scramble/v1/v1.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
|
||||
// Indication LED settings
|
||||
#define LED_ON 2
|
||||
#define LED_DIM 1
|
||||
#define LED_OFF 0
|
||||
|
||||
#define GPIO_STATE_LOW 0
|
||||
#define GPIO_STATE_HIGH 1
|
||||
|
||||
#define PIN_LED B2
|
||||
|
||||
void set_scramble_LED(uint8_t mode);
|
||||
|
|
@ -15,20 +15,14 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* NOTE: This config file is specific to RP2040 builds. */
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 2
|
||||
#define MATRIX_COLS 3
|
||||
|
||||
#define DIRECT_PINS {{D4,D5,B1}, {C3,C2,C1}}
|
||||
|
||||
/* Set 0 if debouncing isn't needed */
|
||||
#define DEBOUNCE 10
|
||||
|
||||
/* Optional encoder pins */
|
||||
#define ENCODERS_PAD_A { D6 }
|
||||
#define ENCODERS_PAD_B { D7 }
|
||||
#define TAP_CODE_DELAY 10
|
||||
|
||||
/* RP2040-specific defines*/
|
||||
#define RP2040_FLASH_GENERIC_03H
|
||||
#define I2C1_SDA_PIN GP26
|
||||
#define I2C1_SCL_PIN GP27
|
||||
#define I2C_DRIVER I2CD1
|
||||
9
keyboards/nullbitsco/scramble/v2/halconf.h
Normal file
9
keyboards/nullbitsco/scramble/v2/halconf.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#define HAL_USE_I2C TRUE
|
||||
#define HAL_USE_PWM TRUE
|
||||
|
||||
#include_next <halconf.h>
|
||||
15
keyboards/nullbitsco/scramble/v2/info.json
Normal file
15
keyboards/nullbitsco/scramble/v2/info.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "GP24", "pin_b": "GP25"}
|
||||
]
|
||||
},
|
||||
"processor": "RP2040",
|
||||
"bootloader": "rp2040",
|
||||
"matrix_pins": {
|
||||
"direct": [
|
||||
["GP6", "GP8", "GP10"],
|
||||
["GP29", "GP28", "GP22"]
|
||||
]
|
||||
}
|
||||
}
|
||||
14
keyboards/nullbitsco/scramble/v2/mcuconf.h
Normal file
14
keyboards/nullbitsco/scramble/v2/mcuconf.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include_next <mcuconf.h>
|
||||
|
||||
#undef RP_I2C_USE_I2C1
|
||||
#define RP_I2C_USE_I2C1 TRUE
|
||||
|
||||
#undef RP_PWM_USE_PWM1
|
||||
#define RP_PWM_USE_PWM1 TRUE
|
||||
#undef RP_PWM_USE_PWM2
|
||||
#define RP_PWM_USE_PWM2 TRUE
|
||||
13
keyboards/nullbitsco/scramble/v2/rules.mk
Normal file
13
keyboards/nullbitsco/scramble/v2/rules.mk
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
|
||||
MOUSEKEY_ENABLE = yes # Mouse keys
|
||||
EXTRAKEY_ENABLE = yes # Audio control and System control
|
||||
CONSOLE_ENABLE = no # Console for debug
|
||||
COMMAND_ENABLE = no # Commands for debug and configuration
|
||||
NKRO_ENABLE = no # Enable N-Key Rollover
|
||||
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
|
||||
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
|
||||
AUDIO_ENABLE = no # Audio output
|
||||
ENCODER_ENABLE = yes # Use rotary encoder
|
||||
84
keyboards/nullbitsco/scramble/v2/v2.c
Normal file
84
keyboards/nullbitsco/scramble/v2/v2.c
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include "v2.h"
|
||||
|
||||
// SCRAMBLE PWM LED config
|
||||
pwm_led_t scramble_rgb = {
|
||||
{GP18, GP19, GP20},
|
||||
{&PWMD1, &PWMD1, &PWMD2},
|
||||
{0, 1, 0},
|
||||
PWM_OUTPUT_ACTIVE_LOW,
|
||||
0
|
||||
};
|
||||
|
||||
// Internal PWM init
|
||||
// only runs once per PWM LED
|
||||
void _init_pwm(pwm_led_t* led) {
|
||||
if (!led->init_complete) {
|
||||
for (int i=0; i<NUM_RGB_IDX; i++) {
|
||||
palSetPadMode(PAL_PORT(led->pin[i]), PAL_PAD(led->pin[i]), PWM_PAL_MODE);
|
||||
|
||||
static PWMConfig pwmCFG = {
|
||||
.frequency = PWM_PWM_COUNTER_FREQUENCY,
|
||||
.period = PWM_PWM_PERIOD,
|
||||
};
|
||||
|
||||
// Channels are always configured as active low
|
||||
// If active high is needed, pwm is inverted in _set_led_pwm()
|
||||
pwmCFG.channels[0].mode = PWM_OUTPUT_ACTIVE_LOW;
|
||||
pwmCFG.channels[1].mode = PWM_OUTPUT_ACTIVE_LOW;
|
||||
pwmStart(led->driver[i], &pwmCFG);
|
||||
|
||||
// Start LEDs in the OFF state
|
||||
uint8_t pwm = led->mode == PWM_OUTPUT_ACTIVE_HIGH ? 100 : 0;
|
||||
pwmEnableChannel(led->driver[i], led->channel[i], PWM_FRACTION_TO_WIDTH(led->driver[i], 99, pwm));
|
||||
}
|
||||
|
||||
led->init_complete = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Internal generic PWM setter
|
||||
void _set_led_pwm(uint8_t pwm, pwm_led_t* led, uint8_t channel) {
|
||||
if (pwm > 100) pwm = 100;
|
||||
if (led->mode == PWM_OUTPUT_ACTIVE_HIGH) pwm = (100 - pwm);
|
||||
|
||||
_init_pwm(led);
|
||||
pwmEnableChannel(led->driver[channel], led->channel[channel], PWM_FRACTION_TO_WIDTH(led->driver[channel], 99, pwm));
|
||||
}
|
||||
|
||||
// SCRAMBLE
|
||||
void set_scramble_LED(uint8_t mode) {
|
||||
switch(mode) {
|
||||
case LED_ON:
|
||||
set_scramble_LED_rgb_pwm(65, 100, 95);
|
||||
break;
|
||||
|
||||
case LED_DIM:
|
||||
set_scramble_LED_rgb_pwm(3, 9, 3);
|
||||
break;
|
||||
|
||||
default: //LED_OFF
|
||||
set_scramble_LED_rgb_pwm(0, 0, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void set_scramble_LED_rgb_pwm(uint8_t r_pwm, uint8_t g_pwm, uint8_t b_pwm) {
|
||||
_set_led_pwm(r_pwm, &scramble_rgb, RED);
|
||||
_set_led_pwm(g_pwm, &scramble_rgb, GREEN);
|
||||
_set_led_pwm(b_pwm, &scramble_rgb, BLUE);
|
||||
}
|
||||
|
||||
void set_scramble_LED_r_pwm(uint8_t pwm) {
|
||||
_set_led_pwm(pwm, &scramble_rgb, RED);
|
||||
}
|
||||
|
||||
void set_scramble_LED_g_pwm(uint8_t pwm) {
|
||||
_set_led_pwm(pwm, &scramble_rgb, GREEN);
|
||||
}
|
||||
|
||||
void set_scramble_LED_b_pwm(uint8_t pwm) {
|
||||
_set_led_pwm(pwm, &scramble_rgb, BLUE);
|
||||
}
|
||||
43
keyboards/nullbitsco/scramble/v2/v2.h
Normal file
43
keyboards/nullbitsco/scramble/v2/v2.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright 2022 Jay Greco
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "quantum.h"
|
||||
#include <hal.h>
|
||||
|
||||
enum led_mode {
|
||||
LED_OFF = 0,
|
||||
LED_DIM,
|
||||
LED_ON,
|
||||
NUM_LED_MODE
|
||||
};
|
||||
|
||||
enum rgb_idx {
|
||||
RED = 0,
|
||||
GREEN,
|
||||
BLUE,
|
||||
NUM_RGB_IDX
|
||||
};
|
||||
|
||||
typedef struct pwm_led_t {
|
||||
uint32_t pin[3];
|
||||
PWMDriver* driver[3];
|
||||
uint8_t channel[3];
|
||||
uint8_t mode;
|
||||
uint8_t init_complete;
|
||||
} pwm_led_t;
|
||||
|
||||
#define PWM_PAL_MODE (PAL_MODE_ALTERNATE_PWM | PAL_RP_PAD_DRIVE12 | PAL_RP_GPIO_OE)
|
||||
#define PWM_PWM_COUNTER_FREQUENCY 1000000
|
||||
#define PWM_PWM_PERIOD PWM_PWM_COUNTER_FREQUENCY / 1000
|
||||
|
||||
// RP2040 adds HW PWM control!
|
||||
// PWM values are in percent, 0-100
|
||||
void
|
||||
set_scramble_LED(uint8_t mode),
|
||||
set_scramble_LED_rgb_pwm(uint8_t r_pwm, uint8_t g_pwm, uint8_t b_pwm),
|
||||
set_scramble_LED_r_pwm(uint8_t pwm),
|
||||
set_scramble_LED_g_pwm(uint8_t pwm),
|
||||
set_scramble_LED_b_pwm(uint8_t pwm);
|
||||
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
/* Used to set remote for remote KB if VUSB detect doesn't work. */
|
||||
// #define KEYBOARD_REMOTE
|
||||
|
|
@ -23,10 +22,6 @@
|
|||
// Workaround for freezing after MacOS sleep
|
||||
#define USB_SUSPEND_WAKEUP_DELAY 200
|
||||
|
||||
/* key matrix size */
|
||||
#define MATRIX_ROWS 5
|
||||
#define MATRIX_COLS 6
|
||||
|
||||
/* key matrix pins */
|
||||
#define MATRIX_ROW_PINS { B1, E6, D7, C6, D4 }
|
||||
#define MATRIX_COL_PINS { NO_PIN, NO_PIN, F4, F5, F6, F7 }
|
||||
|
|
@ -47,8 +42,3 @@
|
|||
#define RGBLIGHT_EFFECT_RGB_TEST
|
||||
#define RGBLIGHT_EFFECT_ALTERNATING
|
||||
#define RGBLIGHT_EFFECT_TWINKLE
|
||||
|
||||
/* Optional encoder pins */
|
||||
// Encoders are defined in order. 1: B2 & B3, 2: B4 & B5, 3: D0 & D1, 4: D2 & D3
|
||||
#define ENCODERS_PAD_A { B2, B4, D0, D3 }
|
||||
#define ENCODERS_PAD_B { B3, B5, D1, D2 }
|
||||
|
|
|
|||
|
|
@ -7,6 +7,16 @@
|
|||
"pid": "0x6064",
|
||||
"device_version": "0.0.1"
|
||||
},
|
||||
"encoder": {
|
||||
"rotary": [
|
||||
{"pin_a": "B2", "pin_b": "B3"},
|
||||
{"pin_a": "B4", "pin_b": "B5"},
|
||||
{"pin_a": "D0", "pin_b": "D1"},
|
||||
{"pin_a": "D3", "pin_b": "D2"}
|
||||
]
|
||||
},
|
||||
"processor": "atmega32u4",
|
||||
"bootloader": "atmel-dfu",
|
||||
"layouts": {
|
||||
"LAYOUT": {
|
||||
"layout": [
|
||||
|
|
|
|||
|
|
@ -1,9 +1,3 @@
|
|||
# MCU name
|
||||
MCU = atmega32u4
|
||||
|
||||
# Bootloader selection
|
||||
BOOTLOADER = atmel-dfu
|
||||
|
||||
# Build Options
|
||||
# change yes to no to disable
|
||||
#
|
||||
|
|
|
|||
|
|
@ -103,12 +103,8 @@ bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|||
}
|
||||
|
||||
// Use Bit-C LED to show NUM LOCK status
|
||||
bool led_update_kb(led_t led_state) {
|
||||
bool res = led_update_user(led_state);
|
||||
if (res) {
|
||||
set_bitc_LED(led_state.num_lock ? LED_DIM : LED_OFF);
|
||||
}
|
||||
return res;
|
||||
void led_update_ports(led_t led_state) {
|
||||
set_bitc_LED(led_state.num_lock ? LED_DIM : LED_OFF);
|
||||
}
|
||||
|
||||
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
||||
|
|
@ -121,7 +117,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
|
|||
if (!numlock_set && record->event.pressed) {
|
||||
led_t led_state = host_keyboard_led_state();
|
||||
if (!led_state.num_lock) {
|
||||
register_code(KC_NLCK);
|
||||
register_code(KC_NUM_LOCK);
|
||||
}
|
||||
numlock_set = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue