Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
qmk-bot committed Dec 15, 2021
2 parents 3c5b9f7 + 3fa592a commit c0bb153
Show file tree
Hide file tree
Showing 45 changed files with 815 additions and 187 deletions.
29 changes: 28 additions & 1 deletion keyboards/handwired/tractyl_manuform/5x6_right/f411/f411.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,41 @@

#include "f411.h"

void matrix_init_sub_kb(void) { setPinInputHigh(A0); }
void keyboard_pre_init_sub(void) { setPinInputHigh(A0); }

void matrix_scan_sub_kb(void) {
if (!readPin(A0)) {
reset_keyboard();
}
}

void bootmagic_lite(void) {
// We need multiple scans because debouncing can't be turned off.
matrix_scan();
#if defined(DEBOUNCE) && DEBOUNCE > 0
wait_ms(DEBOUNCE * 2);
#else
wait_ms(30);
#endif
matrix_scan();

uint8_t row = BOOTMAGIC_LITE_ROW;
uint8_t col = BOOTMAGIC_LITE_COLUMN;

#if defined(SPLIT_KEYBOARD) && defined(BOOTMAGIC_LITE_ROW_RIGHT) && defined(BOOTMAGIC_LITE_COLUMN_RIGHT)
if (!is_keyboard_left()) {
row = BOOTMAGIC_LITE_ROW_RIGHT;
col = BOOTMAGIC_LITE_COLUMN_RIGHT;
}
#endif

if (matrix_get_row(row) & (1 << col) || !readPin(A0)) {
eeconfig_disable();
bootloader_jump();
}
}


#ifdef USB_VBUS_PIN
bool usb_vbus_state(void) {
setPinInputLow(USB_VBUS_PIN);
Expand Down
5 changes: 3 additions & 2 deletions keyboards/handwired/tractyl_manuform/5x6_right/f411/readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Drashna's Blackpill Tractyl Manuform (5x6) with a right side trackball

* System Timer on TIM5
* ~~VBUS mod, using PB10~~ (*doesn't seem to work for me*)
* VBUS mod, using PB10 -- does work, but not on my tractyl... bad soldering probably
* Split Hand Pin, using PC14
* Full Duplex Serial/USART using PA2 and PA3 on USART2
* PWM Audio using PB1 and TIM3 and GPT on TIM4
Expand All @@ -12,7 +12,8 @@
* SSD1306 OLED display (128x64) using PB8-PB9 on I2C1
* Pull-up resistor (22k) on PA10 to fix reset issue.
* Pull-up resistor (5.1k) on PA1 for WS2812 LED support, and wire it's VCC to the 5V pin.
* Pins PA9, PA11, A12 are not useable because they're used for USB connection, and can't be shared.
* Pins PA9 is meant for VBUS sense, and has an internal pulldown resistor. A 5.1k pullup resistor can work (but should be avoided)
* Pins PA11 and A12 are not useable because they're used for USB connection, and can't be shared.
* Pin PB2 is used by BOOT1, and is unusable

## Keyboard Info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@

#include "drashna.h"

enum tractyl_keycodes {
KC_ACCEL = NEW_SAFE_RANGE,
};

bool enable_acceleration = false;
// clang-format off
#define LAYOUT_5x6_right_wrapper(...) LAYOUT_5x6_right(__VA_ARGS__)
#define LAYOUT_5x6_right_base( \
Expand Down Expand Up @@ -129,10 +124,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
VRSN, _________________ADJUST_L1_________________, _________________ADJUST_R1_________________, EEP_RST,
KEYLOCK, _________________ADJUST_L2_________________, _________________ADJUST_R2_________________, TG_MODS,
UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, KC_MPLY,
HPT_DWLI, HPT_DWLD, TG_GAME, TG_DBLO,
HPT_TOG, HPT_BUZ, KC_NUKE,
TG(_DIABLOII), AUTO_CTN, TG_GAME, TG_DBLO,
_______, _______, KC_NUKE,
_______, _______, _______,
_______, TG(_DIABLOII),KC_NUKE, _______
_______, _______, KC_NUKE, _______
),
};

Expand Down Expand Up @@ -169,116 +164,6 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
#endif

#ifdef POINTING_DEVICE_ENABLE
static uint16_t mouse_timer = 0;
static uint16_t mouse_debounce_timer = 0;
static uint8_t mouse_keycode_tracker = 0;
bool tap_toggling = false;

# ifdef TAPPING_TERM_PER_KEY
# define TAP_CHECK get_tapping_term(KC_BTN1, NULL)
# else
# ifndef TAPPING_TERM
# define TAPPING_TERM 200
# endif
# define TAP_CHECK TAPPING_TERM
# endif

