Browse Source

Squashed commit of the following:

commit c5ed8e7d33
Author: hsuchil <hsuchil@hsuchil.com.com>
Date:   Thu Apr 21 08:59:07 2022 -0700

    Add more keymaps

commit 3e30597ebc
Author: hsuchil <hsuchil@hsuchil.com.com>
Date:   Sun Apr 17 23:39:47 2022 -0700

    Add mountain and layout

    Changes.

    Changes.
pull/16868/head
hsuchil 1 year ago
parent
commit
d7e5932c87
16 changed files with 591 additions and 8 deletions
  1. +3
    -0
      keyboards/mechwild/obe/keymaps/hsuchil/config.h
  2. +3
    -0
      keyboards/mechwild/obe/keymaps/hsuchil/rules.mk
  3. +56
    -0
      keyboards/ydkb/mountain/config.h
  4. +38
    -0
      keyboards/ydkb/mountain/keymaps/default/keymap.c
  5. +24
    -0
      keyboards/ydkb/mountain/keymaps/hsuchil/config.h
  6. +55
    -0
      keyboards/ydkb/mountain/keymaps/hsuchil/keymap.c
  7. +1
    -0
      keyboards/ydkb/mountain/keymaps/hsuchil/rules.mk
  8. +36
    -0
      keyboards/ydkb/mountain/led.c
  9. +160
    -0
      keyboards/ydkb/mountain/matrix.c
  10. +50
    -0
      keyboards/ydkb/mountain/mountain.h
  11. +30
    -0
      keyboards/ydkb/mountain/rules.mk
  12. +18
    -0
      keyboards/ydkb/mountain/switch_board.h
  13. +95
    -0
      users/hsuchil/custom_tapdance.c
  14. +7
    -7
      users/hsuchil/hsuchil.c
  15. +10
    -0
      users/hsuchil/hsuchil.h
  16. +5
    -1
      users/hsuchil/rules.mk

+ 3
- 0
keyboards/mechwild/obe/keymaps/hsuchil/config.h View File

@ -17,6 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#define BOOTMAGIC_LITE_ROW 5
#define BOOTMAGIC_LITE_COLUMN 4
// Redefine number of LED
#ifdef RGBLED_NUM
# undef RGBLED_NUM


+ 3
- 0
keyboards/mechwild/obe/keymaps/hsuchil/rules.mk View File

@ -1,2 +1,5 @@
RGBLIGHT_ENABLE = yes
VIA_ENABLE = yes
ENCODER_ENABLE = yes
BOOTMAGIC_ENABLE = yes

+ 56
- 0
keyboards/ydkb/mountain/config.h View File

@ -0,0 +1,56 @@
/* Copyright 2020
*
* 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 FW_VER QMK_DM3T
#define VENDOR_ID 0x9D5B
#define PRODUCT_ID 0x2163
#define DEVICE_VER 0x0001
#define MANUFACTURER YDKB
#define PRODUCT Mountain (FW_VER)
/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 16
#define MOUSEKEY_INTERVAL 20
#define MOUSEKEY_DELAY 0
#define MOUSEKEY_TIME_TO_MAX 60
#define MOUSEKEY_MAX_SPEED 7
#define MOUSEKEY_WHEEL_DELAY 0
#define TAPPING_TOGGLE 1
#define TAPPING_TERM 200
#define IGNORE_MOD_TAP_INTERRUPT // this makes it possible to do rolling combos (zx) with keys that convert to other keys on hold (z becomes ctrl when you hold it, and when this option isn't enabled, z rapidly followed by x actually sends Ctrl-x. That's bad.)
/* key combination for command */
#define IS_COMMAND() ( \
get_mods() == (MOD_BIT(KC_LSFT) | MOD_BIT(KC_RSFT)) \
)
/* fix space cadet rollover issue */
#define DISABLE_SPACE_CADET_ROLLOVER
/* NKRO */
#ifndef FORCE_NKRO
#define FORCE_NKRO // Depends on NKRO_ENABLE.
#endif

