Skip to content

Commit

Permalink
Addded initial changes needed for full-screen 4 line display in vis l…
Browse files Browse the repository at this point in the history
…ibrary for infinity ergodox.
  • Loading branch information
aenertia committed Sep 22, 2017
1 parent a07d1f2 commit 01090fb
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 49 deletions.
Binary file not shown.
12 changes: 12 additions & 0 deletions layouts/community/ergodox/aenertia/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
## aenertia's modified ergodox infinity layout

## Uses a kinesis like layout with some modifications from 333fred's layout/vis


##notes

Uses a modified viz library from the main qmk and differing ugfx compile time options to enable wordwrap and 4 line output on the 128x32 LCD

Currently I am only testing on a Single RightHand PCB - as Massdrop/Input Club shipped me two Right hand sides.

In theory just compiling two different visualization.c for the left and right should be fine. But I am not sure about the the async code in qmk and can't currently test
11 changes: 11 additions & 0 deletions layouts/community/ergodox/aenertia/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#ifndef CONFIG_H_
#define CONFIG_H_

#include QMK_KEYBOARD_CONFIG_H

#undef TAPPING_TERM
#define TAPPING_TERM 150

#define PERMISSIVE_HOLD

#endif
205 changes: 205 additions & 0 deletions layouts/community/ergodox/aenertia/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#include QMK_KEYBOARD_H
#include "debug.h"
#include "action_layer.h"
#include "version.h"

#define BASE 0 // default layer
#define SYMB 1 // symbols
#define MDIA 2 // media keys

enum custom_keycodes {
PLACEHOLDER = SAFE_RANGE, // can always be here
EPRM,
VRSN,
};

enum custom_macros {
VERSION,
EEPROM,
};

// NOTE: Cells marked with ACCESS must remain transparent, they're the keys that actually get to that layer

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap 0: Basic layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | = | 1 | 2 | 3 | 4 | 5 | LEFT | | RIGHT| 6 | 7 | 8 | 9 | 0 | - |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | Tab | Q | W | E | R | T | L1 | |ACCESS| Y | U | I | O | P | \ |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Caps | A | S | D | F | G |------| |------| H | J | K | L | ; | ' |
* |--------+------+------+------+------+------| Hyper| | Meh |------+------+------+------+------+--------|
* | LShift | Z | X | C | V | B | | | | N | M | , | . | / | RShift |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | Esc | Grv |Insert| Left | Right| | Up | Down | [ | ] | L2 |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | Ctrl | Alt | | LGui | Ctrl |
* ,------|------|------| |------+------+------.
* | | | Home | | PgUp | | |
* |Backsp| Del |------| |------| Enter| Space|
* |ace | | End | | PgDn | | |
* `--------------------' `--------------------'
*/
// If it accepts an argument (i.e, is a function), it doesn't need KC_.
// Otherwise, it needs KC_*
[BASE] = LAYOUT_ergodox( // layer 0 : default
// left hand
KC_EQL, KC_1, KC_2, KC_3, KC_4, KC_5, KC_LEFT,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, TG(SYMB),
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G,
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, ALL_T(KC_NO),
KC_ESC, KC_GRV, KC_INS, KC_LEFT, KC_RGHT,
KC_LCTL,KC_LALT,
KC_HOME,
KC_BSPC,KC_DEL,KC_END,
// right hand
KC_RGHT, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS,
TG(SYMB), KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSLS,
KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT,
MEH_T(KC_NO),KC_N, KC_M, KC_COMM,KC_DOT, KC_SLSH, KC_RSFT,
KC_UP, KC_DOWN,KC_LBRC,KC_RBRC, KC_FN2,
KC_LGUI, KC_RCTL,
KC_PGUP,
KC_PGDN, KC_ENT, KC_SPC
),
/* Keymap 1: Symbol Layer
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | PrScr | F1 | F2 | F3 | F4 | F5 | | | | F6 | F7 | F8 | F9 | F10 | F11 |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | ScrLk | ! | @ | { | } | | | | | | Up | 7 | 8 | 9 | * | F12 |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | Pause | # | $ | ( | ) | ` |------| |------| Down | 4 | 5 | 6 | + |VERSION |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | % | ^ | [ | ] | ~ | | | | & | 1 | 2 | 3 | \ | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | | | | | . | 0 | = | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | | |
* | | |------| |------| | |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// SYMBOLS
[SYMB] = LAYOUT_ergodox(
// left hand
KC_PSCR,KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_TRNS,
KC_SLCK,KC_EXLM,KC_AT, KC_LCBR,KC_RCBR,KC_PIPE,KC_TRNS,
KC_PAUS,KC_HASH,KC_DLR, KC_LPRN,KC_RPRN,KC_GRV,
KC_TRNS,KC_PERC,KC_CIRC,KC_LBRC,KC_RBRC,KC_TILD,KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,KC_TRNS,
KC_TRNS,KC_TRNS,
KC_TRNS,
KC_TRNS,KC_TRNS,KC_TRNS,
// right hand
KC_TRNS, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11,
KC_TRNS, KC_UP, KC_7, KC_8, KC_9, KC_ASTR, KC_F12,
KC_DOWN, KC_4, KC_5, KC_6, KC_PLUS, VRSN,
MO(MDIA), KC_AMPR, KC_1, KC_2, KC_3, KC_BSLS, KC_TRNS,
KC_TRNS,KC_DOT, KC_0, KC_EQL, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS
),

/* Keymap 2: Media and mouse keys
*
* ,--------------------------------------------------. ,--------------------------------------------------.
* | | | | | | | | | | | | | | | |
* |--------+------+------+------+------+-------------| |------+------+------+------+------+------+--------|
* | | | | MsUp | | | | | | | | | | | |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | |MsLeft|MsDown|MsRght| |------| |------| | | | | | Play |
* |--------+------+------+------+------+------| | | |------+------+------+------+------+--------|
* | | | | | | | | | | | | Prev | Next | | |
* `--------+------+------+------+------+-------------' `-------------+------+------+------+------+--------'
* | | | | Lclk | Rclk | |VolUp |VolDn | Mute | | |
* `----------------------------------' `----------------------------------'
* ,-------------. ,-------------.
* | | | | | |
* ,------|------|------| |------+------+------.
* | | | | | | |Brwser|
* | | |------| |------| |Back |
* | | | | | | | |
* `--------------------' `--------------------'
*/
// MEDIA AND MOUSE
[MDIA] = LAYOUT_ergodox(
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MS_U, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_MS_L, KC_MS_D, KC_MS_R, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_BTN1, KC_BTN2,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS,
// right hand
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MPLY,
KC_TRNS, KC_TRNS, KC_TRNS, KC_MPRV, KC_MNXT, KC_TRNS, KC_TRNS,
KC_VOLU, KC_VOLD, KC_MUTE, KC_TRNS, KC_TRNS,
KC_TRNS, KC_TRNS,
KC_TRNS,
KC_TRNS, KC_TRNS, KC_WBAK
),
};