report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) {
int8_t x = mouse_report.x, y = mouse_report.y;
mouse_report.x = 0;
mouse_report.y = 0;

if (x != 0 && y != 0) {
mouse_timer = timer_read();
# ifdef OLED_ENABLE
oled_timer = timer_read32();
# endif
if (timer_elapsed(mouse_debounce_timer) > TAP_CHECK) {
if (enable_acceleration) {
x = (x > 0 ? x * x / 16 + x : -x * x / 16 + x);
y = (y > 0 ? y * y / 16 + y : -y * y / 16 + y);
}
mouse_report.x = x;
mouse_report.y = y;
if (!layer_state_is(_MOUSE)) {
layer_on(_MOUSE);
}
}
}
return mouse_report;
}

void matrix_scan_keymap(void) {
if (timer_elapsed(mouse_timer) > 650 && layer_state_is(_MOUSE) && !mouse_keycode_tracker && !tap_toggling) {
layer_off(_MOUSE);
}
if (tap_toggling) {
if (!layer_state_is(_MOUSE)) {
layer_on(_MOUSE);
}
}
}

bool process_record_keymap(uint16_t keycode, keyrecord_t* record) {
switch (keycode) {
case TT(_MOUSE):
if (record->event.pressed) {
mouse_keycode_tracker++;
} else {
# if TAPPING_TOGGLE != 0
if (record->tap.count == TAPPING_TOGGLE) {
tap_toggling ^= 1;
# if TAPPING_TOGGLE == 1
if (!tap_toggling) mouse_keycode_tracker -= record->tap.count + 1;
# else
if (!tap_toggling) mouse_keycode_tracker -= record->tap.count;
# endif
} else {
mouse_keycode_tracker--;
}
# endif
}
mouse_timer = timer_read();
break;
case TG(_MOUSE):
if (record->event.pressed) {
tap_toggling ^= 1;
}
break;
case MO(_MOUSE):
case DPI_CONFIG:
case KC_MS_UP ... KC_MS_WH_RIGHT:
record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
mouse_timer = timer_read();
case KC_ACCEL:
enable_acceleration = record->event.pressed;
break;
default:
if (IS_NOEVENT(record->event)) break;
if ((keycode >= QK_LAYER_TAP && keycode <= QK_LAYER_TAP_MAX) && (((keycode >> 0x8) & 0xF) == _MOUSE)) {
record->event.pressed ? mouse_keycode_tracker++ : mouse_keycode_tracker--;
mouse_timer = timer_read();
break;
}
if (layer_state_is(_MOUSE) && !mouse_keycode_tracker) {
layer_off(_MOUSE);
}
mouse_keycode_tracker = 0;
mouse_debounce_timer = timer_read();
break;
}
return true;
}

layer_state_t layer_state_set_keymap(layer_state_t state) {
if (layer_state_cmp(state, _GAMEPAD) || layer_state_cmp(state, _DIABLO)) {
state |= ((layer_state_t)1 << _MOUSE);
}
return state;
}
#endif

#ifdef OLED_ENABLE
// WPM-responsive animation stuff here
# define SLEEP_FRAMES 2
Expand Down
3 changes: 2 additions & 1 deletion keyboards/handwired/tractyl_manuform/tm_sync.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <[email protected]>
*
* Copyright 2021 Dasky (@daskygit)
* 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
Expand Down
2 changes: 2 additions & 0 deletions keyboards/handwired/tractyl_manuform/tractyl_manuform.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
return true;
}
__attribute__((weak)) void keyboard_pre_init_sync(void) {}
__attribute__((weak)) void keyboard_pre_init_sub(void) {}
void keyboard_pre_init_kb(void) {
// debug_enable = true;
// debug_matrix = true;
Expand All @@ -82,6 +83,7 @@ void keyboard_pre_init_kb(void) {
writePin(DEBUG_LED_PIN, !debug_enable);
#endif

keyboard_pre_init_sub();
keyboard_pre_init_sync();
keyboard_pre_init_user();
}
Expand Down
32 changes: 16 additions & 16 deletions keyboards/keebio/iris/keymaps/drashna/rules.mk
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys(+4700)
EXTRAKEY_ENABLE = yes # Audio control and System control(+450)
CONSOLE_ENABLE = no # Console for debug(+400)
COMMAND_ENABLE = no # Commands for debug and configuration
TAP_DANCE_ENABLE = no
RGBLIGHT_ENABLE = yes
AUDIO_ENABLE = no
NKRO_ENABLE = yes
BACKLIGHT_ENABLE = no
SWAP_HANDS_ENABLE = no
SPACE_CADET_ENABLE = no

INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = no

BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
MOUSEKEY_ENABLE = no # Mouse keys
EXTRAKEY_ENABLE = yes # Audio control and System control
CONSOLE_ENABLE = no # Console for debug
COMMAND_ENABLE = no # Commands for debug and configuration
TAP_DANCE_ENABLE = no
RGBLIGHT_ENABLE = yes
AUDIO_ENABLE = no
NKRO_ENABLE = yes
BACKLIGHT_ENABLE = no
SWAP_HANDS_ENABLE = no
BOOTLOADER = qmk-dfu

INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = no
CUSTOM_UNICODE_ENABLE = no
CUSTOM_SPLIT_TRANSPORT_SYNC = no
2 changes: 1 addition & 1 deletion keyboards/moonlander/keymaps/drashna/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
VRSN, _________________ADJUST_L1_________________, TG(_DIABLOII), _______, _________________ADJUST_R1_________________, EEP_RST,
KEYLOCK, _________________ADJUST_L2_________________, _______, _______, _________________ADJUST_R2_________________, RGB_IDL,
UC_MOD, _________________ADJUST_L3_________________, _________________ADJUST_R3_________________, TG_MODS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, KC_PAUS,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, AUTO_CTN,
_______, _______, _______, _______, _______, _______
),
};
Expand Down
2 changes: 1 addition & 1 deletion keyboards/orthodox/keymaps/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ SPACE_CADET_ENABLE = no