+ 38
- 0
keyboards/ydkb/mountain/keymaps/default/keymap.c View File

@ -0,0 +1,38 @@
/*
Copyright 2022
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_default(
KC_ESC, 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_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_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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP,
KC_LCTL, KC_LALT, KC_SPC, MO(1), KC_SPC, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT
),
[1] = LAYOUT_default(
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
_______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
};

+ 24
- 0
keyboards/ydkb/mountain/keymaps/hsuchil/config.h View File

@ -0,0 +1,24 @@
/*
Copyright 2022 Hector Galindo <hi@hsuchil.com>
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
#ifdef TAPPING_TERM
#undef TAPPING_TERM
#endif
#define TAPPING_TERM 150

+ 55
- 0
keyboards/ydkb/mountain/keymaps/hsuchil/keymap.c View File

@ -0,0 +1,55 @@
/*
Copyright 2022 Hector Galindo <hi@hsuchil.com>
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
#include "hsuchil.h"
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_BSE] = LAYOUT_default(
KC_GRV, 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_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,
RCT_ESC, 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_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, L_BHGH, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, TD_RSFTUP, KC_HYPR,
KC_LCTL, KC_LALT, KC_SPC, L_LOW, KC_SPC, KC_RGUI, KC_LEFT, KC_DOWN, KC_RGHT
),
[_LOW] = LAYOUT_default(
_______, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL,
_______, _______, _______, _______, RESET, _______, _______, _______, _______, _______, _______, _______, _______, _______,
KC_CAPS, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, TOG_MAC, _______, _______, _______, KC_PGUP, _______,
_______, _______, KC_HYPR, _______, KC_MEH, _______, KC_HOME, KC_PGDN, KC_END
),
[_HGH] = LAYOUT_default(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_VOLU, _______,
_______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_MPLY
),
[_FNC] = LAYOUT_default(
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______
),
};

+ 1
- 0
keyboards/ydkb/mountain/keymaps/hsuchil/rules.mk View File

@ -0,0 +1 @@
VIA_ENABLE = yes

+ 36
- 0
keyboards/ydkb/mountain/led.c View File

@ -0,0 +1,36 @@
/*
Copyright 2011 Jun Wako <wakojun@gmail.com>
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 <avr/io.h>
#include "stdint.h"
#include "led.h"
void led_set_user(uint8_t usb_led)
{
if (usb_led & (1<<USB_LED_CAPS_LOCK)) {
// output high
DDRD |= (1<<5);
PORTD |= (1<<5);
} else {
// output low
DDRD |= (1<<5);
PORTD &= ~(1<<5);
}
}

+ 160
- 0
keyboards/ydkb/mountain/matrix.c View File

@ -0,0 +1,160 @@
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#include "wait.h"
#include "action_layer.h"
#include "print.h"
#include "debug.h"
#include "util.h"
#include "timer.h"
#include "matrix.h"
#include "switch_board.h"
#define DEBOUNCE_DN_MASK (uint8_t)(~(0x80 >> 5))
#define DEBOUNCE_UP_MASK (uint8_t)(0x80 >> 5)
static matrix_row_t matrix[MATRIX_ROWS] = {0};
static uint16_t matrix_scan_timestamp = 0;
static uint8_t matrix_debouncing[MATRIX_ROWS][MATRIX_COLS] = {0};
static void select_next_key(uint8_t mode);
static uint8_t get_key(uint8_t col);
static void init_cols(void);
__attribute__ ((weak))
void matrix_scan_user(void) {}
__attribute__ ((weak))
void matrix_scan_kb(void) {
matrix_scan_user();
}
inline
uint8_t matrix_rows(void)
{
return MATRIX_ROWS;
}
inline
uint8_t matrix_cols(void)
{
return MATRIX_COLS;
}
static void get_key_ready(void) {
DDRB &= ~(1<<3);
PORTB |= (1<<3);
_delay_us(5);
}
inline void select_key_ready(void) {
DDRB |= (1<<3);
}
void matrix_init(void)
{
init_cols();
}
uint8_t matrix_scan(void)
{
uint16_t time_check = timer_read();
if (matrix_scan_timestamp == time_check) return 1;
matrix_scan_timestamp = time_check;
select_next_key(0);
uint8_t *debounce = &matrix_debouncing[0][0];
for (uint8_t row=0; row<matrix_rows(); row++) {
for (uint8_t col=0; col<matrix_cols(); col++, *debounce++) {
uint8_t real_col = col/2;
if (col & 1) real_col += 8;
uint8_t key = get_key(real_col);
if (real_col >= 8) select_next_key(1);
*debounce = (*debounce >> 1) | key;
if ((*debounce > 0) && (*debounce < 255)) {
matrix_row_t *p_row = &matrix[row];
matrix_row_t col_mask = ((matrix_row_t)1 << real_col);
if (*debounce >= DEBOUNCE_DN_MASK) {
*p_row |= col_mask;
} else if (*debounce <= DEBOUNCE_UP_MASK) {
*p_row &= ~col_mask;
}
}
}
}
matrix_scan_quantum();
return 1;
}
inline
bool matrix_is_on(uint8_t row, uint8_t col)
{
return (matrix[row] & ((matrix_row_t)1<<col));
}
inline
matrix_row_t matrix_get_row(uint8_t row)
{
return matrix[row];
}
void matrix_print(void)
{
print("\nr/c 0123456789ABCDEF\n");
for (uint8_t row = 0; row < MATRIX_ROWS; row++) {
print_hex8(row); print(": ");
print_bin_reverse16(matrix_get_row(row));
print("\n");
}
}
uint8_t matrix_key_count(void)
{
uint8_t count = 0;
for (uint8_t i = 0; i < MATRIX_ROWS; i++) {
count += bitpop16(matrix[i]);
}
return count;
}
void init_cols(void)
{
//595 pin
DDRB |= (1<<3 | 1<<1);
DDRB &= ~(1<<2);
PORTB |= (1<<3 | 1<<2 | 1<<1);
}
static uint8_t get_key(uint8_t col) {
if (col<8) return PINB&(1<<3) ? 0 : 0x80;
else return PINB&(1<<2) ? 0 : 0x80;
}
void unselect_rows(void)
{
}
static void select_next_key(uint8_t mode)
{
select_key_ready();
if (mode == 0) {
DS_PL_HI();
for (uint8_t i = 0; i < 40; i++) {
CLOCK_PULSE();
}
DS_PL_LO();
CLOCK_PULSE();
} else {
DS_PL_HI();
CLOCK_PULSE();
}
get_key_ready();
}

+ 50
- 0
keyboards/ydkb/mountain/mountain.h View File

@ -0,0 +1,50 @@
/* Copyright 2022
*
* 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
#define ___ KC_NO
#include "quantum.h"
#define LAYOUT_default( \
K00, K01, K02, K03, K04, K05, K06, K49, K4A, K4B, K4C, K4D, K4E, K48, \
K07, K10, K11, K12, K13, K14, K39, K3A, K3B, K3C, K3D, K3E, K3F, K38, \
K17, K20, K21, K22, K16, K15, K29, K2A, K2B, K2C, K2D, K2E, K28, \
K27, K31, K26, K25, K24, K23, K19, K1A, K1B, K1C, K1D, K1E, K1F, K18, \
K37, K35, K34, K33, K0A, K0B, K0C, K0F, K08 \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, ___, K0A, K0B, K0C, ___, ___, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, ___ }, \
{ ___, K31, ___, K33, K34, K35, ___, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \
{ ___, ___, ___, ___, ___, ___, ___, ___, K48, K49, K4A, K4B, K4C, K4D, K4E, ___ } \
}
#define LAYOUT_split_backspace( \
K00, K01, K02, K03, K04, K05, K06, K49, K4A, K4B, K4C, K4D, K4E, K4F, K48, \
K07, K10, K11, K12, K13, K14, K39, K3A, K3B, K3C, K3D, K3E, K3F, K38, \
K17, K20, K21, K22, K16, K15, K29, K2A, K2B, K2C, K2D, K2E, K28, \
K27, K31, K26, K25, K24, K23, K19, K1A, K1B, K1C, K1D, K1E, K1F, K18, \
K37, K35, K34, K33, K0A, K0B, K0C, K0F, K08 \
) { \
{ K00, K01, K02, K03, K04, K05, K06, K07, K08, ___, K0A, K0B, K0C, ___, ___, K0F }, \
{ K10, K11, K12, K13, K14, K15, K16, K17, K18, K19, K1A, K1B, K1C, K1D, K1E, K1F }, \
{ K20, K21, K22, K23, K24, K25, K26, K27, K28, K29, K2A, K2B, K2C, K2D, K2E, ___ }, \
{ ___, K31, ___, K33, K34, K35, ___, K37, K38, K39, K3A, K3B, K3C, K3D, K3E, K3F }, \
{ ___, ___, ___, ___, ___, ___, ___, ___, K48, K49, K4A, K4B, K4C, K4D, K4E, K4F } \
}

+ 30
- 0
keyboards/ydkb/mountain/rules.mk View File

@ -0,0 +1,30 @@
# MCU name
MCU = atmega32u4
# Processor frequency
F_CPU = 8000000
# Bootloader selection
BOOTLOADER = lufa-ms
BOOTLOADER_SIZE = 6144
# Build Options
# change yes to no to disable
#
CUSTOM_MATRIX = yes # Custom matrix file
UNICODE_ENABLE = yes # Unicode
BOOTMAGIC_ENABLE = yes # 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 = yes # Enable N-Key Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
SWAP_HANDS_ENABLE = no # Disable Onehand
RGBLIGHT_ENABLE = no
# project specific files
SRC = \
led.c \
matrix.c \

+ 18
- 0
keyboards/ydkb/mountain/switch_board.h View File

@ -0,0 +1,18 @@
#ifndef SWITCH_BOARD_H
#define SWITCH_BOARD_H
#include <stdint.h>
#include <stdbool.h>
#include <avr/io.h>
#define DS_PL_HI() (PORTB |= (1<<PB3))
#define DS_PL_LO() (PORTB &= ~(1<<PB3))
#define CLOCK_PULSE() \
do { \
PORTB |= (1<<PB1); \
asm("nop"); \
PORTB &= ~(1<<PB1); \
} while(0)
#endif

+ 95
- 0
users/hsuchil/custom_tapdance.c View File

@ -0,0 +1,95 @@
/*
Copyright 2022 Hector Galindo <hi@hsuchil.com>
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
#include "process_tap_dance.h"
#include "hsuchil.h"
#define TD_FN(FN_NAME) void FN_NAME(qk_tap_dance_state_t *state, void *user_data)
#define TD_ON_EACH_TAP_FN_N(T) T##_on_each_tap
#define TD_ON_EACH_TAP_FN(T) TD_FN(TD_ON_EACH_TAP_FN_N(T))
#define TD_ON_DANCE_FINISHED_FN_N(T) T##_on_dance_finished
#define TD_ON_DANCE_FINISHED_FN(T) TD_FN(TD_ON_DANCE_FINISHED_FN_N(T))
#define TD_ON_DANCE_RESET_FN_N(T) T##_on_dance_reset
#define TD_ON_DANCE_RESET_FN(T) TD_FN(TD_ON_DANCE_RESET_FN_N(T))
#define ACTION_TD_DEF(T,E,F,R) [T] = ACTION_TAP_DANCE_FN_ADVANCED(E,F,R)
#define ACTION_TD_DEF_FULL(T) ACTION_TD_DEF(T, TD_ON_EACH_TAP_FN_N(T), TD_ON_DANCE_FINISHED_FN_N(T), TD_ON_DANCE_RESET_FN_N(T))
#define ACTION_TD_DEF_NO_EACH(T) ACTION_TD_DEF(T, NULL, TD_ON_DANCE_FINISHED_FN_N(T), TD_ON_DANCE_RESET_FN_N(T))
#define ACTION_TD_DEF_NO_FINISHED(T) ACTION_TD_DEF(T, TD_ON_EACH_TAP_FN_N(T), NULL, TD_ON_DANCE_RESET_FN_N(T))
#define ACTION_TD_DEF_NO_RESET(T) ACTION_TD_DEF(T, TD_ON_EACH_TAP_FN_N(T), TD_ON_DANCE_FINISHED_FN_N(T), NULL)
#define ACTION_TD_DEF_ONLY_EACH(T) ACTION_TD_DEF(T, TD_ON_EACH_TAP_FN_N(T), NULL, NULL)
#define ACTION_TD_DEF_ONLY_FINISHED(T) ACTION_TD_DEF(T, NULL, TD_ON_DANCE_FINISHED_FN_N(T), NULL)
#define ACTION_TD_DEF_ONLY_RESET(T) ACTION_TD_DEF(T, NULL, NULL, TD_ON_DANCE_RESET_FN_N(T))
#define SIMPLE_DANCE_STATE cur_dance_simple(state)
#define DANCE_STATE cur_dance(state)
typedef enum {
TD_NONE,
TD_UNKNOWN,
TD_TAP,
TD_HOLD,
TD_SINGLE_TAP,
TD_SINGLE_HOLD,
TD_DOUBLE_TAP,
TD_DOUBLE_HOLD
} td_state_t;
td_state_t cur_dance_simple(qk_tap_dance_state_t *state) {
if (!state->pressed) return TD_TAP;
return TD_HOLD;
}
td_state_t cur_dance(qk_tap_dance_state_t *state) {
if (state->count == 1) {
if (!state->pressed) return TD_SINGLE_TAP;
return TD_SINGLE_HOLD;
}
if (state->count == 2) {
if (!state->pressed) return TD_DOUBLE_TAP;
return TD_DOUBLE_HOLD;
}
return TD_UNKNOWN;
}
static td_state_t rshift_up_state;
TD_ON_DANCE_FINISHED_FN(_TD_RSHIFT_UP) {
rshift_up_state = SIMPLE_DANCE_STATE;
if (rshift_up_state == TD_HOLD) {
register_mods(MOD_BIT(KC_RSFT));
} else {
register_code16(KC_UP);
}
}
TD_ON_DANCE_RESET_FN(_TD_RSHIFT_UP) {
if (rshift_up_state == TD_HOLD) {
unregister_mods(MOD_BIT(KC_RSFT));
} else {
unregister_code16(KC_UP);
}
}
qk_tap_dance_action_t tap_dance_actions[] = {
ACTION_TD_DEF_NO_EACH(_TD_RSHIFT_UP),
};

+ 7
- 7
users/hsuchil/hsuchil.c View File

@ -44,23 +44,22 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
}
return false;
default:
return extra_process_record_user(keycode, record);
break;
}
return true;
return extra_process_record_user(keycode, record);
}
#ifdef ENCODER_ENABLE
bool encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) {
if (clockwise) {
tap_code(KC_VOLD);
} else {
tap_code(KC_VOLU);
} else {
tap_code(KC_VOLD);
}
}
return true;
return false;
}
#endif
@ -125,3 +124,4 @@ void post_encoder_update_user(uint8_t index, bool clockwise) {
extra_post_encoder_update_user(index, clockwise);
}

+ 10
- 0
users/hsuchil/hsuchil.h View File

@ -43,3 +43,13 @@ enum custom_user_keycodes {
#define LCT_ESC LCTL_T(KC_ESC) // ESC if tapped, LCTL if held.
#define RCT_ESC RCTL_T(KC_ESC) // ESC if tapped, RCTL if held.
#define RSFT_UP RSFT_T(KC_UP)
// Tap Dance
enum tap_dance_keycodes {
_TD_RSHIFT_UP
};
#define TD_RSFTUP TD(_TD_RSHIFT_UP)

+ 5
- 1
users/hsuchil/rules.mk View File

@ -1 +1,5 @@
SRC += hsuchil.c
TAP_DANCE_ENABLE = yes
SRC += \
hsuchil.c \
custom_tapdance.c

Loading…
Cancel
Save