Skip to content

Commit

Permalink
via works
Browse files Browse the repository at this point in the history
  • Loading branch information
dieseltravis committed Jul 23, 2024
1 parent 1a09de8 commit 0b6d8a3
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 63 deletions.
4 changes: 2 additions & 2 deletions firmware/qmk/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
#define MATRIX_ROWS 5
#define MATRIX_COLS 4

#define OLED_DISPLAY_128X32
//#define OLED_DISPLAY_128X32
//#define I2C1_SCL_PIN GP17
//#define I2C1_SDA_PIN GP16
//#define I2C_DRIVER I2CD0
#define OLED_BRIGHTNESS 128
#define OLED_FONT_H "keyboards/1upkeyboards/pi40/lib/glcdfont.c"
//#define OLED_FONT_H "keyboards/1upkeyboards/pi40/lib/glcdfont.c"

#define WS2812_BYTE_ORDER WS2812_BYTE_ORDER_GRB

Expand Down
5 changes: 3 additions & 2 deletions firmware/qmk/keyboard.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@
"extrakey": true,
"mousekey": false,
"oled": true,
"nkro": true
"nkro": true,
"rgblight": false
},
"usb": {
"device_version": "1.0.4",
"device_version": "1.0.5",
"pid": "0x2025",
"vid": "0x1979"
},
Expand Down
46 changes: 18 additions & 28 deletions firmware/qmk/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,16 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
#ifdef OLED_ENABLE

static void render_logo(void) {
static const char PROGMEM rgbkb_logo[] = {
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
static const char PROGMEM qmk_logo[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4,
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00
};

oled_write_P(rgbkb_logo, false);
oled_write_P(qmk_logo, false);
}

static void render_status(void) {
// Render to mode icon
static const char PROGMEM mode_logo[4][4] = {
{0x95,0x96,0},
{0xb5,0xb6,0},
{0x97,0x98,0},
{0xb7,0xb8,0} };

if (keymap_config.swap_lalt_lgui != false) {
oled_write_ln_P(mode_logo[0], false);
oled_write_ln_P(mode_logo[1], false);
} else {
oled_write_ln_P(mode_logo[2], false);
oled_write_ln_P(mode_logo[3], false);
}

// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
oled_write_P(PSTR("Layer: "), false);
switch (get_highest_layer(layer_state)) {
case _BASE:
Expand All @@ -153,19 +138,24 @@ static void render_status(void) {

// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}

bool oled_task_user(void) {
if (is_keyboard_master()) {
render_status();
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo();
oled_scroll_left();
render_logo(); // Renders a static logo
oled_scroll_left(); // Turns on scrolling
}
return false;

return false;
}

#endif
50 changes: 21 additions & 29 deletions firmware/qmk/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,33 +119,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

// SSD1306 OLED driver logic
#ifdef OLED_ENABLE

static void render_logo(void) {
static const char PROGMEM rgbkb_logo[] = {
0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,
0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,
0xc0,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xcb,0xcc,0xcd,0xce,0xcf,0xd0,0xd1,0xd2,0xd3,0xd4,0};
static const char PROGMEM qmk_logo[] = {
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94,
0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4,
0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00
};

oled_write_P(rgbkb_logo, false);
oled_write_P(qmk_logo, false);
}

static void render_status(void) {
// Render to mode icon
static const char PROGMEM mode_logo[4][4] = {
{0x95,0x96,0},
{0xb5,0xb6,0},
{0x97,0x98,0},
{0xb7,0xb8,0} };

if (keymap_config.swap_lalt_lgui != false) {
oled_write_ln_P(mode_logo[0], false);
oled_write_ln_P(mode_logo[1], false);
} else {
oled_write_ln_P(mode_logo[2], false);
oled_write_ln_P(mode_logo[3], false);
}

// Define layers here, Have not worked out how to have text displayed for each layer. Copy down the number you see and add a case for it below
oled_write_P(PSTR("Layer: "), false);
switch (get_highest_layer(layer_state)) {
case _BASE:
Expand All @@ -157,25 +141,33 @@ static void render_status(void) {
case _RGB:
oled_write_ln_P(PSTR("RGB"), false);
break;
case _FOUR:
oled_write_ln_P(PSTR("extra"), false);
break;
default:
oled_write_ln_P(PSTR("Undefined"), false);
}

// Host Keyboard LED Status
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUMLCK ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAPLCK ") : PSTR(" "), false);
oled_write_ln_P(led_state.scroll_lock ? PSTR("SCRLCK ") : PSTR(" "), false);
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
}

oled_rotation_t oled_init_user(oled_rotation_t rotation) {
return OLED_ROTATION_180;
}

bool oled_task_user(void) {
if (is_keyboard_master()) {
render_status();
render_status(); // Renders the current keyboard state (layer, lock, caps, scroll, etc)
} else {
render_logo();
oled_scroll_left();
render_logo(); // Renders a static logo
oled_scroll_left(); // Turns on scrolling
}
return false;

return false;
}

#endif
5 changes: 4 additions & 1 deletion firmware/qmk/rules.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# MCU name
MCU = atmega32u4
CONVERT_TO = rp2040_ce
CONVERT_TO = kb2040
#CONVERT_TO = rp2040_ce

BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
RGB_MATRIX_ENABLE = yes
#AUDIO_ENABLE = no # Audio output
ENCODER_ENABLE = yes # Use rotary encoder
ENCODER_MAP_ENABLE = yes
Expand Down
2 changes: 1 addition & 1 deletion output/pcbs/travis_num2024-routed2.kicad_prl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
39,
40
],
"visible_layers": "fffffef_ffffffff",
"visible_layers": "fffffff_ffffffff",
"zone_display_mode": 0
},
"git": {
Expand Down

0 comments on commit 0b6d8a3

Please sign in to comment.