const uint16_t PROGMEM fn_actions[] = {
[1] = ACTION_LAYER_TAP_TOGGLE(SYMB) // FN1 - Momentary Layer 1 (Symbols)
};

const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
{
// MACRODOWN only works in this function
switch(id) {
case VERSION:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
break;
case EEPROM:
if (record->event.pressed) { // For resetting EEPROM
eeconfig_init();
}
break;
}
return MACRO_NONE;
};

bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
// dynamically generate these.
case EPRM:
if (record->event.pressed) {
eeconfig_init();
}
return false;
break;
case VRSN:
if (record->event.pressed) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
return false;
break;
}
return true;
}

// Runs just one time when the keyboard initializes.
void matrix_init_user(void) {

};


// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
ergodox_board_led_on();
ergodox_led_all_on();
};

8 changes: 8 additions & 0 deletions layouts/community/ergodox/aenertia/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LCD_BACKLIGHT_ENABLE = yes
LCD_ENABLE = yes
BACKLIGHT_ENABLE = yes
NKRO_ENABLE = yes
KEY_LOCK_ENABLE = yes



56 changes: 56 additions & 0 deletions layouts/community/ergodox/aenertia/visualizer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
Note: this is a modified copy of ../default/visualizer.c, originally licensed GPL.
*/

#include "simple_visualizer.h"

