Skip to content

Commit

Permalink
OLED with trackball will display DPI and pointing device mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
bullwinkle3000 committed Feb 19, 2024
1 parent 5abeea7 commit ef2b368
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 143 deletions.
64 changes: 32 additions & 32 deletions keyboards/handwired/wylderbuilds/trackball/6x7_wyld_track/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,16 @@
"x": 7,
"y": 2
},
{
"label": "6,1",
"x": 8.5,
"y": 2
},
{
"label": "13,3",
"x": 10.5,
"y": 2
},
{
"label": "9,0",
"x": 12,
Expand Down Expand Up @@ -390,54 +400,44 @@
"y": 5
},
{
"label": "13,0",
"x": 12.25,
"label": "6,4",
"x": 6.75,
"y": 5.25
},
{
"label": "13,1",
"x": 12.25,
"y": 6.5
},
{
"label": "13,2",
"x": 11.25,
"y": 7.75
"label": "6,5",
"x": 7.75,
"y": 5.25
},
{
"label": "13,3",
"x": 12.25,
"y": 7.75
"label": "6,6",
"x": 8.75,
"y": 5.25
},
{
"label": "5,5",
"x": 6.75,
"y": 4.5
"label": "13,0",
"x": 10.25,
"y": 5.25
},
{
"label": "5,6",
"x": 7.75,
"y": 4.5
"label": "13,1",
"x": 11.25,
"y": 5.25
},
{
"label": "6,5",
"x": 4.5,
"y": 8.5
"label": "13,2",
"x": 12.25,
"y": 5.25
},
{
"label": "6,6",
"x": 5.5,
"y": 8.5
"label": "6,2",
"x": 7.75,
"y": 6.25
},
{
"label": "6,3",
"x": 5.25,
"y": 9.5
},
{
"label": "6,4",
"x": 6.25,
"y": 9.5
"x": 8.75,
"y": 6.25
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H
#include "6x7_wyld_track.h"
//#include <math.h>
#include <string.h>
enum custom_layer {
_QWERTY,
_LOWER,
Expand All @@ -19,11 +21,14 @@ enum wyld_keycodes {
WYLD_DPI_RESET
};

//char[] wyld_dpi_setting = "";
//char[] wyld_mouse_mode = "";

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_QWERTY] = LAYOUT_6x7(
KC_ESC , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 , KC_F10, KC_F11, KC_F12 , _______,
DRGSCRL, KC_GRV , KC_1 , KC_2 , KC_3 , KC_4 , KC_5 , KC_6 , KC_7 , KC_8 , KC_9 , KC_0 , KC_LBRC , KC_RBRC,
SNIPING, KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_HOME, KC_MUTE, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_QUOT , KC_BACKSLASH,
SNIPING, KC_TAB , KC_Q , KC_W , KC_E , KC_R , KC_T , KC_MUTE, KC_HOME, KC_Y , KC_U , KC_I , KC_O , KC_P , KC_QUOT , KC_BACKSLASH,
KC_BTN3, KC_LSFT , KC_A , KC_S , KC_D , KC_F , KC_G , KC_H , KC_J , KC_K , KC_L ,KC_SCLN, KC_LSFT , DRGSCRL,
KC_BTN1, KC_LCTL , KC_Z , KC_X , KC_C , KC_V , KC_B , KC_N , KC_M , KC_COMM, KC_DOT,KC_SLSH, KC_LCTL , KC_BTN1,
KC_LBRC,KC_RBRC, KC_PLUS, KC_EQL,
Expand All @@ -35,9 +40,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_LOWER] = LAYOUT_6x7(
KC_ESC , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 ,KC_F12 , _______,
_______, KC_TILD,KC_EXLM, KC_AT ,KC_HASH,KC_DLR ,KC_PERC, KC_CIRC,KC_AMPR,KC_ASTR,KC_LPRN,KC_RPRN,KC_DEL , _______,
_______, _______,_______,_______,_______,_______,KC_LBRC, KC_HOME, KC_MUTE, KC_RBRC, KC_P7 , KC_P8 , KC_P9 ,_______,KC_PLUS, _______,
_______, _______,_______,_______,_______,_______,KC_LBRC, KC_MUTE, KC_HOME, KC_RBRC, KC_P7 , KC_P8 , KC_P9 ,_______,KC_PLUS, _______,
_______, _______,KC_HOME,KC_PGUP,KC_PGDN,KC_END ,KC_LPRN, KC_RPRN, KC_P4 , KC_P5 , KC_P6 ,KC_MINS,KC_PIPE, _______,
WYLD_DPI_DOWN,WYLD_DPI_UP,WYLD_DPI_RESET,_______,_______,SNIPING,DRGSCRL, _______, KC_P1 , KC_P2 , KC_P3 ,KC_EQL ,KC_UNDS, QK_BOOT,
DPI_RMOD,DPI_MOD,DPI_RST,_______,_______,SNIPING,DRGSCRL, _______, KC_P1 , KC_P2 , KC_P3 ,KC_EQL ,KC_UNDS, QK_BOOT,
_______,KC_PSCR, _______, KC_P0,
_______, KC_BTN1, KC_BTN2, _______, _______, _______,
KC_DEL, KC_BTN3
Expand All @@ -47,7 +52,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_RAISE] = LAYOUT_6x7(
_______,KC_F12 , KC_F1 , KC_F2 , KC_F3 , KC_F4 , KC_F5 , KC_F6 , KC_F7 , KC_F8 , KC_F9 ,KC_F10 ,KC_F11 , _______,
_______,_______,_______,_______,_______,_______,KC_LBRC, KC_RBRC,_______,KC_NUM,KC_INS ,KC_SCRL,KC_MUTE, _______,
_______,_______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_HOME, KC_MUTE, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU, _______,
_______,_______,KC_LEFT,KC_UP ,KC_DOWN,KC_RGHT,KC_LPRN, KC_MUTE, KC_HOME, KC_RPRN,KC_MPRV,KC_MPLY,KC_MNXT,_______,KC_VOLU, _______,
_______,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,KC_VOLD, _______,
QK_BOOT,_______,_______,_______,_______,_______,_______, _______,_______,_______,_______,_______,_______, _______,
_______,_______, KC_EQL ,_______,
Expand All @@ -57,7 +62,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MOUSE] = LAYOUT_6x7(
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, KC_HOME, KC_MUTE, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, KC_MUTE, KC_HOME, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,SNIPING,DRGSCRL, _______,_______,_______,_______,_______,_______, _______,
_______, _______, _______ ,_______,
Expand All @@ -67,7 +72,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[4] = LAYOUT_6x7(
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______,KC_HOME, KC_MUTE,_______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______,KC_MUTE, KC_HOME,_______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______,_______,_______,_______,_______,_______, _______, _______,_______,_______,_______,_______,_______, _______,
_______, _______, _______ ,_______,
Expand Down Expand Up @@ -104,35 +109,19 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
set_auto_mouse_enable(!get_auto_mouse_enable());
}
return false; // Skip all further processing of this key
case WYLD_DPI_UP:
if (record->event.pressed) {
increase_dpi();
}
return false;
case WYLD_DPI_DOWN:
if (record->event.pressed) {
decrease_dpi();
}
return false;
case WYLD_DPI_RESET:
if (record->event.pressed) {
reset_dpi();
}
return false;
default:
return true; // Process all other keycodes normally
}
return true;
}
#endif

