Skip to content

Commit

Permalink
Ploopynano/jussaw (#20)
Browse files Browse the repository at this point in the history
* Add jussaw keymap to Ploopy Nano

* Invert drag scroll
  • Loading branch information
jussaw authored Dec 13, 2024
1 parent 12c66d1 commit 2e112d4
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
2 changes: 2 additions & 0 deletions keyboards/ploopyco/ploopyco.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ bool encoder_update_user(uint8_t index, bool clockwise);
bool encoder_update_kb(uint8_t index, bool clockwise);
void toggle_drag_scroll(void);
void cycle_dpi(void);

#define PLOOPY_DRAGSCROLL_INVERT
64 changes: 64 additions & 0 deletions keyboards/ploopyco/trackball_nano/keymaps/jussaw/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/* Copyright 2021 Colin Lam (Ploopy Corporation)
* Copyright 2020 Christopher Courtney, aka Drashna Jael're (@drashna) <drashna@live.com>
* Copyright 2019 Sunjun Kim
* Copyright 2019 Hiroyuki Okada
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H

/* Invert Ploopy Dragscroll*/
#define PLOOPY_DRAGSCROLL_INVERT

// Dummy
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {{{ KC_NO }}};

void suspend_power_down_user(void) {
// Switch off sensor + LED making trackball unable to wake host
adns5050_power_down();
}

void suspend_wakeup_init_user(void) {
adns5050_init();
}

// Add host state drag scroll and dpi cycling
static bool num_lock_state = false;
static bool scroll_lock_state = false;

void keyboard_post_init_user(void) {
num_lock_state = host_keyboard_led_state().num_lock;
scroll_lock_state = host_keyboard_led_state().scroll_lock;
}

bool led_update_user(led_t led_state) {
// when scroll lock is pressed, toggle drag scroll state
if ( scroll_lock_state != led_state.scroll_lock ) {
toggle_drag_scroll();
scroll_lock_state = led_state.scroll_lock;
}

// when num lock is pressed, cycle dpi
if ( num_lock_state != led_state.num_lock ) {
cycle_dpi();
num_lock_state = led_state.num_lock;
}

// when all three are enabled, go to bootloader
if ( led_state.num_lock && led_state.caps_lock && led_state.scroll_lock ) {
reset_keyboard();
}

return true;
}

0 comments on commit 2e112d4

Please sign in to comment.