// This function should be implemented by the keymap visualizer
// Don't change anything else than state->target_lcd_color and state->layer_text as that's the only thing
// that the simple_visualizer assumes that you are updating
// Also make sure that the buffer passed to state->layer_text remains valid until the previous animation is
// stopped. This can be done by either double buffering it or by using constant strings
// Default - !#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwx";
//
// This has expanded with the quantum visualizer and ugfx lib to use the GDrawStringBox api rather than Drawstring and wordwrap enabled
// The following block renders 4 lines on the screen with fixed 5x8 font and using wordwrap
// Spaces/Null space is a bit hit or miss so Try and use this format when entering your layer strings \t and \n are pretty hit or miss
/*
"Gu Ct Ri 6 7 8 9 0 - "
"Pu En Sp l1 Y U I O P \\ "
"Pd Me H J K L ; ' "
"U D [ ] l2 N M , . / Sh ";
*/
static void get_visualizer_layer_and_color(visualizer_state_t* state) {
uint8_t saturation = 60;
if (state->status.leds & (1u << USB_LED_CAPS_LOCK)) {
saturation = 255;
}
if (state->status.layer & 0x10) {
state->target_lcd_color = LCD_COLOR(140, 100, 60);
state->layer_text = "Movement";
} else if (state->status.layer & 0x8) {
state->target_lcd_color = LCD_COLOR(0, saturation, 0xFF);
state->layer_text = "Media";
} else if (state->status.layer & 0x4) {
state->target_lcd_color = LCD_COLOR(168, saturation, 0xFF);
state->layer_text =
"Ra Rc l1 6 7 8 9 0 - "
"Pu En Bb l2 Y U I O P \\ "
"Pd Me H J K L ; Play "
"V+ V- Vm l2 N M Pr Ne ";
} else if (state->status.layer & 0x2) {
state->target_lcd_color = LCD_COLOR(216, 90, 0xFF);
state->layer_text =
"Funct: Ri 6 7 8 9 10 11 "
"Pu En Sp l1 7 8 9 * F12 "
"Pd Me 4 5 6 + Ver "
"0 0 . = l2 & 1 2 3 \\ Sh ";
} else {
state->target_lcd_color = LCD_COLOR(84, saturation, 0xFF);
state->layer_text =
"Gu Ct Ri 6 7 8 9 0 - "
"Pu En Sp l1 Y U I O P \\ "
"Pd Me H J K L ; ' "
"U D [ ] l2 N M , . / Sh ";
}
}
6 changes: 3 additions & 3 deletions quantum/visualizer/common_gfxconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@
//#define GDISP_NEED_MULTITHREAD FALSE
//#define GDISP_NEED_STREAMING FALSE
#define GDISP_NEED_TEXT TRUE
// #define GDISP_NEED_TEXT_WORDWRAP FALSE
#define GDISP_NEED_TEXT_WORDWRAP TRUE
// #define GDISP_NEED_ANTIALIAS FALSE
// #define GDISP_NEED_UTF8 FALSE
// #define GDISP_NEED_UTF8 TRUE
#define GDISP_NEED_TEXT_KERNING TRUE
// #define GDISP_INCLUDE_FONT_UI1 FALSE
// #define GDISP_INCLUDE_FONT_UI2 FALSE // The smallest preferred font.
Expand All @@ -90,7 +90,7 @@
// #define GDISP_INCLUDE_FONT_DEJAVUSANS20 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
// #define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
// #define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 TRUE
// #define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
// #define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
#define GDISP_INCLUDE_FONT_FIXED_5X8 TRUE
Expand Down
35 changes: 23 additions & 12 deletions quantum/visualizer/lcd_keyframes.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
bool lcd_keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
gdispClear(White);
gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black);
// gdispDrawString(0, 10, state->layer_text, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, state->layer_text, state->font_fixed5x8, Black, justifyLeft);
return false;
}

Expand Down Expand Up @@ -57,11 +58,14 @@ bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualiz
const char* layer_help = "1=On D=Default B=Both";
char layer_buffer[16 + 4]; // 3 spaces and one null terminator
gdispClear(White);
gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
// gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, layer_help, state->font_fixed5x8, Black, justifyLeft);
format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer);
gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
// gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, layer_buffer, state->font_fixed5x8, Black, justifyLeft);
format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer);
gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
// gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, layer_buffer, state->font_fixed5x8, Black, justifyLeft);
return false;
}

Expand Down Expand Up @@ -95,10 +99,13 @@ bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualize
char status_buffer[12];

gdispClear(White);
gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
// gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, title, state->font_fixed5x8, Black, justifyLeft);
// gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, mods_header, state->font_fixed5x8, Black, justifyLeft);
format_mods_bitmap_string(state->status.mods, status_buffer);
gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);
// gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, status_buffer, state->font_fixed5x8, Black, justifyLeft);

return false;
}
Expand Down Expand Up @@ -137,21 +144,25 @@ bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer
char output[LED_STATE_STRING_SIZE];
get_led_state_string(output, state);
gdispClear(White);
gdispDrawString(0, 10, output, state->font_dejavusansbold12, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, state->layer_text, state->font_fixed5x8, Black, justifyLeft);
return false;
}

bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state) {
(void)animation;
gdispClear(White);
uint8_t y = 10;
// uint8_t y = 10;
if (state->status.leds) {
char output[LED_STATE_STRING_SIZE];
get_led_state_string(output, state);
gdispDrawString(0, 1, output, state->font_dejavusansbold12, Black);
y = 17;
// gdispDrawString(0, 1, output, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, output, state->font_fixed5x8, Black, justifyLeft);

// y = 17;
}
gdispDrawString(0, y, state->layer_text, state->font_dejavusansbold12, Black);
// gdispDrawString(0, y, state->layer_text, state->font_fixed5x8, Black);
gdispGDrawStringBox(GDISP, 0, 0, LCD_WIDTH, LCD_HEIGHT, state->layer_text, state->font_fixed5x8, Black, justifyLeft);

return false;
}

Expand Down
Loading

0 comments on commit 01090fb

Please sign in to comment.