INDICATOR_LIGHTS = yes
RGBLIGHT_STARTUP_ANIMATION = yes

CUSTOM_UNICODE_ENABLE = no

BOOTLOADER = qmk-dfu
2 changes: 1 addition & 1 deletion keyboards/splitkb/zima/keymaps/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#pragma once

#define OLED_FONT_H "users/drashna/drashna_font.h"
#define OLED_FONT_H "users/drashna/oled/drashna_font.h"
#define OLED_UPDATE_INTERVAL 15
#define OLED_DISABLE_TIMEOUT
#define OLED_FONT_END 255
Expand Down
10 changes: 5 additions & 5 deletions layouts/community/ergodox/drashna/rules.mk
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite
TAP_DANCE_ENABLE = no
COMMAND_ENABLE = no # Commands for debug and configuration
CONSOLE_ENABLE = no
Expand All @@ -9,12 +9,12 @@ ifeq ($(strip $(KEYBOARD)), ergodox_ez)
RGB_MATRIX_ENABLE = yes
INDICATOR_LIGHTS = no
RGBLIGHT_STARTUP_ANIMATION = yes
PIMORONI_TRACKBALL_ENABLE = yes
PIMORONI_TRACKBALL_ENABLE = no
MOUSEKEY_ENABLE = no
endif

UNICODE_ENABLE = no
UNICDOEMAP_ENABLE = no

UNICODE_ENABLE = no
UNICDOEMAP_ENABLE = no
CUSTOM_UNICODE_ENABLE = no

DEBOUNCE_TYPE = sym_eager_pr
1 change: 1 addition & 0 deletions layouts/community/ortho_5x12/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ ifeq ($(strip $(KEYBOARD)), fractal)
RGBLIGHT_ENABLE = yes
RGBLIGHT_STARTUP_ANIMATION = yes
BOOTLOADER = qmk-dfu
CUSTOM_UNICODE_ENABLE = no
endif
1 change: 1 addition & 0 deletions layouts/community/split_3x6_3/drashna/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ifeq ($(strip $(CTPC)), yes)
SWAP_HANDS_ENABLE = yes
WPM_ENABLE = yes
else
CUSTOM_UNICODE_ENABLE = no
BOOTLOADER = qmk-hid
BOOTLOADER_SIZE = 512
endif
4 changes: 2 additions & 2 deletions users/drashna/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
# endif
#endif // !AUDIO_ENABLE

#define UNICODE_SELECTED_MODES UC_WIN, UC_MAC
#define UNICODE_SELECTED_MODES UC_WINC, UC_MAC

#ifdef RGBLIGHT_ENABLE
# define RGBLIGHT_SLEEP
Expand Down Expand Up @@ -200,7 +200,7 @@
# ifdef OLED_FONT_H
# undef OLED_FONT_H
# endif
# define OLED_FONT_H "drashna_font.h"
# define OLED_FONT_H "oled/drashna_font.h"
# define OLED_FONT_END 255
// # define OLED_FONT_5X5
// # define OLED_FONT_AZTECH
Expand Down
10 changes: 9 additions & 1 deletion users/drashna/drashna.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,9 @@ void matrix_init_user(void) {
DDRB &= ~(1 << 0);
PORTB &= ~(1 << 0);
#endif

#ifdef CUSTOM_UNICODE_ENABLE
matrix_init_unicode();
#endif
matrix_init_secret();
matrix_init_keymap();
}
Expand Down Expand Up @@ -152,6 +154,9 @@ void matrix_scan_user(void) {
#if defined(RGB_MATRIX_ENABLE)
matrix_scan_rgb_matrix();
#endif
#if defined(POINTING_DEVICE_ENABLE)
matrix_scan_pointing();
#endif

matrix_scan_secret();

Expand All @@ -171,6 +176,9 @@ layer_state_t layer_state_set_user(layer_state_t state) {
}

state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
#if defined(POINTING_DEVICE_ENABLE)
state = layer_state_set_pointing(state);
#endif
#if defined(RGBLIGHT_ENABLE)
state = layer_state_set_rgb_light(state);
#endif // RGBLIGHT_ENABLE
Expand Down
Loading

0 comments on commit c0bb153

Please sign in to comment.