mirror of
https://github.com/qmk/qmk_firmware.git
synced 2024-11-22 19:39:27 +00:00
Merge remote-tracking branch 'origin/master' into develop
This commit is contained in:
commit
f1ac92ac63
@ -1,68 +0,0 @@
|
|||||||
/* Copyright 2020 Neil Brian Ramirez
|
|
||||||
* Copyright 2021 drashna jael're (@drashna)
|
|
||||||
*
|
|
||||||
* 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 3 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 "encoder_actions.h"
|
|
||||||
|
|
||||||
#if defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
|
||||||
|
|
||||||
# ifdef ENCODERS
|
|
||||||
static uint8_t encoder_state[ENCODERS] = {0};
|
|
||||||
static keypos_t encoder_cw[ENCODERS] = ENCODERS_CW_KEY;
|
|
||||||
static keypos_t encoder_ccw[ENCODERS] = ENCODERS_CCW_KEY;
|
|
||||||
# endif
|
|
||||||
|
|
||||||
void encoder_action_unregister(void) {
|
|
||||||
# ifdef ENCODERS
|
|
||||||
for (int index = 0; index < ENCODERS; ++index) {
|
|
||||||
if (encoder_state[index]) {
|
|
||||||
keyevent_t encoder_event = (keyevent_t) {
|
|
||||||
.key = encoder_state[index] >> 1 ? encoder_cw[index] : encoder_ccw[index],
|
|
||||||
.pressed = false,
|
|
||||||
.time = (timer_read() | 1)
|
|
||||||
};
|
|
||||||
encoder_state[index] = 0;
|
|
||||||
action_exec(encoder_event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void encoder_action_register(uint8_t index, bool clockwise) {
|
|
||||||
# ifdef ENCODERS
|
|
||||||
keyevent_t encoder_event = (keyevent_t) {
|
|
||||||
.key = clockwise ? encoder_cw[index] : encoder_ccw[index],
|
|
||||||
.pressed = true,
|
|
||||||
.time = (timer_read() | 1)
|
|
||||||
};
|
|
||||||
encoder_state[index] = (clockwise ^ 1) | (clockwise << 1);
|
|
||||||
action_exec(encoder_event);
|
|
||||||
# endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void matrix_scan_kb(void) {
|
|
||||||
encoder_action_unregister();
|
|
||||||
matrix_scan_user();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
|
||||||
encoder_action_register(index, clockwise);
|
|
||||||
// don't return user actions, because they are in the keymap
|
|
||||||
// encoder_update_user(index, clockwise);
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,21 +0,0 @@
|
|||||||
/* Copyright 2020 Neil Brian Ramirez
|
|
||||||
*
|
|
||||||
* 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 3 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 "quantum.h"
|
|
||||||
|
|
||||||
void encoder_action_unregister(void);
|
|
||||||
|
|
||||||
void encoder_action_register(uint8_t index, bool clockwise);
|
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#include "config_common.h"
|
#include "config_common.h"
|
||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 2
|
#define MATRIX_ROWS 1
|
||||||
#define MATRIX_COLS 12
|
#define MATRIX_COLS 12
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -34,7 +34,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define MATRIX_ROW_PINS \
|
#define MATRIX_ROW_PINS \
|
||||||
{ F5, NO_PIN }
|
{ F5 }
|
||||||
#define MATRIX_COL_PINS { B3, B2, B1, D6, D7, B4, B5, B6, C6, C7, F7, F6 }
|
#define MATRIX_COL_PINS { B3, B2, B1, D6, D7, B4, B5, B6, C6, C7, F7, F6 }
|
||||||
|
|
||||||
/* COL2ROW, ROW2COL */
|
/* COL2ROW, ROW2COL */
|
||||||
@ -194,8 +194,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
#define ENCODERS_PAD_A { D0, D2, D5 }
|
#define ENCODERS_PAD_A { D0, D2, D5 }
|
||||||
#define ENCODERS_PAD_B { D1, D3, D4 }
|
#define ENCODERS_PAD_B { D1, D3, D4 }
|
||||||
|
|
||||||
#define ENCODERS 3
|
|
||||||
|
|
||||||
#define ENCODERS_CW_KEY { { 0, 1 }, { 2, 1 }, { 4, 1 } }
|
|
||||||
#define ENCODERS_CCW_KEY { { 1, 1 }, { 3, 1 }, { 5, 1 } }
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"keyboard_name": "Loop Pad",
|
"keyboard_name": "Loop Pad",
|
||||||
"manufacturer": "Work Louder",
|
"manufacturer": "Work Louder",
|
||||||
"url": "",
|
"url": "https://worklouder.cc/",
|
||||||
"maintainer": "Work Louder",
|
"maintainer": "Work Louder",
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0x574C",
|
"vid": "0x574C",
|
||||||
"pid": "0x1DF8",
|
"pid": "0x1DF9",
|
||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1"
|
||||||
},
|
},
|
||||||
"layouts": {
|
"layouts": {
|
||||||
|
@ -15,30 +15,28 @@
|
|||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
#define LAYOUT_via( \
|
|
||||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, \
|
|
||||||
k00_a, k00_b, k01_a, k01_b, k02_a, k02_b \
|
|
||||||
) { \
|
|
||||||
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b }, \
|
|
||||||
{ k00_a, k00_b, k01_a, k01_b, k02_a, k02_b } \
|
|
||||||
}
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[0] = LAYOUT_via(
|
[0] = LAYOUT(
|
||||||
KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1),
|
KC_MUTE, KC_MPLY, R_M_TOG, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, MO(1)
|
||||||
KC_VOLU, KC_VOLD, KC_MNXT, KC_MPRV, R_M_MOD, R_M_RMOD
|
|
||||||
),
|
),
|
||||||
[1] = LAYOUT_via(
|
[1] = LAYOUT(
|
||||||
QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______,
|
QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, MO(2), _______
|
||||||
_______, _______, _______, _______, RGB_MOD, RGB_RMOD
|
|
||||||
),
|
),
|
||||||
[2] = LAYOUT_via(
|
[2] = LAYOUT(
|
||||||
QK_BOOT, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______,
|
QK_BOOT, _______, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, _______
|
||||||
_______, _______, _______, _______, R_M_MOD, R_M_RMOD
|
|
||||||
),
|
),
|
||||||
[3] = LAYOUT_via(
|
[3] = LAYOUT(
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
_______, _______, _______, _______, _______, _______
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||||
|
[0] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(R_M_RMOD, R_M_MOD) },
|
||||||
|
[1] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
|
||||||
|
[2] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
|
||||||
|
[3] = { ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______), ENCODER_CCW_CW(_______, _______) },
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
VIA_ENABLE = yes
|
VIA_ENABLE = yes
|
||||||
LTO_ENABLE = yes
|
LTO_ENABLE = yes
|
||||||
|
ENCODER_MAP_ENABLE = yes
|
||||||
SRC += encoder_actions.c
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "loop.h"
|
#include "loop.h"
|
||||||
|
|
||||||
#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
#if defined(ENCODER_ENABLE)
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
if (!encoder_update_user(index, clockwise)) { return false; }
|
if (!encoder_update_user(index, clockwise)) { return false; }
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "encoder_actions.h"
|
|
||||||
#include "rgb_functions.h"
|
#include "rgb_functions.h"
|
||||||
|
|
||||||
/* This is a shortcut to help you visually see your layout.
|
/* This is a shortcut to help you visually see your layout.
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
"max_brightness": 255,
|
"max_brightness": 255,
|
||||||
"saturation_steps": 8
|
"saturation_steps": 8
|
||||||
},
|
},
|
||||||
"url": "",
|
"url": "https://worklouder.cc/",
|
||||||
"usb": {
|
"usb": {
|
||||||
"device_version": "1.0.0",
|
"device_version": "1.0.0",
|
||||||
"pid": "0xE6E3",
|
"pid": "0xE6E3",
|
||||||
|
@ -26,7 +26,7 @@ led_config_t g_led_config = { {
|
|||||||
// clang-format on
|
// clang-format on
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(ENCODER_ENABLE) && !defined(ENCODERS) && !defined(ENCODER_MAP_ENABLE)
|
#if defined(ENCODER_ENABLE)
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
if (!encoder_update_user(index, clockwise)) {
|
if (!encoder_update_user(index, clockwise)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
|
|
||||||
/* key matrix size */
|
/* key matrix size */
|
||||||
#define MATRIX_ROWS 1
|
#define MATRIX_ROWS 1
|
||||||
#define MATRIX_COLS 5
|
#define MATRIX_COLS 3
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Keyboard Matrix Assignments
|
* Keyboard Matrix Assignments
|
||||||
@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define MATRIX_ROW_PINS \
|
#define MATRIX_ROW_PINS \
|
||||||
{ F7 }
|
{ F7 }
|
||||||
#define MATRIX_COL_PINS \
|
#define MATRIX_COL_PINS \
|
||||||
{ B5, B6, C6, NO_PIN, NO_PIN }
|
{ B5, B6, C6 }
|
||||||
|
|
||||||
/* COL2ROW, ROW2COL */
|
/* COL2ROW, ROW2COL */
|
||||||
#define DIODE_DIRECTION COL2ROW
|
#define DIODE_DIRECTION COL2ROW
|
||||||
@ -195,14 +195,3 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
{ D7 }
|
{ D7 }
|
||||||
#define ENCODERS_PAD_B \
|
#define ENCODERS_PAD_B \
|
||||||
{ B4 }
|
{ B4 }
|
||||||
|
|
||||||
#define ENCODERS 1
|
|
||||||
|
|
||||||
#define ENCODERS_CW_KEY \
|
|
||||||
{ \
|
|
||||||
{ 3, 0 } \
|
|
||||||
}
|
|
||||||
#define ENCODERS_CCW_KEY \
|
|
||||||
{ \
|
|
||||||
{ 4, 0 } \
|
|
||||||
}
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"keyboard_name": "Nano Pad",
|
"keyboard_name": "Nano Pad",
|
||||||
"manufacturer": "Work Louder",
|
"manufacturer": "Work Louder",
|
||||||
"url": "",
|
"url": "https://worklouder.cc/",
|
||||||
"maintainer": "Work Louder",
|
"maintainer": "Work Louder",
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0x574C",
|
"vid": "0x574C",
|
||||||
"pid": "0xE6EF",
|
"pid": "0xE6F0",
|
||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1"
|
||||||
},
|
},
|
||||||
"layouts": {
|
"layouts": {
|
||||||
|
@ -15,31 +15,28 @@
|
|||||||
*/
|
*/
|
||||||
#include QMK_KEYBOARD_H
|
#include QMK_KEYBOARD_H
|
||||||
|
|
||||||
|
|
||||||
#define LAYOUT_via( \
|
|
||||||
k00, k01, k02, \
|
|
||||||
k00_a, k00_b \
|
|
||||||
) { \
|
|
||||||
{ k00, k01, k02, k00_a, k00_b } \
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
/* Base */
|
/* Base */
|
||||||
[0] = LAYOUT_via(
|
[0] = LAYOUT(
|
||||||
KC_PSCR, MACRO00, MO(1),
|
KC_PSCR, MACRO00, MO(1)
|
||||||
KC_PGDN, KC_PGUP
|
|
||||||
),
|
),
|
||||||
[1] = LAYOUT_via(
|
[1] = LAYOUT(
|
||||||
QK_BOOT, MACRO01, _______,
|
QK_BOOT, MACRO01, _______
|
||||||
_______, _______
|
|
||||||
),
|
),
|
||||||
[2] = LAYOUT_via(
|
[2] = LAYOUT(
|
||||||
_______, _______, _______,
|
_______, _______, _______
|
||||||
_______, _______
|
|
||||||
),
|
),
|
||||||
[3] = LAYOUT_via(
|
[3] = LAYOUT(
|
||||||
_______, _______, _______,
|
_______, _______, _______
|
||||||
_______, _______
|
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||||
|
[0] = { ENCODER_CCW_CW(KC_PGDN, KC_PGDN) },
|
||||||
|
[1] = { ENCODER_CCW_CW(_______, _______) },
|
||||||
|
[2] = { ENCODER_CCW_CW(_______, _______) },
|
||||||
|
[3] = { ENCODER_CCW_CW(_______, _______) },
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
VIA_ENABLE = yes
|
VIA_ENABLE = yes
|
||||||
LTO_ENABLE = yes
|
LTO_ENABLE = yes
|
||||||
|
ENCODER_MAP_ENABLE = yes
|
||||||
SRC += encoder_actions.c
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "nano.h"
|
#include "nano.h"
|
||||||
|
|
||||||
#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
#if defined(ENCODER_ENABLE)
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
if (!encoder_update_user(index, clockwise)) { return false; }
|
if (!encoder_update_user(index, clockwise)) { return false; }
|
||||||
if (clockwise) {
|
if (clockwise) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "encoder_actions.h"
|
|
||||||
#include "rgb_functions.h"
|
#include "rgb_functions.h"
|
||||||
|
|
||||||
/* This is a shortcut to help you visually see your layout.
|
/* This is a shortcut to help you visually see your layout.
|
||||||
|
@ -18,159 +18,15 @@
|
|||||||
#include "rgb_functions.h"
|
#include "rgb_functions.h"
|
||||||
|
|
||||||
#ifdef RGBLIGHT_ENABLE
|
#ifdef RGBLIGHT_ENABLE
|
||||||
# include "ws2812.h"
|
#undef RGB_DI_PIN
|
||||||
# include <avr/interrupt.h>
|
#define RGB_DI_PIN RGBLIGHT_DI_PIN
|
||||||
# include <avr/io.h>
|
|
||||||
# include <util/delay.h>
|
|
||||||
|
|
||||||
# define pinmask(pin) (_BV((pin)&0xF))
|
#define ws2812_setleds ws2812_rgb_setleds
|
||||||
|
|
||||||
/*
|
#include "ws2812.c"
|
||||||
* Forward declare internal functions
|
|
||||||
*
|
|
||||||
* The functions take a byte-array and send to the data output as WS2812 bitstream.
|
|
||||||
* The length is the number of bytes to send - three per LED.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi);
|
|
||||||
|
|
||||||
/*
|
|
||||||
This routine writes an array of bytes with RGB values to the Dataout pin
|
|
||||||
using the fast 800kHz clockless WS2811/2812 protocol.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Timing in ns
|
|
||||||
# define w_zeropulse 350
|
|
||||||
# define w_onepulse 900
|
|
||||||
# define w_totalperiod 1250
|
|
||||||
|
|
||||||
// Fixed cycles used by the inner loop
|
|
||||||
# define w_fixedlow 2
|
|
||||||
# define w_fixedhigh 4
|
|
||||||
# define w_fixedtotal 8
|
|
||||||
|
|
||||||
// Insert NOPs to match the timing, if possible
|
|
||||||
# define w_zerocycles (((F_CPU / 1000) * w_zeropulse) / 1000000)
|
|
||||||
# define w_onecycles (((F_CPU / 1000) * w_onepulse + 500000) / 1000000)
|
|
||||||
# define w_totalcycles (((F_CPU / 1000) * w_totalperiod + 500000) / 1000000)
|
|
||||||
|
|
||||||
// w1_nops - nops between rising edge and falling edge - low
|
|
||||||
# if w_zerocycles >= w_fixedlow
|
|
||||||
# define w1_nops (w_zerocycles - w_fixedlow)
|
|
||||||
# else
|
|
||||||
# define w1_nops 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// w2_nops - nops between fe low and fe high
|
|
||||||
# if w_onecycles >= (w_fixedhigh + w1_nops)
|
|
||||||
# define w2_nops (w_onecycles - w_fixedhigh - w1_nops)
|
|
||||||
# else
|
|
||||||
# define w2_nops 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// w3_nops - nops to complete loop
|
|
||||||
# if w_totalcycles >= (w_fixedtotal + w1_nops + w2_nops)
|
|
||||||
# define w3_nops (w_totalcycles - w_fixedtotal - w1_nops - w2_nops)
|
|
||||||
# else
|
|
||||||
# define w3_nops 0
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// The only critical timing parameter is the minimum pulse length of the "0"
|
|
||||||
// Warn or throw error if this timing can not be met with current F_CPU settings.
|
|
||||||
# define w_lowtime ((w1_nops + w_fixedlow) * 1000000) / (F_CPU / 1000)
|
|
||||||
# if w_lowtime > 550
|
|
||||||
# error "Light_ws2812: Sorry, the clock speed is too low. Did you set F_CPU correctly?"
|
|
||||||
# elif w_lowtime > 450
|
|
||||||
# warning "Light_ws2812: The timing is critical and may only work on WS2812B, not on WS2812(S)."
|
|
||||||
# warning "Please consider a higher clockspeed, if possible"
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# define w_nop1 "nop \n\t"
|
|
||||||
# define w_nop2 "rjmp .+0 \n\t"
|
|
||||||
# define w_nop4 w_nop2 w_nop2
|
|
||||||
# define w_nop8 w_nop4 w_nop4
|
|
||||||
# define w_nop16 w_nop8 w_nop8
|
|
||||||
|
|
||||||
static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi) {
|
|
||||||
uint8_t curbyte, ctr, sreg_prev;
|
|
||||||
|
|
||||||
sreg_prev = SREG;
|
|
||||||
cli();
|
|
||||||
|
|
||||||
while (datlen--) {
|
|
||||||
curbyte = (*data++);
|
|
||||||
|
|
||||||
asm volatile(" ldi %0,8 \n\t"
|
|
||||||
"loop%=: \n\t"
|
|
||||||
" out %2,%3 \n\t" // '1' [01] '0' [01] - re
|
|
||||||
# if (w1_nops & 1)
|
|
||||||
w_nop1
|
|
||||||
# endif
|
|
||||||
# if (w1_nops & 2)
|
|
||||||
w_nop2
|
|
||||||
# endif
|
|
||||||
# if (w1_nops & 4)
|
|
||||||
w_nop4
|
|
||||||
# endif
|
|
||||||
# if (w1_nops & 8)
|
|
||||||
w_nop8
|
|
||||||
# endif
|
|
||||||
# if (w1_nops & 16)
|
|
||||||
w_nop16
|
|
||||||
# endif
|
|
||||||
" sbrs %1,7 \n\t" // '1' [03] '0' [02]
|
|
||||||
" out %2,%4 \n\t" // '1' [--] '0' [03] - fe-low
|
|
||||||
" lsl %1 \n\t" // '1' [04] '0' [04]
|
|
||||||
# if (w2_nops & 1)
|
|
||||||
w_nop1
|
|
||||||
# endif
|
|
||||||
# if (w2_nops & 2)
|
|
||||||
w_nop2
|
|
||||||
# endif
|
|
||||||
# if (w2_nops & 4)
|
|
||||||
w_nop4
|
|
||||||
# endif
|
|
||||||
# if (w2_nops & 8)
|
|
||||||
w_nop8
|
|
||||||
# endif
|
|
||||||
# if (w2_nops & 16)
|
|
||||||
w_nop16
|
|
||||||
# endif
|
|
||||||
" out %2,%4 \n\t" // '1' [+1] '0' [+1] - fe-high
|
|
||||||
# if (w3_nops & 1)
|
|
||||||
w_nop1
|
|
||||||
# endif
|
|
||||||
# if (w3_nops & 2)
|
|
||||||
w_nop2
|
|
||||||
# endif
|
|
||||||
# if (w3_nops & 4)
|
|
||||||
w_nop4
|
|
||||||
# endif
|
|
||||||
# if (w3_nops & 8)
|
|
||||||
w_nop8
|
|
||||||
# endif
|
|
||||||
# if (w3_nops & 16)
|
|
||||||
w_nop16
|
|
||||||
# endif
|
|
||||||
|
|
||||||
" dec %0 \n\t" // '1' [+2] '0' [+2]
|
|
||||||
" brne loop%=\n\t" // '1' [+3] '0' [+4]
|
|
||||||
: "=&d"(ctr)
|
|
||||||
: "r"(curbyte), "I"(_SFR_IO_ADDR(PORTx_ADDRESS(RGBLIGHT_DI_PIN))), "r"(maskhi), "r"(masklo));
|
|
||||||
}
|
|
||||||
|
|
||||||
SREG = sreg_prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) {
|
void rgblight_call_driver(LED_TYPE *start_led, uint8_t num_leds) {
|
||||||
DDRx_ADDRESS(RGBLIGHT_DI_PIN) |= pinmask(RGBLIGHT_DI_PIN);
|
ws2812_setleds(start_led, num_leds);
|
||||||
|
|
||||||
uint8_t masklo = ~(pinmask(RGBLIGHT_DI_PIN)) & PORTx_ADDRESS(RGBLIGHT_DI_PIN);
|
|
||||||
uint8_t maskhi = pinmask(RGBLIGHT_DI_PIN) | PORTx_ADDRESS(RGBLIGHT_DI_PIN);
|
|
||||||
|
|
||||||
ws2812_sendarray_mask((uint8_t *)start_led, num_leds * sizeof(LED_TYPE), masklo, maskhi);
|
|
||||||
|
|
||||||
_delay_us(WS2812_TRST_US);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -182,17 +182,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
#define ENCODERS_PAD_B \
|
#define ENCODERS_PAD_B \
|
||||||
{ B1 }
|
{ B1 }
|
||||||
|
|
||||||
#define ENCODERS 1
|
|
||||||
|
|
||||||
#define ENCODERS_CW_KEY \
|
|
||||||
{ \
|
|
||||||
{ 12, 1 } \
|
|
||||||
}
|
|
||||||
#define ENCODERS_CCW_KEY \
|
|
||||||
{ \
|
|
||||||
{ 12, 2 } \
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bootmagic Lite key configuration */
|
/* Bootmagic Lite key configuration */
|
||||||
//#define BOOTMAGIC_LITE_ROW 0
|
//#define BOOTMAGIC_LITE_ROW 0
|
||||||
//#define BOOTMAGIC_LITE_COLUMN 0
|
//#define BOOTMAGIC_LITE_COLUMN 0
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"keyboard_name": "Work Board",
|
"keyboard_name": "Work Board",
|
||||||
"manufacturer": "Work Louder",
|
"manufacturer": "Work Louder",
|
||||||
"url": "",
|
"url": "https://worklouder.cc/",
|
||||||
"maintainer": "Work Louder",
|
"maintainer": "Work Louder",
|
||||||
"usb": {
|
"usb": {
|
||||||
"vid": "0x574C",
|
"vid": "0x574C",
|
||||||
"pid": "0xDCD0",
|
"pid": "0xDCD1",
|
||||||
"device_version": "0.0.1"
|
"device_version": "0.0.1"
|
||||||
},
|
},
|
||||||
"layouts": {
|
"layouts": {
|
||||||
|
@ -30,46 +30,33 @@ enum tap_dances {
|
|||||||
#define LOWER FN_MO13
|
#define LOWER FN_MO13
|
||||||
#define RAISE FN_MO23
|
#define RAISE FN_MO23
|
||||||
|
|
||||||
#define LAYOUT_via( \
|
|
||||||
k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c, \
|
|
||||||
k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a, \
|
|
||||||
k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b, \
|
|
||||||
k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b \
|
|
||||||
) \
|
|
||||||
{ \
|
|
||||||
{ k00, k01, k02, k03, k04, k05, k06, k07, k08, k09, k0a, k0b, k0c }, \
|
|
||||||
{ k10, k11, k12, k13, k14, k15, k16, k17, k18, k19, k1a, k1b, k0c_a }, \
|
|
||||||
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b, k0c_b }, \
|
|
||||||
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b, ___ } \
|
|
||||||
}
|
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||||
[_QWERTY] = LAYOUT_via(
|
[_QWERTY] = LAYOUT(
|
||||||
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, USER09,
|
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, USER09,
|
||||||
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_VOLU,
|
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
|
||||||
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , KC_VOLD,
|
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT ,
|
||||||
KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
KC_LSFT, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT
|
||||||
),
|
),
|
||||||
|
|
||||||
[_LOWER] = LAYOUT_via(
|
[_LOWER] = LAYOUT(
|
||||||
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______,
|
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC, _______,
|
||||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_PGDN,
|
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
|
||||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______, KC_PGUP,
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
||||||
),
|
),
|
||||||
|
|
||||||
[_RAISE] = LAYOUT_via(
|
[_RAISE] = LAYOUT(
|
||||||
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______,
|
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC, _______,
|
||||||
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_DOWN,
|
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
|
||||||
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______, KC_UP,
|
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY
|
||||||
),
|
),
|
||||||
|
|
||||||
[_ADJUST] = LAYOUT_via(
|
[_ADJUST] = LAYOUT(
|
||||||
_______, QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , R_M_TOG,
|
_______, QK_BOOT, _______, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_DEL , R_M_TOG,
|
||||||
_______, _______, MU_MOD, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______, R_M_HUI,
|
_______, _______, MU_MOD, R_M_TOG, R_M_MOD, R_M_HUI, R_M_HUD, R_M_SAI, R_M_SAD, R_M_VAI, R_M_VAD, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, R_M_HUD,
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
|
||||||
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@ -127,3 +114,12 @@ layer_state_t layer_state_set_user(layer_state_t state) {
|
|||||||
|
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ENCODER_MAP_ENABLE
|
||||||
|
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
|
||||||
|
[_QWERTY] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
|
||||||
|
[_LOWER] = { ENCODER_CCW_CW(KC_PGUP, KC_PGDN) },
|
||||||
|
[_RAISE] = { ENCODER_CCW_CW(KC_UP, KC_DOWN) },
|
||||||
|
[_ADJUST] = { ENCODER_CCW_CW(R_M_HUI, R_M_HUD) },
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
VIA_ENABLE = yes
|
VIA_ENABLE = yes
|
||||||
TAP_DANCE_ENABLE = yes
|
TAP_DANCE_ENABLE = yes
|
||||||
|
ENCODER_MAP_ENABLE = yes
|
||||||
SRC += encoder_actions.c
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
#include "work_board.h"
|
#include "work_board.h"
|
||||||
|
|
||||||
#if !defined(VIA_ENABLE) && defined(ENCODER_ENABLE)
|
#if defined(ENCODER_ENABLE)
|
||||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||||
if (!encoder_update_user(index, clockwise)) {
|
if (!encoder_update_user(index, clockwise)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "quantum.h"
|
#include "quantum.h"
|
||||||
#include "encoder_actions.h"
|
|
||||||
#include "rgb_functions.h"
|
#include "rgb_functions.h"
|
||||||
|
|
||||||
#define ___ KC_NO
|
#define ___ KC_NO
|
||||||
|
Loading…
Reference in New Issue
Block a user