// ENCODERS
#ifdef ENCODER_MAP_ENABLE
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_QWERTY] = { ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
[_LOWER] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[_RAISE] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[_MOUSE] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) },
[4] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD) }
[_QWERTY] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
[_LOWER] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
[_RAISE] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
[_MOUSE] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) },
[4] = { ENCODER_CCW_CW(KC_VOLU, KC_VOLD), ENCODER_CCW_CW(KC_MS_WH_UP, KC_MS_WH_DOWN) }
};
//#endif
#endif
Expand Down Expand Up @@ -216,7 +205,7 @@ oled_rotation_t oled_init_user(oled_rotation_t rotation) {
if (is_keyboard_left()) {
return OLED_ROTATION_270;
}
return OLED_ROTATION_0;
return OLED_ROTATION_270;
}

static const char PROGMEM wylderbuilds[] = {
Expand Down Expand Up @@ -255,38 +244,29 @@ static const char PROGMEM wylderbuilds[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

static void render_wylderbuilds(void) {
oled_write_raw_P(wylderbuilds, sizeof(wylderbuilds));
}
//static void render_wylderbuilds(void) {
// oled_write_raw_P(wylderbuilds, sizeof(wylderbuilds));
//}

static char layer_names[5][8] = {
" BASE\n",
"LOWER\n",
"RAISE\n",
"MOUSE\n",
" XTRA\n"
};

bool oled_task_user(void) {
oled_set_cursor(0, 3);
char* layer_name = layer_names[get_highest_layer(layer_state)];

if (is_keyboard_left()) {
// oled_write_P(PSTR("Layer\n"), false);
oled_set_cursor(0, 3);
oled_write_P(PSTR(layer_name), false);

switch (get_highest_layer(layer_state)) {
case _QWERTY:
oled_write_P(PSTR(" BASE\n"), false);
break;
case _LOWER:
oled_write_P(PSTR("LOWER\n"), false);
break;
case _RAISE:
oled_write_P(PSTR("RAISE\n"), false);
break;
case _MOUSE:
oled_write_P(PSTR("MOUSE\n"), false);
break;
case 4:
oled_write_P(PSTR("XTRA\n"), false);
break;
default:
// Or use the write_ln shortcut over adding '\n' to the end of your string
oled_write_ln_P(PSTR("Undefined"), false);
}
oled_set_cursor(2, 7);
oled_set_cursor(2, 6);
oled_write_P(PSTR("WPM "), false);
oled_set_cursor(1, 8);
oled_set_cursor(2, 7);
oled_write(get_u8_str(get_current_wpm(), ' '), false);
// Host Keyboard LED Status

Expand All @@ -298,9 +278,20 @@ bool oled_task_user(void) {
oled_write_P(led_state.scroll_lock ? PSTR("SCRLK \n") : PSTR(" \n"), false);
} else {
// write WPM to right OLED
#ifdef POINTING_DEVICE_ENABLE
char* mode = get_mouse_mode_string();
uint16_t dpi = get_current_dpi();
oled_set_cursor(2, 3);
oled_write_P(PSTR("DPI "), false);
oled_set_cursor(0, 5);
oled_write_P(PSTR(get_u16_str(dpi, ' ')), false);
oled_set_cursor(0, 9);
oled_write(PSTR(mode), false);
#else
oled_set_cursor(0, 0);
render_wylderbuilds();
oled_scroll_left();
#endif
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@
"1,4",
"1,5",
"1,6",
{
"x": 4
},
"0,0\n\n\n\n\n\n\n\n\ne",
"0,1\n\n\n\n\n\n\n\n\ne",
"1,0\n\n\n\n\n\n\n\n\ne",
"1,1\n\n\n\n\n\n\n\n\ne",
"8,0",
"8,1",
"8,2",
Expand Down Expand Up @@ -84,7 +85,15 @@
"2,5",
"2,6",
{
"x": 4
"x": 0.5
},
"6,1",
{
"x": 1
},
"13,3",
{
"x": 0.5
},
"9,0",
{
Expand Down Expand Up @@ -189,50 +198,24 @@
[
{
"y": -0.75,
"x": 12.25
},
"13,0"
],
[
{
"y": 0.25,
"x": 12.25
},
"13,1"
],
[
{
"y": 0.25,
"x": 11.25
},
"13,2",
"13,3"
],
[
{
"r": 7,
"y": -4.25,
"x": 6.75
},
"5,5",
"5,6"
],
[
"6,4",
"6,5",
"6,6",
{
"r": -15,
"y": 3,
"x": 4.5
"x": 0.5
},
"6,5",
"6,6"
"13,0",
"13,1",
"13,2"
],
[
{
"r": -13,
"x": 5.25
"x": 7.75
},
"6,3",
"6,4"
"6,2",
"6,3"
]
]
}
Expand Down
Loading

0 comments on commit ef2b368

Please sign in to comment.