From 5255eccefeddccfc1b2206b0d86078c906154a1e Mon Sep 17 00:00:00 2001 From: LM Date: Fri, 26 Aug 2022 18:25:46 -0400 Subject: [PATCH 01/12] added edinburgh41 --- keyboards/edinburgh41/config.h | 50 ++++++++++ keyboards/edinburgh41/edinburgh41.c | 16 ++++ keyboards/edinburgh41/edinburgh41.h | 42 ++++++++ keyboards/edinburgh41/info.json | 66 +++++++++++++ .../edinburgh41/keymaps/default/keymap.c | 62 ++++++++++++ keyboards/edinburgh41/keymaps/lalit/keymap.c | 71 ++++++++++++++ keyboards/edinburgh41/readme.md | 27 ++++++ keyboards/edinburgh41/rules.mk | 22 +++++ keyboards/edinburgh41/thumbstick.c | 96 +++++++++++++++++++ 9 files changed, 452 insertions(+) create mode 100644 keyboards/edinburgh41/config.h create mode 100644 keyboards/edinburgh41/edinburgh41.c create mode 100644 keyboards/edinburgh41/edinburgh41.h create mode 100644 keyboards/edinburgh41/info.json create mode 100644 keyboards/edinburgh41/keymaps/default/keymap.c create mode 100644 keyboards/edinburgh41/keymaps/lalit/keymap.c create mode 100644 keyboards/edinburgh41/readme.md create mode 100644 keyboards/edinburgh41/rules.mk create mode 100644 keyboards/edinburgh41/thumbstick.c diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h new file mode 100644 index 000000000000..87a2d17ad6de --- /dev/null +++ b/keyboards/edinburgh41/config.h @@ -0,0 +1,50 @@ +// Copyright 2022 L. Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +// key matrix settings +#define MATRIX_ROWS 7 +#define MATRIX_COLS 6 + +#define MATRIX_ROW_PINS \ + { F4, F5, F6, F7, B1, B3, B2 } +#define MATRIX_COL_PINS \ + { D1, D4, C6, D7, E6, B4 } + +#define DIODE_DIRECTION COL2ROW + +#define DEBOUNCE 5 + +// bootmagic settings + +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +// Underglow LED settings + +#define RGB_DI_PIN D0 +#define RGBLED_NUM 10 +#define RGBLIGHT_SLEEP + +#define RGBLIGHT_DEFAULT_SAT 0 + +// Thumbstick settings + +#define ANALOG_JOYSTICK_X_AXIS_PIN B5 +#define ANALOG_JOYSTICK_Y_AXIS_PIN B6 +#define SCROLLING_LAYER 1 +#define TAPPING_LAYER 2 + +#define THUMBSTICK_RIGHT_TAP KC_RIGHT +#define THUMBSTICK_LEFT_TAP KC_LEFT +#define THUMBSTICK_UP_TAP KC_UP +#define THUMBSTICK_DOWN_TAP KC_DOWN + +#define CURSOR_SPEED 1 +#define SCROLL_SPEED 0.1 + +// tap dance settings +#define TAPPING_TERM 155 \ No newline at end of file diff --git a/keyboards/edinburgh41/edinburgh41.c b/keyboards/edinburgh41/edinburgh41.c new file mode 100644 index 000000000000..28c07d51bb55 --- /dev/null +++ b/keyboards/edinburgh41/edinburgh41.c @@ -0,0 +1,16 @@ +/* Copyright 2022 schwarzer-geiger + * + * 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 . + */ +#include "edinburgh41.h" diff --git a/keyboards/edinburgh41/edinburgh41.h b/keyboards/edinburgh41/edinburgh41.h new file mode 100644 index 000000000000..063ca251e381 --- /dev/null +++ b/keyboards/edinburgh41/edinburgh41.h @@ -0,0 +1,42 @@ +/* Copyright 2020 gtips + * + * 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 . + */ +#pragma once + +#include "quantum.h" + +/* This a shortcut to help you visually see your layout. + * + * The first section contains all of the arguments representing the physical + * layout of the board and position of the keys. + * + * The second converts the arguments into a two-dimensional array which + * represents the switch matrix. + */ +#define LAYOUT_edinburgh41( \ + K00, K01, K02, K03, K04, K05, K30, K31, K32, K33, K34, K35, \ + K10, K11, K12, K13, K14, K15, K40, K41, K42, K43, K44, K45, \ + K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K54, K55, \ + K60, K61, K62, K63, K64 \ +) \ +{ \ + { K00, K01, K02, K03, K04, K05 }, \ + { K10, K11, K12, K13, K14, K15 }, \ + { K20, K21, K22, K23, K24, K25 }, \ + { K30, K31, K32, K33, K34, K35 }, \ + { K40, K41, K42, K43, K44, K45 }, \ + { K50, K51, K52, K53, K54, K55 }, \ + { K60, K61, K62, K63, K64, KC_NO } \ +} diff --git a/keyboards/edinburgh41/info.json b/keyboards/edinburgh41/info.json new file mode 100644 index 000000000000..5f945ba80973 --- /dev/null +++ b/keyboards/edinburgh41/info.json @@ -0,0 +1,66 @@ +{ + "manufacturer": "L. Mistry", + "keyboard_name": "edinburgh41", + "maintainer": "schwarzer-geiger", + "bootloader": "atmel-dfu", + "processor": "atmega32u4", + "url": "", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_edinburgh41": { + "layout": [ + {"label":"K00", "x":0, "y":0.54}, + {"label":"K01", "x":1, "y":0.36}, + {"label":"K02", "x":2, "y":0.18}, + {"label":"K03", "x":3, "y":0}, + {"label":"K04", "x":4, "y":0.18}, + {"label":"K05", "x":5, "y":0.36}, + + {"label":"K30", "x":7, "y":0.36}, + {"label":"K31", "x":8, "y":0.18}, + {"label":"K32", "x":9, "y":0}, + {"label":"K33", "x":10, "y":0.18}, + {"label":"K34", "x":11, "y":0.36}, + {"label":"K35", "x":12, "y":0.54}, + + {"label":"K10", "x":0, "y":1.54}, + {"label":"K11", "x":1, "y":1.36}, + {"label":"K12", "x":2, "y":1.18}, + {"label":"K13", "x":3, "y":1}, + {"label":"K14", "x":4, "y":1.18}, + {"label":"K15", "x":5, "y":1.36}, + + {"label":"K40", "x":7, "y":1.36}, + {"label":"K41", "x":8, "y":1.18}, + {"label":"K42", "x":9, "y":1}, + {"label":"K43", "x":10, "y":1.18}, + {"label":"K44", "x":11, "y":1.36}, + {"label":"K45", "x":12, "y":1.54}, + + {"label":"K20", "x":0, "y":2.54}, + {"label":"K21", "x":1, "y":2.36}, + {"label":"K22", "x":2, "y":2.18}, + {"label":"K23", "x":3, "y":2}, + {"label":"K24", "x":4, "y":2.18}, + {"label":"K25", "x":5, "y":2.36}, + + {"label":"K50", "x":7, "y":2.36}, + {"label":"K51", "x":8, "y":2.18}, + {"label":"K52", "x":9, "y":2}, + {"label":"K53", "x":10, "y":2.18}, + {"label":"K54", "x":11, "y":2.36}, + {"label":"K55", "x":12, "y":2.54}, + + {"label":"K60", "x":2.875, "y":3.54, "w":1.25}, + {"label":"K61", "x":4.125, "y":3.54, "w":1.25}, + {"label":"K62", "x":5.375, "y":3.54, "w":2.25}, + {"label":"K63", "x":7.625, "y":3.54, "w":1.25}, + {"label":"K64", "x":8.875, "y":3.54, "w":1.25} + ] + } + } +} \ No newline at end of file diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c new file mode 100644 index 000000000000..2e1d50c3bbe4 --- /dev/null +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -0,0 +1,62 @@ +/* Copyright 2020 gtips + * + * 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 . + */ +#include QMK_KEYBOARD_H + +enum layer_names { + _BASE, + _LOWER, + _RAISE, + _ADJUST +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT_edinburgh41( + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + KC_LCTL, 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, RSFT_T(KC_ENT), + KC_LALT, LOWER, KC_SPC, RAISE, KC_RGUI + ), + + [_LOWER] = LAYOUT_edinburgh41( + _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, + _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD, + _______, KC_ESC, KC_LGUI, KC_LALT, KC_CAPS, KC_DQUO, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_PSCR, RSFT_T(KC_SPC), + _______, _______, KC_ENT, _______, _______ + ), + + [_RAISE] = LAYOUT_edinburgh41( + _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, + _______, KC_ESC, KC_RGUI, KC_RALT, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, + _______, _______, KC_BSPC, _______, _______ + ), + + [_ADJUST] = LAYOUT_edinburgh41( + RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, XXXXXXX, _______, _______ + ), +}; + +layer_state_t layer_state_set_user(layer_state_t state) { + return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); +} + diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c new file mode 100644 index 000000000000..75bcdb0dcc4e --- /dev/null +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -0,0 +1,71 @@ +/* Copyright 2022 schwarzer-geiger + * + * 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 . + */ +#include QMK_KEYBOARD_H +#include "thumbstick.c" + +enum layer_names { + _BASE, + _LOWER, + _RAISE, + _ADJUST +}; + +#define LOWER MO(_LOWER) +#define RAISE MO(_RAISE) +#define ADJUST MO(_ADJUST) + +enum { + TD_J_QUOTE, + TD_H_DQT, +}; + +// Tap Dance definitions +qk_tap_dance_action_t tap_dance_actions[] = { + // Tap once for J, twice for Semicolon + [TD_J_QUOTE] = ACTION_TAP_DANCE_DOUBLE(KC_J, KC_QUOTE), + // Tap once for K, twice for Colon + [TD_H_DQT] = ACTION_TAP_DANCE_DOUBLE(KC_H, KC_DOUBLE_QUOTE), +}; + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [_BASE] = LAYOUT_edinburgh41( + KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_BSPC, + LT(RAISE, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, TD(TD_H_DQT), TD(TD_J_QUOTE), KC_K, KC_L, KC_MS_BTN1, KC_ENTER, + LGUI(KC_TAB), KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SCLN, + KC_LCTL, KC_LSFT, KC_NO, KC_SPC, LOWER + ), + + [_LOWER] = LAYOUT_edinburgh41( + RGB_TOG, KC_NO, KC_LBRC, KC_RBRC, KC_NO, KC_NO, KC_NO, LGUI(KC_SPC), KC_MINUS, LSFT(KC_EQUAL), KC_NO, KC_DEL, + _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, + _______, KC_NO, LSFT(KC_LBRC), LSFT(KC_RBRC), KC_NO, KC_NO, KC_NO, KC_EQUAL, KC_BSLS, KC_GRAVE, KC_NO, KC_NO, + _______, _______, KC_NO, _______, _______ + ), + + [_RAISE] = LAYOUT_edinburgh41( + _______, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN2, KC_NO, + _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + _______, _______, KC_NO, _______, _______ + ), + + [_ADJUST] = LAYOUT_edinburgh41( + RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, + _______, _______, XXXXXXX, _______, _______ + ), +}; \ No newline at end of file diff --git a/keyboards/edinburgh41/readme.md b/keyboards/edinburgh41/readme.md new file mode 100644 index 000000000000..b810e3887faf --- /dev/null +++ b/keyboards/edinburgh41/readme.md @@ -0,0 +1,27 @@ +# edinburgh41 + +![edinburgh41](imgur.com image replace me!) + +*A short description of the keyboard/project* + +* Keyboard Maintainer: [L. Mistry](https://github.com/schwarzer-geiger) +* Hardware Supported: *The PCBs, controllers supported* +* Hardware Availability: *Links to where you can find this hardware* + +Make example for this keyboard (after setting up your build environment): + + make edinburgh41:default + +Flashing example for this keyboard: + + make edinburgh41:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/edinburgh41/rules.mk b/keyboards/edinburgh41/rules.mk new file mode 100644 index 000000000000..0e0e90f2af62 --- /dev/null +++ b/keyboards/edinburgh41/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +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 +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +TAP_DANCE_ENABLE = yes + +POINTING_DEVICE_ENABLE = yes +POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c new file mode 100644 index 000000000000..9002f4ec1888 --- /dev/null +++ b/keyboards/edinburgh41/thumbstick.c @@ -0,0 +1,96 @@ +// import thumbstick settings from config +#include "config.h" + +bool cursor_mode = false; +bool scrolling_mode = false; +bool tapping_mode = false; + +// tracks if thumbstick was released +bool returned_to_zero = true; + +// tracks how many times mouse_report.x/y have been read zero in succession +int zero_reads = 0; + +// manipulate mouse report based on current mode +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { + if (cursor_mode) { + mouse_report.x = CURSOR_SPEED * mouse_report.x; + mouse_report.y = CURSOR_SPEED * mouse_report.y; + } + if (scrolling_mode) { + mouse_report.h = SCROLL_SPEED * mouse_report.x; + mouse_report.v = SCROLL_SPEED * mouse_report.y; + mouse_report.x = 0; + mouse_report.y = 0; + } else if (tapping_mode) { + if ((mouse_report.x || mouse_report.y) != 0) { + if (returned_to_zero) { + if (mouse_report.x > 0) { + tap_code16(THUMBSTICK_RIGHT_TAP); + } + if (mouse_report.x < 0) { + tap_code16(THUMBSTICK_LEFT_TAP); + } + if (mouse_report.y > 0) { + tap_code16(THUMBSTICK_DOWN_TAP); + } + if (mouse_report.y < 0) { + tap_code16(THUMBSTICK_UP_TAP); + } + returned_to_zero = false; + } + zero_reads = 0; + } else if (zero_reads < 20) { + zero_reads++; + } + if (zero_reads >= 20) { + if (returned_to_zero == false) { + returned_to_zero = true; + } + } + mouse_report.x = 0; + mouse_report.y = 0; + } + + return mouse_report; +} + +// set mode depending on layer +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case SCROLLING_LAYER: + if (scrolling_mode == false) { + scrolling_mode = true; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode) { + cursor_mode = false; + } + break; + case TAPPING_LAYER: + if (tapping_mode == false) { + tapping_mode = true; + } + if (cursor_mode) { + cursor_mode = false; + } + if (scrolling_mode) { + scrolling_mode = false; + } + break; + default: + if (scrolling_mode) { + scrolling_mode = false; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode == false) { + cursor_mode = true; + } + break; + } + return state; +} \ No newline at end of file From 166229a3bff040a98c8710d2e86c6104c4dce67a Mon Sep 17 00:00:00 2001 From: LM Date: Fri, 26 Aug 2022 19:46:00 -0400 Subject: [PATCH 02/12] added readme.md --- keyboards/edinburgh41/config.h | 2 +- keyboards/edinburgh41/keymaps/lalit/config.h | 50 ++++++++++ keyboards/edinburgh41/keymaps/lalit/keymap.c | 52 ++++++++-- keyboards/edinburgh41/keymaps/lalit/rules.mk | 22 +++++ .../edinburgh41/keymaps/lalit/thumbstick.c | 98 +++++++++++++++++++ keyboards/edinburgh41/readme.md | 14 +-- keyboards/edinburgh41/rules.mk | 1 - keyboards/edinburgh41/thumbstick.c | 8 +- 8 files changed, 229 insertions(+), 18 deletions(-) create mode 100644 keyboards/edinburgh41/keymaps/lalit/config.h create mode 100644 keyboards/edinburgh41/keymaps/lalit/rules.mk create mode 100644 keyboards/edinburgh41/keymaps/lalit/thumbstick.c diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index 87a2d17ad6de..c8df3b4b32dc 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -47,4 +47,4 @@ #define SCROLL_SPEED 0.1 // tap dance settings -#define TAPPING_TERM 155 \ No newline at end of file +#define TAPPING_TERM 155 diff --git a/keyboards/edinburgh41/keymaps/lalit/config.h b/keyboards/edinburgh41/keymaps/lalit/config.h new file mode 100644 index 000000000000..c8df3b4b32dc --- /dev/null +++ b/keyboards/edinburgh41/keymaps/lalit/config.h @@ -0,0 +1,50 @@ +// Copyright 2022 L. Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +// key matrix settings +#define MATRIX_ROWS 7 +#define MATRIX_COLS 6 + +#define MATRIX_ROW_PINS \ + { F4, F5, F6, F7, B1, B3, B2 } +#define MATRIX_COL_PINS \ + { D1, D4, C6, D7, E6, B4 } + +#define DIODE_DIRECTION COL2ROW + +#define DEBOUNCE 5 + +// bootmagic settings + +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + +// Underglow LED settings + +#define RGB_DI_PIN D0 +#define RGBLED_NUM 10 +#define RGBLIGHT_SLEEP + +#define RGBLIGHT_DEFAULT_SAT 0 + +// Thumbstick settings + +#define ANALOG_JOYSTICK_X_AXIS_PIN B5 +#define ANALOG_JOYSTICK_Y_AXIS_PIN B6 +#define SCROLLING_LAYER 1 +#define TAPPING_LAYER 2 + +#define THUMBSTICK_RIGHT_TAP KC_RIGHT +#define THUMBSTICK_LEFT_TAP KC_LEFT +#define THUMBSTICK_UP_TAP KC_UP +#define THUMBSTICK_DOWN_TAP KC_DOWN + +#define CURSOR_SPEED 1 +#define SCROLL_SPEED 0.1 + +// tap dance settings +#define TAPPING_TERM 155 diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c index 75bcdb0dcc4e..f803bc28e477 100644 --- a/keyboards/edinburgh41/keymaps/lalit/keymap.c +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -13,6 +13,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + #include QMK_KEYBOARD_H #include "thumbstick.c" @@ -27,6 +28,13 @@ enum layer_names { #define RAISE MO(_RAISE) #define ADJUST MO(_ADJUST) +enum custom_keycodes { + AE_UMLAUT = SAFE_RANGE, + UE_UMLAUT, + OE_UMLAUT, + SS_UMLAUT +}; + enum { TD_J_QUOTE, TD_H_DQT, @@ -47,25 +55,57 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { LGUI(KC_TAB), KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SCLN, KC_LCTL, KC_LSFT, KC_NO, KC_SPC, LOWER ), - + [_LOWER] = LAYOUT_edinburgh41( - RGB_TOG, KC_NO, KC_LBRC, KC_RBRC, KC_NO, KC_NO, KC_NO, LGUI(KC_SPC), KC_MINUS, LSFT(KC_EQUAL), KC_NO, KC_DEL, + RGB_TOG, KC_NO, KC_LBRC, KC_RBRC, KC_NO, KC_NO, KC_NO, LGUI(KC_SPC), KC_MINUS, LSFT(KC_EQUAL), KC_NO, LGUI(LSFT(KC_4)), _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_NO, LSFT(KC_LBRC), LSFT(KC_RBRC), KC_NO, KC_NO, KC_NO, KC_EQUAL, KC_BSLS, KC_GRAVE, KC_NO, KC_NO, _______, _______, KC_NO, _______, _______ ), - + [_RAISE] = LAYOUT_edinburgh41( _______, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_MS_BTN2, KC_NO, + _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, UE_UMLAUT, AE_UMLAUT, OE_UMLAUT, SS_UMLAUT, KC_NO, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, _______, KC_NO, _______, _______ ), - + [_ADJUST] = LAYOUT_edinburgh41( RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, XXXXXXX, _______, _______ ), -}; \ No newline at end of file +}; + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + switch (keycode) { + case AE_UMLAUT: + if (record->event.pressed) { + // when keycode AE_UMLAUT is pressed + SEND_STRING(SS_LALT("u") "a"); + } else { + // when keycode AE_UMLAUT is released + } + break; + case UE_UMLAUT: + if (record->event.pressed) { + SEND_STRING(SS_LALT("u") "u"); + } else { + } + break; + case OE_UMLAUT: + if (record->event.pressed) { + SEND_STRING(SS_LALT("u") "o"); + } else { + } + break; + case SS_UMLAUT: + if (record->event.pressed) { + SEND_STRING(SS_LALT("s")); + } else { + } + break; + } + return true; +}; diff --git a/keyboards/edinburgh41/keymaps/lalit/rules.mk b/keyboards/edinburgh41/keymaps/lalit/rules.mk new file mode 100644 index 000000000000..0e0e90f2af62 --- /dev/null +++ b/keyboards/edinburgh41/keymaps/lalit/rules.mk @@ -0,0 +1,22 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +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 +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +TAP_DANCE_ENABLE = yes + +POINTING_DEVICE_ENABLE = yes +POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/keymaps/lalit/thumbstick.c b/keyboards/edinburgh41/keymaps/lalit/thumbstick.c new file mode 100644 index 000000000000..2bcac021d3df --- /dev/null +++ b/keyboards/edinburgh41/keymaps/lalit/thumbstick.c @@ -0,0 +1,98 @@ +// import thumbstick settings from config +#pragma once + +#include "config.h" + +bool cursor_mode = false; +bool scrolling_mode = false; +bool tapping_mode = false; + +// tracks if thumbstick was released +bool returned_to_zero = true; + +// tracks how many times mouse_report.x/y have been read zero in succession +int zero_reads = 0; + +// manipulate mouse report based on current mode +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { + if (cursor_mode) { + mouse_report.x = CURSOR_SPEED * mouse_report.x; + mouse_report.y = CURSOR_SPEED * mouse_report.y; + } + if (scrolling_mode) { + mouse_report.h = SCROLL_SPEED * mouse_report.x; + mouse_report.v = SCROLL_SPEED * mouse_report.y; + mouse_report.x = 0; + mouse_report.y = 0; + } else if (tapping_mode) { + if ((mouse_report.x || mouse_report.y) != 0) { + if (returned_to_zero) { + if (mouse_report.x > 0) { + tap_code16(THUMBSTICK_RIGHT_TAP); + } + if (mouse_report.x < 0) { + tap_code16(THUMBSTICK_LEFT_TAP); + } + if (mouse_report.y > 0) { + tap_code16(THUMBSTICK_DOWN_TAP); + } + if (mouse_report.y < 0) { + tap_code16(THUMBSTICK_UP_TAP); + } + returned_to_zero = false; + } + zero_reads = 0; + } else if (zero_reads < 20) { + zero_reads++; + } + if (zero_reads >= 20) { + if (returned_to_zero == false) { + returned_to_zero = true; + } + } + mouse_report.x = 0; + mouse_report.y = 0; + } + + return mouse_report; +} + +// set mode depending on layer +layer_state_t layer_state_set_user(layer_state_t state) { + switch (get_highest_layer(state)) { + case SCROLLING_LAYER: + if (scrolling_mode == false) { + scrolling_mode = true; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode) { + cursor_mode = false; + } + break; + case TAPPING_LAYER: + if (tapping_mode == false) { + tapping_mode = true; + } + if (cursor_mode) { + cursor_mode = false; + } + if (scrolling_mode) { + scrolling_mode = false; + } + break; + default: + if (scrolling_mode) { + scrolling_mode = false; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode == false) { + cursor_mode = true; + } + break; + } + return state; +} diff --git a/keyboards/edinburgh41/readme.md b/keyboards/edinburgh41/readme.md index b810e3887faf..3e479cc72bdd 100644 --- a/keyboards/edinburgh41/readme.md +++ b/keyboards/edinburgh41/readme.md @@ -1,12 +1,12 @@ # edinburgh41 -![edinburgh41](imgur.com image replace me!) +![edinburgh41](https://imgur.com/a/zzuyEbS) -*A short description of the keyboard/project* +A small 40% board based on gtip's reviung41. The gasket mounted edinburgh41 features joystick with versatile functionality and rgb underglow. -* Keyboard Maintainer: [L. Mistry](https://github.com/schwarzer-geiger) -* Hardware Supported: *The PCBs, controllers supported* -* Hardware Availability: *Links to where you can find this hardware* +* Keyboard Maintainer: [Lalit Mistry](https://github.com/schwarzer-geiger) +* Hardware Supported: edinburgh41 pcb with pro micro or wired equivalent +* Hardware Availability: Contact me, lalitmistry1407@gmail.com Make example for this keyboard (after setting up your build environment): @@ -22,6 +22,6 @@ See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_to Enter the bootloader in 3 ways: -* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard -* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Bootmagic reset**: Hold down top left key while plugging keyboard into computer +* **Physical reset button**: Short RST and GND pins * **Keycode in layout**: Press the key mapped to `RESET` if it is available diff --git a/keyboards/edinburgh41/rules.mk b/keyboards/edinburgh41/rules.mk index 0e0e90f2af62..048cfcdccaa6 100644 --- a/keyboards/edinburgh41/rules.mk +++ b/keyboards/edinburgh41/rules.mk @@ -16,7 +16,6 @@ NKRO_ENABLE = yes # Enable N-Key Rollover BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output -TAP_DANCE_ENABLE = yes POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c index 9002f4ec1888..2bcac021d3df 100644 --- a/keyboards/edinburgh41/thumbstick.c +++ b/keyboards/edinburgh41/thumbstick.c @@ -1,4 +1,6 @@ // import thumbstick settings from config +#pragma once + #include "config.h" bool cursor_mode = false; @@ -51,7 +53,7 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { mouse_report.x = 0; mouse_report.y = 0; } - + return mouse_report; } @@ -72,7 +74,7 @@ layer_state_t layer_state_set_user(layer_state_t state) { case TAPPING_LAYER: if (tapping_mode == false) { tapping_mode = true; - } + } if (cursor_mode) { cursor_mode = false; } @@ -93,4 +95,4 @@ layer_state_t layer_state_set_user(layer_state_t state) { break; } return state; -} \ No newline at end of file +} From e78ad30b21008fb9817fe78398777342a41099b7 Mon Sep 17 00:00:00 2001 From: LM Date: Fri, 26 Aug 2022 20:02:51 -0400 Subject: [PATCH 03/12] made PR compliant --- keyboards/edinburgh41/edinburgh41.h | 2 +- keyboards/edinburgh41/info.json | 4 ++-- keyboards/edinburgh41/keymaps/default/keymap.c | 8 ++++---- keyboards/edinburgh41/thumbstick.c | 16 ++++++++++++++++ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/keyboards/edinburgh41/edinburgh41.h b/keyboards/edinburgh41/edinburgh41.h index 063ca251e381..a5edffe2ce94 100644 --- a/keyboards/edinburgh41/edinburgh41.h +++ b/keyboards/edinburgh41/edinburgh41.h @@ -1,4 +1,4 @@ -/* Copyright 2020 gtips +/* Copyright 2022 schwarzer-geiger * * 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 diff --git a/keyboards/edinburgh41/info.json b/keyboards/edinburgh41/info.json index 5f945ba80973..a2bbcc618313 100644 --- a/keyboards/edinburgh41/info.json +++ b/keyboards/edinburgh41/info.json @@ -4,7 +4,7 @@ "maintainer": "schwarzer-geiger", "bootloader": "atmel-dfu", "processor": "atmega32u4", - "url": "", + "url": "https://github.com/schwarzer-geiger/Edinburgh41", "usb": { "device_version": "1.0.0", "pid": "0x0000", @@ -63,4 +63,4 @@ ] } } -} \ No newline at end of file +} diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c index 2e1d50c3bbe4..19711fd8d67e 100644 --- a/keyboards/edinburgh41/keymaps/default/keymap.c +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -1,4 +1,4 @@ -/* Copyright 2020 gtips +/* Copyright 2022 schwarzer-geiger * * 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 @@ -33,21 +33,21 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, RSFT_T(KC_ENT), KC_LALT, LOWER, KC_SPC, RAISE, KC_RGUI ), - + [_LOWER] = LAYOUT_edinburgh41( _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD, _______, KC_ESC, KC_LGUI, KC_LALT, KC_CAPS, KC_DQUO, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_PSCR, RSFT_T(KC_SPC), _______, _______, KC_ENT, _______, _______ ), - + [_RAISE] = LAYOUT_edinburgh41( _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_ESC, KC_RGUI, KC_RALT, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_BSPC, _______, _______ ), - + [_ADJUST] = LAYOUT_edinburgh41( RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c index 2bcac021d3df..01a1b5a01fb4 100644 --- a/keyboards/edinburgh41/thumbstick.c +++ b/keyboards/edinburgh41/thumbstick.c @@ -1,3 +1,19 @@ +/* Copyright 2022 schwarzer-geiger + * + * 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 . + */ + // import thumbstick settings from config #pragma once From 36b82305f0a1442366e6f0a202754e7db3dab23a Mon Sep 17 00:00:00 2001 From: LM Date: Fri, 26 Aug 2022 20:09:13 -0400 Subject: [PATCH 04/12] updated image url --- keyboards/edinburgh41/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/edinburgh41/readme.md b/keyboards/edinburgh41/readme.md index 3e479cc72bdd..8139194d9dbb 100644 --- a/keyboards/edinburgh41/readme.md +++ b/keyboards/edinburgh41/readme.md @@ -1,6 +1,6 @@ # edinburgh41 -![edinburgh41](https://imgur.com/a/zzuyEbS) +![edinburgh41](https://imgur.com/a/zzuyEbS.jpg) A small 40% board based on gtip's reviung41. The gasket mounted edinburgh41 features joystick with versatile functionality and rgb underglow. From 30c8eb99b75ee3005128e5303ab98f9098c342ba Mon Sep 17 00:00:00 2001 From: LM Date: Fri, 26 Aug 2022 20:15:11 -0400 Subject: [PATCH 05/12] updated image url --- keyboards/edinburgh41/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/keyboards/edinburgh41/readme.md b/keyboards/edinburgh41/readme.md index 8139194d9dbb..aae198cd4e1c 100644 --- a/keyboards/edinburgh41/readme.md +++ b/keyboards/edinburgh41/readme.md @@ -1,6 +1,6 @@ # edinburgh41 -![edinburgh41](https://imgur.com/a/zzuyEbS.jpg) +![edinburgh41](https://i.imgur.com/Lrjyp6nh.png) A small 40% board based on gtip's reviung41. The gasket mounted edinburgh41 features joystick with versatile functionality and rgb underglow. From 987e5503ae3dcb6df2acedf2f6ae273c5181f4ed Mon Sep 17 00:00:00 2001 From: LM Date: Thu, 22 Sep 2022 19:57:58 -0400 Subject: [PATCH 06/12] fixed PR issues --- keyboards/edinburgh41/config.h | 23 ----- keyboards/edinburgh41/keymaps/lalit/config.h | 18 ---- .../edinburgh41/keymaps/lalit/thumbstick.c | 98 ------------------- keyboards/edinburgh41/post_config.h | 40 ++++++++ keyboards/edinburgh41/thumbstick.c | 8 +- 5 files changed, 44 insertions(+), 143 deletions(-) delete mode 100644 keyboards/edinburgh41/keymaps/lalit/thumbstick.c create mode 100644 keyboards/edinburgh41/post_config.h diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index c8df3b4b32dc..c3d1d0623114 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -18,33 +18,10 @@ #define DEBOUNCE 5 -// bootmagic settings - -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 - // Underglow LED settings #define RGB_DI_PIN D0 -#define RGBLED_NUM 10 -#define RGBLIGHT_SLEEP - -#define RGBLIGHT_DEFAULT_SAT 0 // Thumbstick settings - #define ANALOG_JOYSTICK_X_AXIS_PIN B5 #define ANALOG_JOYSTICK_Y_AXIS_PIN B6 -#define SCROLLING_LAYER 1 -#define TAPPING_LAYER 2 - -#define THUMBSTICK_RIGHT_TAP KC_RIGHT -#define THUMBSTICK_LEFT_TAP KC_LEFT -#define THUMBSTICK_UP_TAP KC_UP -#define THUMBSTICK_DOWN_TAP KC_DOWN - -#define CURSOR_SPEED 1 -#define SCROLL_SPEED 0.1 - -// tap dance settings -#define TAPPING_TERM 155 diff --git a/keyboards/edinburgh41/keymaps/lalit/config.h b/keyboards/edinburgh41/keymaps/lalit/config.h index c8df3b4b32dc..bc4a114704b3 100644 --- a/keyboards/edinburgh41/keymaps/lalit/config.h +++ b/keyboards/edinburgh41/keymaps/lalit/config.h @@ -3,21 +3,6 @@ #pragma once -#include "config_common.h" - -// key matrix settings -#define MATRIX_ROWS 7 -#define MATRIX_COLS 6 - -#define MATRIX_ROW_PINS \ - { F4, F5, F6, F7, B1, B3, B2 } -#define MATRIX_COL_PINS \ - { D1, D4, C6, D7, E6, B4 } - -#define DIODE_DIRECTION COL2ROW - -#define DEBOUNCE 5 - // bootmagic settings #define BOOTMAGIC_LITE_ROW 0 @@ -25,12 +10,9 @@ // Underglow LED settings -#define RGB_DI_PIN D0 #define RGBLED_NUM 10 #define RGBLIGHT_SLEEP -#define RGBLIGHT_DEFAULT_SAT 0 - // Thumbstick settings #define ANALOG_JOYSTICK_X_AXIS_PIN B5 diff --git a/keyboards/edinburgh41/keymaps/lalit/thumbstick.c b/keyboards/edinburgh41/keymaps/lalit/thumbstick.c deleted file mode 100644 index 2bcac021d3df..000000000000 --- a/keyboards/edinburgh41/keymaps/lalit/thumbstick.c +++ /dev/null @@ -1,98 +0,0 @@ -// import thumbstick settings from config -#pragma once - -#include "config.h" - -bool cursor_mode = false; -bool scrolling_mode = false; -bool tapping_mode = false; - -// tracks if thumbstick was released -bool returned_to_zero = true; - -// tracks how many times mouse_report.x/y have been read zero in succession -int zero_reads = 0; - -// manipulate mouse report based on current mode -report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { - if (cursor_mode) { - mouse_report.x = CURSOR_SPEED * mouse_report.x; - mouse_report.y = CURSOR_SPEED * mouse_report.y; - } - if (scrolling_mode) { - mouse_report.h = SCROLL_SPEED * mouse_report.x; - mouse_report.v = SCROLL_SPEED * mouse_report.y; - mouse_report.x = 0; - mouse_report.y = 0; - } else if (tapping_mode) { - if ((mouse_report.x || mouse_report.y) != 0) { - if (returned_to_zero) { - if (mouse_report.x > 0) { - tap_code16(THUMBSTICK_RIGHT_TAP); - } - if (mouse_report.x < 0) { - tap_code16(THUMBSTICK_LEFT_TAP); - } - if (mouse_report.y > 0) { - tap_code16(THUMBSTICK_DOWN_TAP); - } - if (mouse_report.y < 0) { - tap_code16(THUMBSTICK_UP_TAP); - } - returned_to_zero = false; - } - zero_reads = 0; - } else if (zero_reads < 20) { - zero_reads++; - } - if (zero_reads >= 20) { - if (returned_to_zero == false) { - returned_to_zero = true; - } - } - mouse_report.x = 0; - mouse_report.y = 0; - } - - return mouse_report; -} - -// set mode depending on layer -layer_state_t layer_state_set_user(layer_state_t state) { - switch (get_highest_layer(state)) { - case SCROLLING_LAYER: - if (scrolling_mode == false) { - scrolling_mode = true; - } - if (tapping_mode) { - tapping_mode = false; - } - if (cursor_mode) { - cursor_mode = false; - } - break; - case TAPPING_LAYER: - if (tapping_mode == false) { - tapping_mode = true; - } - if (cursor_mode) { - cursor_mode = false; - } - if (scrolling_mode) { - scrolling_mode = false; - } - break; - default: - if (scrolling_mode) { - scrolling_mode = false; - } - if (tapping_mode) { - tapping_mode = false; - } - if (cursor_mode == false) { - cursor_mode = true; - } - break; - } - return state; -} diff --git a/keyboards/edinburgh41/post_config.h b/keyboards/edinburgh41/post_config.h new file mode 100644 index 000000000000..e4b8bc3731a1 --- /dev/null +++ b/keyboards/edinburgh41/post_config.h @@ -0,0 +1,40 @@ +// Copyright 2022 L. Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + + +// default settings + +#ifndef RGBLED_NUM + #define RGBLED_NUM 10 +#endif +#ifndef RGBLIGHT_DEFAULT_SAT + #define RGBLIGHT_DEFAULT_SAT 0 +#endif + + +// Thumbstick default settings + +#ifndef SCROLLING_LAYER + #define SCROLLING_LAYER 1 +#endif +#ifndef TAPPING_LAYER + #define TAPPING_LAYER 2 +#endif +#ifndef THUMBSTICK_RIGHT_TAP + #define THUMBSTICK_RIGHT_TAP KC_RIGHT +#endif +#ifndef THUMBSTICK_LEFT_TAP + #define THUMBSTICK_LEFT_TAP KC_LEFT +#endif +#ifndef THUMBSTICK_UP_TAP + #define THUMBSTICK_UP_TAP KC_UP +#endif +#ifndef THUMBSTICK_DOWN_TAP + #define THUMBSTICK_DOWN_TAP KC_DOWN +#endif +#ifndef CURSOR_SPEED + #define CURSOR_SPEED 1 +#endif +#ifndef SCROLL_SPEED + #define SCROLL_SPEED 0.1 +#endif diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c index 01a1b5a01fb4..862b2f4084c1 100644 --- a/keyboards/edinburgh41/thumbstick.c +++ b/keyboards/edinburgh41/thumbstick.c @@ -17,7 +17,7 @@ // import thumbstick settings from config #pragma once -#include "config.h" +#include "edinburgh41.h" bool cursor_mode = false; bool scrolling_mode = false; @@ -27,10 +27,10 @@ bool tapping_mode = false; bool returned_to_zero = true; // tracks how many times mouse_report.x/y have been read zero in succession -int zero_reads = 0; +uint16_t zero_reads = 0; // manipulate mouse report based on current mode -report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { +report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { if (cursor_mode) { mouse_report.x = CURSOR_SPEED * mouse_report.x; mouse_report.y = CURSOR_SPEED * mouse_report.y; @@ -74,7 +74,7 @@ report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { } // set mode depending on layer -layer_state_t layer_state_set_user(layer_state_t state) { +layer_state_t layer_state_set_kb(layer_state_t state) { switch (get_highest_layer(state)) { case SCROLLING_LAYER: if (scrolling_mode == false) { From 19862e78a5c7dfc4bf4ee084e1195497b48427ba Mon Sep 17 00:00:00 2001 From: LM Date: Sun, 27 Nov 2022 22:19:34 -0500 Subject: [PATCH 07/12] Updated import structure --- keyboards/edinburgh41/keymaps/lalit/keymap.c | 5 +- keyboards/edinburgh41/keymaps/lalit/rules.mk | 1 + keyboards/edinburgh41/rules.mk | 1 + keyboards/edinburgh41/thumbstick.c | 6 +-- keyboards/jakob33/config.h | 27 ++++++++++ keyboards/jakob33/info.json | 55 ++++++++++++++++++++ keyboards/jakob33/jakob33.c | 4 ++ keyboards/jakob33/jakob33.h | 19 +++++++ keyboards/jakob33/keymaps/default/keymap.c | 27 ++++++++++ keyboards/jakob33/readme.md | 27 ++++++++++ keyboards/jakob33/rules.mk | 12 +++++ 11 files changed, 178 insertions(+), 6 deletions(-) create mode 100644 keyboards/jakob33/config.h create mode 100644 keyboards/jakob33/info.json create mode 100644 keyboards/jakob33/jakob33.c create mode 100644 keyboards/jakob33/jakob33.h create mode 100644 keyboards/jakob33/keymaps/default/keymap.c create mode 100644 keyboards/jakob33/readme.md create mode 100644 keyboards/jakob33/rules.mk diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c index f803bc28e477..8de81b71046f 100644 --- a/keyboards/edinburgh41/keymaps/lalit/keymap.c +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -15,7 +15,6 @@ */ #include QMK_KEYBOARD_H -#include "thumbstick.c" enum layer_names { _BASE, @@ -64,8 +63,8 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), [_RAISE] = LAYOUT_edinburgh41( - _______, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, - _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, UE_UMLAUT, AE_UMLAUT, OE_UMLAUT, SS_UMLAUT, KC_NO, + _______, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, + _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, UE_UMLAUT, OE_UMLAUT, AE_UMLAUT, SS_UMLAUT, KC_NO, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, _______, KC_NO, _______, _______ ), diff --git a/keyboards/edinburgh41/keymaps/lalit/rules.mk b/keyboards/edinburgh41/keymaps/lalit/rules.mk index 0e0e90f2af62..4f6564cf4b6c 100644 --- a/keyboards/edinburgh41/keymaps/lalit/rules.mk +++ b/keyboards/edinburgh41/keymaps/lalit/rules.mk @@ -18,5 +18,6 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output TAP_DANCE_ENABLE = yes +SRC += thumbstick.c POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/rules.mk b/keyboards/edinburgh41/rules.mk index 048cfcdccaa6..413b1efa6519 100644 --- a/keyboards/edinburgh41/rules.mk +++ b/keyboards/edinburgh41/rules.mk @@ -17,5 +17,6 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output +SRC += thumbstick.c POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c index 862b2f4084c1..a6409d583bcd 100644 --- a/keyboards/edinburgh41/thumbstick.c +++ b/keyboards/edinburgh41/thumbstick.c @@ -15,9 +15,9 @@ */ // import thumbstick settings from config -#pragma once - -#include "edinburgh41.h" +#include QMK_KEYBOARD_H +#include "config.h" +#include "post_config.h" bool cursor_mode = false; bool scrolling_mode = false; diff --git a/keyboards/jakob33/config.h b/keyboards/jakob33/config.h new file mode 100644 index 000000000000..e3cde4a19d57 --- /dev/null +++ b/keyboards/jakob33/config.h @@ -0,0 +1,27 @@ +// Copyright 2022 Lalit Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#pragma once + +#include "config_common.h" + +// key matrix settings +#define MATRIX_ROWS 5 +#define MATRIX_COLS 7 + +#define MATRIX_ROW_PINS \ + { B6, B2, B3, B1, F7 } +#define MATRIX_COL_PINS \ + { D4, C6, D2, E6, B4, B5, F6 } + +#define DIODE_DIRECTION COL2ROW + +#define DEBOUNCE 5 + +#define ENCODERS_PAD_A { F5 } +#define ENCODERS_PAD_B { F4 } + +// Underglow LED settings + +#define RGB_DI_PIN D7 +#define RGBLED_NUM 9 diff --git a/keyboards/jakob33/info.json b/keyboards/jakob33/info.json new file mode 100644 index 000000000000..4f1798193b63 --- /dev/null +++ b/keyboards/jakob33/info.json @@ -0,0 +1,55 @@ +{ + "manufacturer": "Lalit Mistry", + "keyboard_name": "jakob33", + "maintainer": "schwarzer-geiger", + "url": "", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "layouts": { + "LAYOUT_jakob33": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 3, "y": 0}, + + {"x": 0, "y": 1}, + {"x": 1, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1}, + {"x": 4, "y": 1}, + {"x": 5, "y": 1}, + {"x": 6, "y": 1}, + + {"x": 0, "y": 2, "w": 1.5}, + {"x": 1.5, "y": 2}, + {"x": 2.5, "y": 2}, + {"x": 3.5, "y": 2}, + {"x": 4.5, "y": 2}, + {"x": 5.5, "y": 2}, + + {"x": 0, "y": 3, "w": 1.75}, + {"x": 1.75, "y": 3}, + {"x": 2.75, "y": 3}, + {"x": 3.75, "y": 3}, + {"x": 4.75, "y": 3}, + {"x": 5.75, "y": 3}, + + {"x": 0, "y": 4, "w": 1.25}, + {"x": 1.25, "y": 4}, + {"x": 2.25, "y": 4}, + {"x": 3.25, "y": 4}, + {"x": 4.25, "y": 4}, + {"x": 5.25, "y": 4}, + {"x": 6.25, "y": 4}, + + {"x": 0, "y": 5, "w": 1.25}, + {"x": 1.25, "y": 5, "w": 1.25}, + {"x": 2.5, "y": 5, "w": 1.25}, + {"x": 3.75, "y": 5, "w": 1.25}, + {"x": 5, "y": 5, "w": 2.25} + ] + } + } +} diff --git a/keyboards/jakob33/jakob33.c b/keyboards/jakob33/jakob33.c new file mode 100644 index 000000000000..22a36811a950 --- /dev/null +++ b/keyboards/jakob33/jakob33.c @@ -0,0 +1,4 @@ +// Copyright 2022 Lalit Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "jakob33.h" diff --git a/keyboards/jakob33/jakob33.h b/keyboards/jakob33/jakob33.h new file mode 100644 index 000000000000..6999b2c4c321 --- /dev/null +++ b/keyboards/jakob33/jakob33.h @@ -0,0 +1,19 @@ +// Copyright 2022 Lalit Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include "quantum.h" + +#define LAYOUT_jakob33( \ + k16, k26, \ + k00, k01, k02, k03, k04, k05, k06, \ + k10, k11, k12, k13, k14, k15, \ + k20, k21, k22, k23, k24, k25, \ + k30, k31, k32, k33, k34, k35, k36, \ + k40, k41, k42, k43, k44 \ +) { \ + { k00, k01, k02, k03, k04, k05, k06 }, \ + { k10, k11, k12, k13, k14, k15, k16 }, \ + { k20, k21, k22, k23, k24, k25, k26 }, \ + { k30, k31, k32, k33, k34, k35, k36 }, \ + { k40, k41, k42, k43, k44, KC_NO, KC_NO } \ +} diff --git a/keyboards/jakob33/keymaps/default/keymap.c b/keyboards/jakob33/keymaps/default/keymap.c new file mode 100644 index 000000000000..30933116ff25 --- /dev/null +++ b/keyboards/jakob33/keymaps/default/keymap.c @@ -0,0 +1,27 @@ +// Copyright 2022 Lalit Mistry (@schwarzer-geiger) +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_jakob33( + KC_ESC, KC_NO, + KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, + KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, + KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, + KC_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_Z, + KC_B, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC + ) +}; + +bool encoder_update_user(uint8_t index, bool clockwise) { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + return false; +} + + + diff --git a/keyboards/jakob33/readme.md b/keyboards/jakob33/readme.md new file mode 100644 index 000000000000..e1d5e18b9444 --- /dev/null +++ b/keyboards/jakob33/readme.md @@ -0,0 +1,27 @@ +# jakob33 + +![jakob33](imgur.com image replace me!) + +*A short description of the keyboard/project* + +* Keyboard Maintainer: [Lalit Mistry](https://github.com/schwarzer-geiger) +* Hardware Supported: *The PCBs, controllers supported* +* Hardware Availability: *Links to where you can find this hardware* + +Make example for this keyboard (after setting up your build environment): + + make jakob33:default + +Flashing example for this keyboard: + + make jakob33:default:flash + +See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). + +## Bootloader + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard +* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/jakob33/rules.mk b/keyboards/jakob33/rules.mk new file mode 100644 index 000000000000..d8e5fc57033e --- /dev/null +++ b/keyboards/jakob33/rules.mk @@ -0,0 +1,12 @@ +# MCU name +MCU = atmega32u4 + +# Bootloader selection +BOOTLOADER = caterina + +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +ENCODER_ENABLE = yes From 4df7083348be5c458f6dfcb4f8d29ae3afeb46a8 Mon Sep 17 00:00:00 2001 From: LM Date: Mon, 26 Dec 2022 22:04:10 +0100 Subject: [PATCH 08/12] Changed keyboard/keymap level definitions --- keyboards/edinburgh41/config.h | 36 ++++++ .../edinburgh41/keymaps/default/keymap.c | 101 +++++++++++++++ keyboards/edinburgh41/keymaps/lalit/config.h | 20 +-- keyboards/edinburgh41/keymaps/lalit/keymap.c | 118 +++++++++++++++++- keyboards/edinburgh41/keymaps/lalit/rules.mk | 3 +- keyboards/edinburgh41/post_config.h | 40 ------ keyboards/edinburgh41/rules.mk | 1 - keyboards/edinburgh41/thumbstick.c | 114 ----------------- 8 files changed, 266 insertions(+), 167 deletions(-) delete mode 100644 keyboards/edinburgh41/post_config.h delete mode 100644 keyboards/edinburgh41/thumbstick.c diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index c3d1d0623114..9435f97e9845 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -18,10 +18,46 @@ #define DEBOUNCE 5 +// bootmagic settings + +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 + // Underglow LED settings #define RGB_DI_PIN D0 +#define RGBLED_NUM 10 // Thumbstick settings #define ANALOG_JOYSTICK_X_AXIS_PIN B5 #define ANALOG_JOYSTICK_Y_AXIS_PIN B6 + +// Thumbstick defaults + +#ifndef SCROLLING_LAYER + #define SCROLLING_LAYER 1 +#endif +#ifndef TAPPING_LAYER + #define TAPPING_LAYER 2 +#endif +#ifndef THUMBSTICK_RIGHT_TAP + #define THUMBSTICK_RIGHT_TAP KC_RIGHT +#endif +#ifndef THUMBSTICK_LEFT_TAP + #define THUMBSTICK_LEFT_TAP KC_LEFT +#endif +#ifndef THUMBSTICK_UP_TAP + #define THUMBSTICK_UP_TAP KC_UP +#endif +#ifndef THUMBSTICK_DOWN_TAP + #define THUMBSTICK_DOWN_TAP KC_DOWN +#endif +#ifndef CURSOR_SPEED + #define CURSOR_SPEED 1 +#endif +#ifndef SCROLL_SPEED + #define SCROLL_SPEED 0.1 +#endif +#ifndef SCROLL_DELAY_MS + #define SCROLL_DELAY_MS 70 +#endif diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c index 19711fd8d67e..b7bed5b9baba 100644 --- a/keyboards/edinburgh41/keymaps/default/keymap.c +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -60,3 +60,104 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } +// Thumbstick code + +bool cursor_mode = false; +bool scrolling_mode = false; +bool tapping_mode = false; + +// tracks if thumbstick was released +bool returned_to_zero = true; + +// tracks how many times mouse_report.x/y have been read zero in succession +uint16_t zero_reads = 0; + +// set mode depending on layer +layer_state_t layer_state_set_kb(layer_state_t state) { + switch (get_highest_layer(state)) { + case SCROLLING_LAYER: + if (scrolling_mode == false) { + scrolling_mode = true; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode) { + cursor_mode = false; + } + break; + case TAPPING_LAYER: + if (tapping_mode == false) { + tapping_mode = true; + } + if (cursor_mode) { + cursor_mode = false; + } + if (scrolling_mode) { + scrolling_mode = false; + } + break; + default: + if (scrolling_mode) { + scrolling_mode = false; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode == false) { + cursor_mode = true; + } + break; + } + return state; +} + +// manipulate mouse report based on current mode +report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { + + if (cursor_mode) { + mouse_report.x = CURSOR_SPEED * mouse_report.x/100; + mouse_report.y = CURSOR_SPEED * mouse_report.y/100; + } + if (scrolling_mode) { + mouse_report.h = SCROLL_SPEED * mouse_report.x/100; + mouse_report.v = SCROLL_SPEED * mouse_report.y/100; + mouse_report.x = 0; + mouse_report.y = 0; + if ((mouse_report.h != 0) | (mouse_report.v != 0)) { + _delay_ms(SCROLL_DELAY_MS); + } + + } else if (tapping_mode) { + if ((mouse_report.x || mouse_report.y) != 0) { + if (returned_to_zero) { + if (mouse_report.x > 0) { + tap_code16(THUMBSTICK_RIGHT_TAP); + } + if (mouse_report.x < 0) { + tap_code16(THUMBSTICK_LEFT_TAP); + } + if (mouse_report.y > 0) { + tap_code16(THUMBSTICK_DOWN_TAP); + } + if (mouse_report.y < 0) { + tap_code16(THUMBSTICK_UP_TAP); + } + returned_to_zero = false; + } + zero_reads = 0; + } else if (zero_reads < 20) { + zero_reads++; + } + if (zero_reads >= 20) { + if (returned_to_zero == false) { + returned_to_zero = true; + } + } + mouse_report.x = 0; + mouse_report.y = 0; + } + + return mouse_report; +} + diff --git a/keyboards/edinburgh41/keymaps/lalit/config.h b/keyboards/edinburgh41/keymaps/lalit/config.h index bc4a114704b3..515a68a0fa06 100644 --- a/keyboards/edinburgh41/keymaps/lalit/config.h +++ b/keyboards/edinburgh41/keymaps/lalit/config.h @@ -3,20 +3,12 @@ #pragma once -// bootmagic settings - -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 - // Underglow LED settings -#define RGBLED_NUM 10 #define RGBLIGHT_SLEEP // Thumbstick settings -#define ANALOG_JOYSTICK_X_AXIS_PIN B5 -#define ANALOG_JOYSTICK_Y_AXIS_PIN B6 #define SCROLLING_LAYER 1 #define TAPPING_LAYER 2 @@ -25,6 +17,18 @@ #define THUMBSTICK_UP_TAP KC_UP #define THUMBSTICK_DOWN_TAP KC_DOWN +#define CURSOR_SPEED 90 +#define SCROLL_SPEED 20 +#define SCROLL_DELAY_MS 70 + +// Thumbstick settings + +#define SCROLLING_LAYER 1 +#define TAPPING_LAYER 2 +// #define THUMBSTICK_RIGHT_TAP KC_RIGHT +// #define THUMBSTICK_LEFT_TAP KC_LEFT +// #define THUMBSTICK_UP_TAP KC_UP +// #define THUMBSTICK_DOWN_TAP KC_DOWN #define CURSOR_SPEED 1 #define SCROLL_SPEED 0.1 diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c index 8de81b71046f..93db0c39f3b4 100644 --- a/keyboards/edinburgh41/keymaps/lalit/keymap.c +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -31,7 +31,11 @@ enum custom_keycodes { AE_UMLAUT = SAFE_RANGE, UE_UMLAUT, OE_UMLAUT, - SS_UMLAUT + SS_UMLAUT, + THUMBSTICK_RIGHT_TAP, + THUMBSTICK_LEFT_TAP, + THUMBSTICK_UP_TAP, + THUMBSTICK_DOWN_TAP }; enum { @@ -77,7 +81,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -bool process_record_user(uint16_t keycode, keyrecord_t *record) { +// German Umlaute macro + +bool process_record_user(uint16_t keycode, keyrecord_t* record) { switch (keycode) { case AE_UMLAUT: if (record->event.pressed) { @@ -108,3 +114,111 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } return true; }; + +// Thumbstick keymap + +THUMBSTICK_RIGHT_TAP = KC_RIGHT; +THUMBSTICK_LEFT_TAP = KC_LEFT; +THUMBSTICK_UP_TAP = KC_UP; +THUMBSTICK_DOWN_TAP = KC_DOWN; + +// Thumbstick code + +bool cursor_mode = false; +bool scrolling_mode = false; +bool tapping_mode = false; + +// tracks if thumbstick was released +bool returned_to_zero = true; + +// tracks how many times mouse_report.x/y have been read zero in succession +uint16_t zero_reads = 0; + +// set mode depending on layer +layer_state_t layer_state_set_kb(layer_state_t state) { + switch (get_highest_layer(state)) { + case SCROLLING_LAYER: + if (scrolling_mode == false) { + scrolling_mode = true; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode) { + cursor_mode = false; + } + break; + case TAPPING_LAYER: + if (tapping_mode == false) { + tapping_mode = true; + } + if (cursor_mode) { + cursor_mode = false; + } + if (scrolling_mode) { + scrolling_mode = false; + } + break; + default: + if (scrolling_mode) { + scrolling_mode = false; + } + if (tapping_mode) { + tapping_mode = false; + } + if (cursor_mode == false) { + cursor_mode = true; + } + break; + } + return state; +} + +// manipulate mouse report based on current mode +report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { + + if (cursor_mode) { + mouse_report.x = CURSOR_SPEED * mouse_report.x/100; + mouse_report.y = CURSOR_SPEED * mouse_report.y/100; + } + if (scrolling_mode) { + mouse_report.h = SCROLL_SPEED * mouse_report.x/100; + mouse_report.v = SCROLL_SPEED * mouse_report.y/100; + mouse_report.x = 0; + mouse_report.y = 0; + if ((mouse_report.h != 0) | (mouse_report.v != 0)) { + _delay_ms(SCROLL_DELAY_MS); + } + + } else if (tapping_mode) { + if ((mouse_report.x || mouse_report.y) != 0) { + if (returned_to_zero) { + if (mouse_report.x > 0) { + tap_code16(THUMBSTICK_RIGHT_TAP); + } + if (mouse_report.x < 0) { + tap_code16(THUMBSTICK_LEFT_TAP); + } + if (mouse_report.y > 0) { + tap_code16(THUMBSTICK_DOWN_TAP); + } + if (mouse_report.y < 0) { + tap_code16(THUMBSTICK_UP_TAP); + } + returned_to_zero = false; + } + zero_reads = 0; + } else if (zero_reads < 20) { + zero_reads++; + } + if (zero_reads >= 20) { + if (returned_to_zero == false) { + returned_to_zero = true; + } + } + mouse_report.x = 0; + mouse_report.y = 0; + } + + return mouse_report; +} diff --git a/keyboards/edinburgh41/keymaps/lalit/rules.mk b/keyboards/edinburgh41/keymaps/lalit/rules.mk index 4f6564cf4b6c..38a1c1b40a50 100644 --- a/keyboards/edinburgh41/keymaps/lalit/rules.mk +++ b/keyboards/edinburgh41/keymaps/lalit/rules.mk @@ -10,7 +10,7 @@ BOOTLOADER = caterina 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 +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 @@ -18,6 +18,5 @@ RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output TAP_DANCE_ENABLE = yes -SRC += thumbstick.c POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/post_config.h b/keyboards/edinburgh41/post_config.h deleted file mode 100644 index e4b8bc3731a1..000000000000 --- a/keyboards/edinburgh41/post_config.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2022 L. Mistry (@schwarzer-geiger) -// SPDX-License-Identifier: GPL-2.0-or-later - - -// default settings - -#ifndef RGBLED_NUM - #define RGBLED_NUM 10 -#endif -#ifndef RGBLIGHT_DEFAULT_SAT - #define RGBLIGHT_DEFAULT_SAT 0 -#endif - - -// Thumbstick default settings - -#ifndef SCROLLING_LAYER - #define SCROLLING_LAYER 1 -#endif -#ifndef TAPPING_LAYER - #define TAPPING_LAYER 2 -#endif -#ifndef THUMBSTICK_RIGHT_TAP - #define THUMBSTICK_RIGHT_TAP KC_RIGHT -#endif -#ifndef THUMBSTICK_LEFT_TAP - #define THUMBSTICK_LEFT_TAP KC_LEFT -#endif -#ifndef THUMBSTICK_UP_TAP - #define THUMBSTICK_UP_TAP KC_UP -#endif -#ifndef THUMBSTICK_DOWN_TAP - #define THUMBSTICK_DOWN_TAP KC_DOWN -#endif -#ifndef CURSOR_SPEED - #define CURSOR_SPEED 1 -#endif -#ifndef SCROLL_SPEED - #define SCROLL_SPEED 0.1 -#endif diff --git a/keyboards/edinburgh41/rules.mk b/keyboards/edinburgh41/rules.mk index 413b1efa6519..048cfcdccaa6 100644 --- a/keyboards/edinburgh41/rules.mk +++ b/keyboards/edinburgh41/rules.mk @@ -17,6 +17,5 @@ BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow AUDIO_ENABLE = no # Audio output -SRC += thumbstick.c POINTING_DEVICE_ENABLE = yes POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/thumbstick.c b/keyboards/edinburgh41/thumbstick.c deleted file mode 100644 index a6409d583bcd..000000000000 --- a/keyboards/edinburgh41/thumbstick.c +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2022 schwarzer-geiger - * - * 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 . - */ - -// import thumbstick settings from config -#include QMK_KEYBOARD_H -#include "config.h" -#include "post_config.h" - -bool cursor_mode = false; -bool scrolling_mode = false; -bool tapping_mode = false; - -// tracks if thumbstick was released -bool returned_to_zero = true; - -// tracks how many times mouse_report.x/y have been read zero in succession -uint16_t zero_reads = 0; - -// manipulate mouse report based on current mode -report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { - if (cursor_mode) { - mouse_report.x = CURSOR_SPEED * mouse_report.x; - mouse_report.y = CURSOR_SPEED * mouse_report.y; - } - if (scrolling_mode) { - mouse_report.h = SCROLL_SPEED * mouse_report.x; - mouse_report.v = SCROLL_SPEED * mouse_report.y; - mouse_report.x = 0; - mouse_report.y = 0; - } else if (tapping_mode) { - if ((mouse_report.x || mouse_report.y) != 0) { - if (returned_to_zero) { - if (mouse_report.x > 0) { - tap_code16(THUMBSTICK_RIGHT_TAP); - } - if (mouse_report.x < 0) { - tap_code16(THUMBSTICK_LEFT_TAP); - } - if (mouse_report.y > 0) { - tap_code16(THUMBSTICK_DOWN_TAP); - } - if (mouse_report.y < 0) { - tap_code16(THUMBSTICK_UP_TAP); - } - returned_to_zero = false; - } - zero_reads = 0; - } else if (zero_reads < 20) { - zero_reads++; - } - if (zero_reads >= 20) { - if (returned_to_zero == false) { - returned_to_zero = true; - } - } - mouse_report.x = 0; - mouse_report.y = 0; - } - - return mouse_report; -} - -// set mode depending on layer -layer_state_t layer_state_set_kb(layer_state_t state) { - switch (get_highest_layer(state)) { - case SCROLLING_LAYER: - if (scrolling_mode == false) { - scrolling_mode = true; - } - if (tapping_mode) { - tapping_mode = false; - } - if (cursor_mode) { - cursor_mode = false; - } - break; - case TAPPING_LAYER: - if (tapping_mode == false) { - tapping_mode = true; - } - if (cursor_mode) { - cursor_mode = false; - } - if (scrolling_mode) { - scrolling_mode = false; - } - break; - default: - if (scrolling_mode) { - scrolling_mode = false; - } - if (tapping_mode) { - tapping_mode = false; - } - if (cursor_mode == false) { - cursor_mode = true; - } - break; - } - return state; -} From 6503b162e63e05804409337915679cb7b2a71118 Mon Sep 17 00:00:00 2001 From: LM Date: Tue, 27 Dec 2022 20:50:42 +0100 Subject: [PATCH 09/12] Tidied up and sorted out #defines --- keyboards/edinburgh41/config.h | 16 ++----------- .../edinburgh41/keymaps/default/keymap.c | 12 +++++++--- keyboards/edinburgh41/keymaps/lalit/config.h | 23 +++---------------- keyboards/edinburgh41/keymaps/lalit/keymap.c | 20 +++++++--------- 4 files changed, 22 insertions(+), 49 deletions(-) diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index 9435f97e9845..fcd58107bb9e 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -40,23 +40,11 @@ #ifndef TAPPING_LAYER #define TAPPING_LAYER 2 #endif -#ifndef THUMBSTICK_RIGHT_TAP - #define THUMBSTICK_RIGHT_TAP KC_RIGHT -#endif -#ifndef THUMBSTICK_LEFT_TAP - #define THUMBSTICK_LEFT_TAP KC_LEFT -#endif -#ifndef THUMBSTICK_UP_TAP - #define THUMBSTICK_UP_TAP KC_UP -#endif -#ifndef THUMBSTICK_DOWN_TAP - #define THUMBSTICK_DOWN_TAP KC_DOWN -#endif #ifndef CURSOR_SPEED - #define CURSOR_SPEED 1 + #define CURSOR_SPEED 70 #endif #ifndef SCROLL_SPEED - #define SCROLL_SPEED 0.1 + #define SCROLL_SPEED 25 #endif #ifndef SCROLL_DELAY_MS #define SCROLL_DELAY_MS 70 diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c index b7bed5b9baba..6346dcdaa9c4 100644 --- a/keyboards/edinburgh41/keymaps/default/keymap.c +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -60,7 +60,14 @@ layer_state_t layer_state_set_user(layer_state_t state) { return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); } -// Thumbstick code +// Thumbstick keymap, change KC_XXX to whatever you need + +#define THUMBSTICK_RIGHT_TAP KC_RIGHT +#define THUMBSTICK_LEFT_TAP KC_LEFT +#define THUMBSTICK_UP_TAP KC_UP +#define THUMBSTICK_DOWN_TAP KC_DOWN + +// Thumbstick code, no customisation needed bool cursor_mode = false; bool scrolling_mode = false; @@ -114,7 +121,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { // manipulate mouse report based on current mode report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { - + if (cursor_mode) { mouse_report.x = CURSOR_SPEED * mouse_report.x/100; mouse_report.y = CURSOR_SPEED * mouse_report.y/100; @@ -160,4 +167,3 @@ report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { return mouse_report; } - diff --git a/keyboards/edinburgh41/keymaps/lalit/config.h b/keyboards/edinburgh41/keymaps/lalit/config.h index 515a68a0fa06..b8304212e28b 100644 --- a/keyboards/edinburgh41/keymaps/lalit/config.h +++ b/keyboards/edinburgh41/keymaps/lalit/config.h @@ -9,28 +9,11 @@ // Thumbstick settings -#define SCROLLING_LAYER 1 -#define TAPPING_LAYER 2 +#undef CURSOR_SPEED +#define CURSOR_SPEED 95 -#define THUMBSTICK_RIGHT_TAP KC_RIGHT -#define THUMBSTICK_LEFT_TAP KC_LEFT -#define THUMBSTICK_UP_TAP KC_UP -#define THUMBSTICK_DOWN_TAP KC_DOWN - -#define CURSOR_SPEED 90 +#undef SCROLL_SPEED #define SCROLL_SPEED 20 -#define SCROLL_DELAY_MS 70 - -// Thumbstick settings - -#define SCROLLING_LAYER 1 -#define TAPPING_LAYER 2 -// #define THUMBSTICK_RIGHT_TAP KC_RIGHT -// #define THUMBSTICK_LEFT_TAP KC_LEFT -// #define THUMBSTICK_UP_TAP KC_UP -// #define THUMBSTICK_DOWN_TAP KC_DOWN -#define CURSOR_SPEED 1 -#define SCROLL_SPEED 0.1 // tap dance settings #define TAPPING_TERM 155 diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c index 93db0c39f3b4..c84bf04aa4c3 100644 --- a/keyboards/edinburgh41/keymaps/lalit/keymap.c +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -31,11 +31,7 @@ enum custom_keycodes { AE_UMLAUT = SAFE_RANGE, UE_UMLAUT, OE_UMLAUT, - SS_UMLAUT, - THUMBSTICK_RIGHT_TAP, - THUMBSTICK_LEFT_TAP, - THUMBSTICK_UP_TAP, - THUMBSTICK_DOWN_TAP + SS_UMLAUT }; enum { @@ -81,7 +77,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -// German Umlaute macro +// German Umlaute macro for Mac US keyboard bool process_record_user(uint16_t keycode, keyrecord_t* record) { switch (keycode) { @@ -115,14 +111,14 @@ bool process_record_user(uint16_t keycode, keyrecord_t* record) { return true; }; -// Thumbstick keymap +// Thumbstick keymap, change KC_XXX to whatever you need -THUMBSTICK_RIGHT_TAP = KC_RIGHT; -THUMBSTICK_LEFT_TAP = KC_LEFT; -THUMBSTICK_UP_TAP = KC_UP; -THUMBSTICK_DOWN_TAP = KC_DOWN; +#define THUMBSTICK_RIGHT_TAP KC_RIGHT +#define THUMBSTICK_LEFT_TAP KC_LEFT +#define THUMBSTICK_UP_TAP KC_UP +#define THUMBSTICK_DOWN_TAP KC_DOWN -// Thumbstick code +// Thumbstick code, no customisation needed bool cursor_mode = false; bool scrolling_mode = false; From bd3cbc09f0e8dc83c7caf9673f6e2f63c3133f43 Mon Sep 17 00:00:00 2001 From: schwarzer-geiger Date: Wed, 11 Jan 2023 22:49:59 +0100 Subject: [PATCH 10/12] Delete keyboards/jakob33 directory --- keyboards/jakob33/config.h | 27 ----------- keyboards/jakob33/info.json | 55 ---------------------- keyboards/jakob33/jakob33.c | 4 -- keyboards/jakob33/jakob33.h | 19 -------- keyboards/jakob33/keymaps/default/keymap.c | 27 ----------- keyboards/jakob33/readme.md | 27 ----------- keyboards/jakob33/rules.mk | 12 ----- 7 files changed, 171 deletions(-) delete mode 100644 keyboards/jakob33/config.h delete mode 100644 keyboards/jakob33/info.json delete mode 100644 keyboards/jakob33/jakob33.c delete mode 100644 keyboards/jakob33/jakob33.h delete mode 100644 keyboards/jakob33/keymaps/default/keymap.c delete mode 100644 keyboards/jakob33/readme.md delete mode 100644 keyboards/jakob33/rules.mk diff --git a/keyboards/jakob33/config.h b/keyboards/jakob33/config.h deleted file mode 100644 index e3cde4a19d57..000000000000 --- a/keyboards/jakob33/config.h +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Lalit Mistry (@schwarzer-geiger) -// SPDX-License-Identifier: GPL-2.0-or-later - -#pragma once - -#include "config_common.h" - -// key matrix settings -#define MATRIX_ROWS 5 -#define MATRIX_COLS 7 - -#define MATRIX_ROW_PINS \ - { B6, B2, B3, B1, F7 } -#define MATRIX_COL_PINS \ - { D4, C6, D2, E6, B4, B5, F6 } - -#define DIODE_DIRECTION COL2ROW - -#define DEBOUNCE 5 - -#define ENCODERS_PAD_A { F5 } -#define ENCODERS_PAD_B { F4 } - -// Underglow LED settings - -#define RGB_DI_PIN D7 -#define RGBLED_NUM 9 diff --git a/keyboards/jakob33/info.json b/keyboards/jakob33/info.json deleted file mode 100644 index 4f1798193b63..000000000000 --- a/keyboards/jakob33/info.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "manufacturer": "Lalit Mistry", - "keyboard_name": "jakob33", - "maintainer": "schwarzer-geiger", - "url": "", - "usb": { - "device_version": "1.0.0", - "pid": "0x0000", - "vid": "0xFEED" - }, - "layouts": { - "LAYOUT_jakob33": { - "layout": [ - {"x": 0, "y": 0}, - {"x": 3, "y": 0}, - - {"x": 0, "y": 1}, - {"x": 1, "y": 1}, - {"x": 2, "y": 1}, - {"x": 3, "y": 1}, - {"x": 4, "y": 1}, - {"x": 5, "y": 1}, - {"x": 6, "y": 1}, - - {"x": 0, "y": 2, "w": 1.5}, - {"x": 1.5, "y": 2}, - {"x": 2.5, "y": 2}, - {"x": 3.5, "y": 2}, - {"x": 4.5, "y": 2}, - {"x": 5.5, "y": 2}, - - {"x": 0, "y": 3, "w": 1.75}, - {"x": 1.75, "y": 3}, - {"x": 2.75, "y": 3}, - {"x": 3.75, "y": 3}, - {"x": 4.75, "y": 3}, - {"x": 5.75, "y": 3}, - - {"x": 0, "y": 4, "w": 1.25}, - {"x": 1.25, "y": 4}, - {"x": 2.25, "y": 4}, - {"x": 3.25, "y": 4}, - {"x": 4.25, "y": 4}, - {"x": 5.25, "y": 4}, - {"x": 6.25, "y": 4}, - - {"x": 0, "y": 5, "w": 1.25}, - {"x": 1.25, "y": 5, "w": 1.25}, - {"x": 2.5, "y": 5, "w": 1.25}, - {"x": 3.75, "y": 5, "w": 1.25}, - {"x": 5, "y": 5, "w": 2.25} - ] - } - } -} diff --git a/keyboards/jakob33/jakob33.c b/keyboards/jakob33/jakob33.c deleted file mode 100644 index 22a36811a950..000000000000 --- a/keyboards/jakob33/jakob33.c +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright 2022 Lalit Mistry (@schwarzer-geiger) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "jakob33.h" diff --git a/keyboards/jakob33/jakob33.h b/keyboards/jakob33/jakob33.h deleted file mode 100644 index 6999b2c4c321..000000000000 --- a/keyboards/jakob33/jakob33.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Lalit Mistry (@schwarzer-geiger) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include "quantum.h" - -#define LAYOUT_jakob33( \ - k16, k26, \ - k00, k01, k02, k03, k04, k05, k06, \ - k10, k11, k12, k13, k14, k15, \ - k20, k21, k22, k23, k24, k25, \ - k30, k31, k32, k33, k34, k35, k36, \ - k40, k41, k42, k43, k44 \ -) { \ - { k00, k01, k02, k03, k04, k05, k06 }, \ - { k10, k11, k12, k13, k14, k15, k16 }, \ - { k20, k21, k22, k23, k24, k25, k26 }, \ - { k30, k31, k32, k33, k34, k35, k36 }, \ - { k40, k41, k42, k43, k44, KC_NO, KC_NO } \ -} diff --git a/keyboards/jakob33/keymaps/default/keymap.c b/keyboards/jakob33/keymaps/default/keymap.c deleted file mode 100644 index 30933116ff25..000000000000 --- a/keyboards/jakob33/keymaps/default/keymap.c +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Lalit Mistry (@schwarzer-geiger) -// SPDX-License-Identifier: GPL-2.0-or-later - -#include QMK_KEYBOARD_H - -const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [0] = LAYOUT_jakob33( - KC_ESC, KC_NO, - KC_ESC, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, - KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, - KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, - KC_LSFT, KC_Y, KC_X, KC_C, KC_V, KC_B, KC_Z, - KC_B, KC_LCTL, KC_LALT, KC_LGUI, KC_SPC - ) -}; - -bool encoder_update_user(uint8_t index, bool clockwise) { - if (clockwise) { - tap_code(KC_VOLU); - } else { - tap_code(KC_VOLD); - } - return false; -} - - - diff --git a/keyboards/jakob33/readme.md b/keyboards/jakob33/readme.md deleted file mode 100644 index e1d5e18b9444..000000000000 --- a/keyboards/jakob33/readme.md +++ /dev/null @@ -1,27 +0,0 @@ -# jakob33 - -![jakob33](imgur.com image replace me!) - -*A short description of the keyboard/project* - -* Keyboard Maintainer: [Lalit Mistry](https://github.com/schwarzer-geiger) -* Hardware Supported: *The PCBs, controllers supported* -* Hardware Availability: *Links to where you can find this hardware* - -Make example for this keyboard (after setting up your build environment): - - make jakob33:default - -Flashing example for this keyboard: - - make jakob33:default:flash - -See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs). - -## Bootloader - -Enter the bootloader in 3 ways: - -* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard -* **Physical reset button**: Briefly press the button on the back of the PCB - some may have pads you must short instead -* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/jakob33/rules.mk b/keyboards/jakob33/rules.mk deleted file mode 100644 index d8e5fc57033e..000000000000 --- a/keyboards/jakob33/rules.mk +++ /dev/null @@ -1,12 +0,0 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -BOOTLOADER = caterina - -# Build Options -# change yes to no to disable -# -BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -ENCODER_ENABLE = yes From dcc77f079e0963f05123f1c2e3fa9369a495aef0 Mon Sep 17 00:00:00 2001 From: schwarzer-geiger Date: Thu, 12 Jan 2023 09:15:29 +0100 Subject: [PATCH 11/12] Apply suggestions from code review Co-authored-by: Joel Challis Co-authored-by: jack <0x6a73@protonmail.com> --- keyboards/edinburgh41/config.h | 5 ----- keyboards/edinburgh41/edinburgh41.h | 2 +- keyboards/edinburgh41/info.json | 2 +- .../edinburgh41/keymaps/default/keymap.c | 12 +++++------ keyboards/edinburgh41/keymaps/lalit/keymap.c | 12 +++++------ keyboards/edinburgh41/keymaps/lalit/rules.mk | 21 ------------------- keyboards/edinburgh41/readme.md | 2 +- keyboards/edinburgh41/rules.mk | 6 ------ 8 files changed, 15 insertions(+), 47 deletions(-) diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index fcd58107bb9e..4eabef8f1f15 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -18,11 +18,6 @@ #define DEBOUNCE 5 -// bootmagic settings - -#define BOOTMAGIC_LITE_ROW 0 -#define BOOTMAGIC_LITE_COLUMN 0 - // Underglow LED settings #define RGB_DI_PIN D0 diff --git a/keyboards/edinburgh41/edinburgh41.h b/keyboards/edinburgh41/edinburgh41.h index a5edffe2ce94..64cf9ff9103a 100644 --- a/keyboards/edinburgh41/edinburgh41.h +++ b/keyboards/edinburgh41/edinburgh41.h @@ -25,7 +25,7 @@ * The second converts the arguments into a two-dimensional array which * represents the switch matrix. */ -#define LAYOUT_edinburgh41( \ +#define LAYOUT( \ K00, K01, K02, K03, K04, K05, K30, K31, K32, K33, K34, K35, \ K10, K11, K12, K13, K14, K15, K40, K41, K42, K43, K44, K45, \ K20, K21, K22, K23, K24, K25, K50, K51, K52, K53, K54, K55, \ diff --git a/keyboards/edinburgh41/info.json b/keyboards/edinburgh41/info.json index a2bbcc618313..6a8d8b4bf91f 100644 --- a/keyboards/edinburgh41/info.json +++ b/keyboards/edinburgh41/info.json @@ -11,7 +11,7 @@ "vid": "0xFEED" }, "layouts": { - "LAYOUT_edinburgh41": { + "LAYOUT": { "layout": [ {"label":"K00", "x":0, "y":0.54}, {"label":"K01", "x":1, "y":0.36}, diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c index 6346dcdaa9c4..e62d766a9794 100644 --- a/keyboards/edinburgh41/keymaps/default/keymap.c +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -27,28 +27,28 @@ enum layer_names { #define ADJUST MO(_ADJUST) const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_BASE] = LAYOUT_edinburgh41( + [_BASE] = LAYOUT( KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, KC_LCTL, 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, RSFT_T(KC_ENT), KC_LALT, LOWER, KC_SPC, RAISE, KC_RGUI ), - [_LOWER] = LAYOUT_edinburgh41( + [_LOWER] = LAYOUT( _______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_GRV, KC_TILD, _______, KC_ESC, KC_LGUI, KC_LALT, KC_CAPS, KC_DQUO, KC_HOME, KC_END, KC_PGUP, KC_PGDN, KC_PSCR, RSFT_T(KC_SPC), _______, _______, KC_ENT, _______, _______ ), - [_RAISE] = LAYOUT_edinburgh41( + [_RAISE] = LAYOUT( _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, _______, KC_ESC, KC_RGUI, KC_RALT, KC_CAPS, KC_QUOT, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, _______, _______, KC_BSPC, _______, _______ ), - [_ADJUST] = LAYOUT_edinburgh41( + [_ADJUST] = LAYOUT( RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, @@ -80,7 +80,7 @@ bool returned_to_zero = true; uint16_t zero_reads = 0; // set mode depending on layer -layer_state_t layer_state_set_kb(layer_state_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { case SCROLLING_LAYER: if (scrolling_mode == false) { @@ -120,7 +120,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { } // manipulate mouse report based on current mode -report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { if (cursor_mode) { mouse_report.x = CURSOR_SPEED * mouse_report.x/100; diff --git a/keyboards/edinburgh41/keymaps/lalit/keymap.c b/keyboards/edinburgh41/keymaps/lalit/keymap.c index c84bf04aa4c3..91e9b8fe2683 100644 --- a/keyboards/edinburgh41/keymaps/lalit/keymap.c +++ b/keyboards/edinburgh41/keymaps/lalit/keymap.c @@ -48,28 +48,28 @@ qk_tap_dance_action_t tap_dance_actions[] = { }; const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - [_BASE] = LAYOUT_edinburgh41( + [_BASE] = LAYOUT( KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Z, KC_U, KC_I, KC_O, KC_P, KC_BSPC, LT(RAISE, KC_TAB), KC_A, KC_S, KC_D, KC_F, KC_G, TD(TD_H_DQT), TD(TD_J_QUOTE), KC_K, KC_L, KC_MS_BTN1, KC_ENTER, LGUI(KC_TAB), KC_Y, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_SCLN, KC_LCTL, KC_LSFT, KC_NO, KC_SPC, LOWER ), - [_LOWER] = LAYOUT_edinburgh41( + [_LOWER] = LAYOUT( RGB_TOG, KC_NO, KC_LBRC, KC_RBRC, KC_NO, KC_NO, KC_NO, LGUI(KC_SPC), KC_MINUS, LSFT(KC_EQUAL), KC_NO, LGUI(LSFT(KC_4)), _______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, _______, KC_NO, LSFT(KC_LBRC), LSFT(KC_RBRC), KC_NO, KC_NO, KC_NO, KC_EQUAL, KC_BSLS, KC_GRAVE, KC_NO, KC_NO, _______, _______, KC_NO, _______, _______ ), - [_RAISE] = LAYOUT_edinburgh41( + [_RAISE] = LAYOUT( _______, KC_NO, KC_UP, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, KC_LEFT, KC_DOWN, KC_RIGHT, KC_NO, KC_NO, KC_NO, UE_UMLAUT, OE_UMLAUT, AE_UMLAUT, SS_UMLAUT, KC_NO, _______, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, _______, _______, KC_NO, _______, _______ ), - [_ADJUST] = LAYOUT_edinburgh41( + [_ADJUST] = LAYOUT( RGB_VAI, RGB_SAI, RGB_HUI, RGB_MOD, XXXXXXX, RGB_TOG, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_VAD, RGB_SAD, RGB_HUD, RGB_RMOD, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, @@ -131,7 +131,7 @@ bool returned_to_zero = true; uint16_t zero_reads = 0; // set mode depending on layer -layer_state_t layer_state_set_kb(layer_state_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { switch (get_highest_layer(state)) { case SCROLLING_LAYER: if (scrolling_mode == false) { @@ -171,7 +171,7 @@ layer_state_t layer_state_set_kb(layer_state_t state) { } // manipulate mouse report based on current mode -report_mouse_t pointing_device_task_kb(report_mouse_t mouse_report) { +report_mouse_t pointing_device_task_user(report_mouse_t mouse_report) { if (cursor_mode) { mouse_report.x = CURSOR_SPEED * mouse_report.x/100; diff --git a/keyboards/edinburgh41/keymaps/lalit/rules.mk b/keyboards/edinburgh41/keymaps/lalit/rules.mk index 38a1c1b40a50..e5ddcae8d927 100644 --- a/keyboards/edinburgh41/keymaps/lalit/rules.mk +++ b/keyboards/edinburgh41/keymaps/lalit/rules.mk @@ -1,22 +1 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -BOOTLOADER = caterina - -# Build Options -# change yes to no to disable -# -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 -RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow -AUDIO_ENABLE = no # Audio output TAP_DANCE_ENABLE = yes - -POINTING_DEVICE_ENABLE = yes -POINTING_DEVICE_DRIVER = analog_joystick diff --git a/keyboards/edinburgh41/readme.md b/keyboards/edinburgh41/readme.md index aae198cd4e1c..61f3fac0173a 100644 --- a/keyboards/edinburgh41/readme.md +++ b/keyboards/edinburgh41/readme.md @@ -24,4 +24,4 @@ Enter the bootloader in 3 ways: * **Bootmagic reset**: Hold down top left key while plugging keyboard into computer * **Physical reset button**: Short RST and GND pins -* **Keycode in layout**: Press the key mapped to `RESET` if it is available +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available diff --git a/keyboards/edinburgh41/rules.mk b/keyboards/edinburgh41/rules.mk index 048cfcdccaa6..bf33c793b6bf 100644 --- a/keyboards/edinburgh41/rules.mk +++ b/keyboards/edinburgh41/rules.mk @@ -1,9 +1,3 @@ -# MCU name -MCU = atmega32u4 - -# Bootloader selection -BOOTLOADER = caterina - # Build Options # change yes to no to disable # From c974b8687020dd46374928d5493989badcf6ee6f Mon Sep 17 00:00:00 2001 From: schwarzer-geiger Date: Sun, 15 Jan 2023 10:37:28 +0100 Subject: [PATCH 12/12] Apply suggestions from code review Co-authored-by: Ryan Co-authored-by: Drashna Jaelre --- keyboards/edinburgh41/config.h | 4 ---- keyboards/edinburgh41/keymaps/default/keymap.c | 4 +--- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/keyboards/edinburgh41/config.h b/keyboards/edinburgh41/config.h index 4eabef8f1f15..d1f5c41fd49c 100644 --- a/keyboards/edinburgh41/config.h +++ b/keyboards/edinburgh41/config.h @@ -5,10 +5,6 @@ #include "config_common.h" -// key matrix settings -#define MATRIX_ROWS 7 -#define MATRIX_COLS 6 - #define MATRIX_ROW_PINS \ { F4, F5, F6, F7, B1, B3, B2 } #define MATRIX_COL_PINS \ diff --git a/keyboards/edinburgh41/keymaps/default/keymap.c b/keyboards/edinburgh41/keymaps/default/keymap.c index e62d766a9794..b39a1758bcb5 100644 --- a/keyboards/edinburgh41/keymaps/default/keymap.c +++ b/keyboards/edinburgh41/keymaps/default/keymap.c @@ -56,9 +56,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; -layer_state_t layer_state_set_user(layer_state_t state) { - return update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); -} // Thumbstick keymap, change KC_XXX to whatever you need @@ -81,6 +78,7 @@ uint16_t zero_reads = 0; // set mode depending on layer layer_state_t layer_state_set_user(layer_state_t state) { + state = update_tri_layer_state(state, _LOWER, _RAISE, _ADJUST); switch (get_highest_layer(state)) { case SCROLLING_LAYER: if (scrolling_mode == false) {