Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Equals keyboard #21230

Merged
merged 16 commits into from
Jul 26, 2023
174 changes: 174 additions & 0 deletions keyboards/boardsource/equals/48/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
{
"keyboard_name": "Equals 48",

"matrix_pins": {
"cols": ["GP0","GP1","GP2","GP3","GP4","GP5","GP6","GP7","GP8","GP9","GP10","GP11"],
"rows": ["GP12","GP13","GP16","GP17"]
},


"rgb_matrix": {
"driver": "WS2812",
"led_count": 70,
"max_brightness": 150,
"animations": {
"alphas_mods": true,
"gradient_up_down": true,
"gradient_left_right": true,
"breathing": true,
"band_sat": true,
"band_val": true,
"band_pinwheel_sat":true,
"band_pinwheel_val":true,
"band_spiral_sat":true,
"band_spiral_val":true,
"cycle_all":true,
"cycle_left_right":true,
"cycle_up_down":true,
"rainbow_moving_chevron":true,
"cycle_out_in":true,
"cycle_out_in_dual":true,
"cycle_pinwheel":true,
"cycle_spiral":true,
"dual_beacon":true,
"rainbow_beacon":true,
"rainbow_pinwheels":true,
"raindrops":true,
"jellybean_raindrops":true,
"hue_breathing":true,
"hue_pendulum":true,
"hue_wave":true,
"pixel_rain":true,
"pixel_flow":true,
"pixel_fractal":true,
"typing_heatmap":true,
"digital_rain":true,
"solid_reactive_simple":true,
"solid_reactive":true,
"solid_reactive_wide":true,
"solid_reactive_multiwide":true,
"solid_reactive_cross":true,
"solid_reactive_multicross":true,
"solid_reactive_nexus":true,
"solid_reactive_multinexus":true,
"splash":true,
"multisplash":true,
"solid_splash":true,
"solid_multisplash":true
},
"layout": [
{ "flags": 2, "x": 220, "y": 17 },
{ "flags": 2, "x": 172, "y": 17 },
{ "flags": 2, "x": 112, "y": 17 },
{ "flags": 2, "x": 50, "y": 17 },
{ "flags": 2, "x": 4, "y": 17 },
{ "flags": 2, "x": 4, "y": 56 },
{ "flags": 2, "x": 50, "y": 56 },
{ "flags": 2, "x": 112, "y": 56 },
{ "flags": 2, "x": 172, "y": 56 },
{ "flags": 2, "x": 220, "y": 56 },
{ "flags": 1, "matrix": [0, 0], "x": 0, "y": 0 },
{ "flags": 4, "matrix": [0, 1], "x": 20, "y": 0 },
{ "flags": 4, "matrix": [0, 2], "x": 40, "y": 0 },
{ "flags": 4, "matrix": [0, 3], "x": 61, "y": 0 },
{ "flags": 4, "matrix": [0, 4], "x": 81, "y": 0 },
{ "flags": 4, "matrix": [0, 5], "x": 101, "y": 0 },
{ "flags": 4, "matrix": [0, 6], "x": 122, "y": 0 },
{ "flags": 4, "matrix": [0, 7], "x": 142, "y": 0 },
{ "flags": 4, "matrix": [0, 8], "x": 162, "y": 0 },
{ "flags": 4, "matrix": [0, 9], "x": 183, "y": 0 },
{ "flags": 4, "matrix": [0, 10], "x": 203, "y": 0 },
{ "flags": 1, "matrix": [0, 11], "x": 224, "y": 0 },
{ "flags": 1, "matrix": [1, 0], "x": 0, "y": 21 },
{ "flags": 4, "matrix": [1, 1], "x": 20, "y": 21 },
{ "flags": 4, "matrix": [1, 2], "x": 40, "y": 21 },
{ "flags": 4, "matrix": [1, 3], "x": 61, "y": 21 },
{ "flags": 4, "matrix": [1, 4], "x": 81, "y": 21 },
{ "flags": 4, "matrix": [1, 5], "x": 101, "y": 21 },
{ "flags": 4, "matrix": [1, 6], "x": 122, "y": 21 },
{ "flags": 4, "matrix": [1, 7], "x": 142, "y": 21 },
{ "flags": 4, "matrix": [1, 8], "x": 162, "y": 21 },
{ "flags": 4, "matrix": [1, 9], "x": 183, "y": 21 },
{ "flags": 4, "matrix": [1, 10], "x": 203, "y": 21 },
{ "flags": 1, "matrix": [1, 11], "x": 224, "y": 21 },
{ "flags": 1, "matrix": [2, 0], "x": 0, "y": 42 },
{ "flags": 4, "matrix": [2, 1], "x": 20, "y": 42 },
{ "flags": 4, "matrix": [2, 2], "x": 40, "y": 42 },
{ "flags": 4, "matrix": [2, 3], "x": 61, "y": 42 },
{ "flags": 4, "matrix": [2, 4], "x": 81, "y": 42 },
{ "flags": 4, "matrix": [2, 5], "x": 101, "y": 42 },
{ "flags": 4, "matrix": [2, 6], "x": 122, "y": 42 },
{ "flags": 4, "matrix": [2, 7], "x": 142, "y": 42 },
{ "flags": 4, "matrix": [2, 8], "x": 162, "y": 42 },
{ "flags": 4, "matrix": [2, 9], "x": 183, "y": 42 },
{ "flags": 4, "matrix": [2, 10], "x": 203, "y": 42 },
{ "flags": 1, "matrix": [2, 11], "x": 224, "y": 42 },
{ "flags": 1, "matrix": [3, 0], "x": 0, "y": 64 },
{ "flags": 1, "matrix": [3, 1], "x": 20, "y": 64 },
{ "flags": 1, "matrix": [3, 2], "x": 40, "y": 64 },
{ "flags": 1, "matrix": [3, 3], "x": 61, "y": 64 },
{ "flags": 1, "matrix": [3, 4], "x": 81, "y": 64 },
{ "flags": 4, "matrix": [3, 5], "x": 101, "y": 64 },
{ "flags": 1, "matrix": [3, 6], "x": 122, "y": 64 },
{ "flags": 1, "matrix": [3, 7], "x": 142, "y": 64 },
{ "flags": 1, "matrix": [3, 8], "x": 162, "y": 64 },
{ "flags": 1, "matrix": [3, 9], "x": 183, "y": 64 },
{ "flags": 1, "matrix": [3, 10], "x": 203, "y": 64 },
{ "flags": 1, "matrix": [3, 11], "x": 224, "y": 64 }
]
},
"layouts": {
"LAYOUT_ortho_4x12": {
"layout": [
{ "matrix": [0, 0], "x": 0, "y": 0 },
{ "matrix": [0, 1], "x": 1, "y": 0 },
{ "matrix": [0, 2], "x": 2, "y": 0 },
{ "matrix": [0, 3], "x": 3, "y": 0 },
{ "matrix": [0, 4], "x": 4, "y": 0 },
{ "matrix": [0, 5], "x": 5, "y": 0 },
{ "matrix": [0, 6], "x": 6, "y": 0 },
{ "matrix": [0, 7], "x": 7, "y": 0 },
{ "matrix": [0, 8], "x": 8, "y": 0 },
{ "matrix": [0, 9], "x": 9, "y": 0 },
{ "matrix": [0, 10], "x": 10, "y": 0 },
{ "matrix": [0, 11], "x": 11, "y": 0 },
{ "matrix": [1, 0], "x": 0, "y": 1 },
{ "matrix": [1, 1], "x": 1, "y": 1 },
{ "matrix": [1, 2], "x": 2, "y": 1 },
{ "matrix": [1, 3], "x": 3, "y": 1 },
{ "matrix": [1, 4], "x": 4, "y": 1 },
{ "matrix": [1, 5], "x": 5, "y": 1 },
{ "matrix": [1, 6], "x": 6, "y": 1 },
{ "matrix": [1, 7], "x": 7, "y": 1 },
{ "matrix": [1, 8], "x": 8, "y": 1 },
{ "matrix": [1, 9], "x": 9, "y": 1 },
{ "matrix": [1, 10], "x": 10, "y": 1 },
{ "matrix": [1, 11], "x": 11, "y": 1 },
{ "matrix": [2, 0], "x": 0, "y": 2 },
{ "matrix": [2, 1], "x": 1, "y": 2 },
{ "matrix": [2, 2], "x": 2, "y": 2 },
{ "matrix": [2, 3], "x": 3, "y": 2 },
{ "matrix": [2, 4], "x": 4, "y": 2 },
{ "matrix": [2, 5], "x": 5, "y": 2 },
{ "matrix": [2, 6], "x": 6, "y": 2 },
{ "matrix": [2, 7], "x": 7, "y": 2 },
{ "matrix": [2, 8], "x": 8, "y": 2 },
{ "matrix": [2, 9], "x": 9, "y": 2 },
{ "matrix": [2, 10], "x": 10, "y": 2 },
{ "matrix": [2, 11], "x": 11, "y": 2 },
{ "matrix": [3, 0], "x": 0, "y": 3 },
{ "matrix": [3, 1], "x": 1, "y": 3 },
{ "matrix": [3, 2], "x": 2, "y": 3 },
{ "matrix": [3, 3], "x": 3, "y": 3 },
{ "matrix": [3, 4], "x": 4, "y": 3 },
{ "matrix": [3, 5], "x": 5, "y": 3 },
{ "matrix": [3, 6], "x": 6, "y": 3 },
{ "matrix": [3, 7], "x": 7, "y": 3 },
{ "matrix": [3, 8], "x": 8, "y": 3 },
{ "matrix": [3, 9], "x": 9, "y": 3 },
{ "matrix": [3, 10], "x": 10, "y": 3 },
{ "matrix": [3, 11], "x": 11, "y": 3 }
]
}
}
}
3 changes: 3 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/cole/config.h
drashna marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Copyright 2023 Cole Smith (@boardsource)
// SPDX-License-Identifier: GPL-2.0-or-later
#define COMBO_COUNT 4
66 changes: 66 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/cole/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2022 @boardsource
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H

enum layers
{
_MAIN,
_RAISE,
_LOWER,
};

#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
#define KC_CTSC MT(MOD_LGUI, KC_SCLN)
#define LOWER_SPC LT(_LOWER, KC_SPC)
#define LOWER_SPC LT(_LOWER, KC_SPC)
#define RASE_BACK LT(_RAISE, KC_BSPC)
#define SHFT_Z MT(MOD_LSFT, KC_Z)
#define SHIFT_SLASH MT(MOD_RSFT, KC_SLSH)
#define RASE_ENT LT(_RAISE, KC_ENT)
#define CTRL_A MT(KC_LGUI, KC_A)
extern void ui_init(void);
extern void ui_task(void);

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {

[_MAIN] = LAYOUT_ortho_4x12(
KC_Q, KC_W, KC_E, KC_R, KC_T, _______, _______, KC_Y, KC_U, KC_I, KC_O, KC_P,
CTRL_A, KC_S, KC_D, KC_F, KC_G, _______, _______, KC_H, KC_J, KC_K, KC_L, KC_CTSC,
SHFT_Z, KC_X, KC_C, KC_V, KC_B, _______, _______, KC_N, KC_M, KC_COMM, KC_DOT, SHIFT_SLASH,
_______, _______, _______, LOWER, KC_RCTL, RASE_ENT, RASE_BACK, LOWER_SPC, KC_TAB, _______, _______, _______),
[_RAISE] = LAYOUT_ortho_4x12(
KC_1, KC_2, KC_3, KC_4, KC_5, _______, _______, KC_6, KC_7, KC_8, KC_9, KC_0,
KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_QUOT,
KC_LSFT, KC_GRV, _______, _______, XXXXXXX, _______, _______, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, _______, _______, _______, KC_LGUI, KC_ENT, KC_BSPC, KC_SPC, _______, _______, _______, _______),
[_LOWER] = LAYOUT_ortho_4x12(
KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, _______, _______, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN,
KC_ESC, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, _______, _______, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_DQT,
KC_ESC, KC_TILD, _______, _______, RGB_MODE_FORWARD, _______, _______, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, _______, _______, _______, KC_LGUI, KC_ENT, KC_BSPC, KC_SPC, _______, _______, _______, _______)

};

const uint16_t PROGMEM we_combo[] = {KC_W, KC_E, COMBO_END};
const uint16_t PROGMEM iu_combo[] = {KC_I, KC_U, COMBO_END};
const uint16_t PROGMEM kj_combo[] = {KC_K, KC_J, COMBO_END};
const uint16_t PROGMEM er_combo[] = {KC_E, KC_R, COMBO_END};

combo_t key_combos[COMBO_COUNT] = {
daysgobye marked this conversation as resolved.
Show resolved Hide resolved
COMBO(we_combo, KC_ESC),
COMBO(iu_combo, KC_BSPC),
COMBO(kj_combo, KC_COLN),
COMBO(er_combo, KC_TAB)};

void keyboard_post_init_user(void)
{
// Init the display
ui_init();
}

void housekeeping_task_user(void)
{
// Draw the display
ui_task();
}
2 changes: 2 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/cole/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SRC += ui.c
COMBO_ENABLE = yes
42 changes: 42 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/cole/ui.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2023 Cole Smith (@boardsource)
// SPDX-License-Identifier: GPL-2.0-or-later
#include <stdio.h>
#include "qp.h"
#include "qp_st7735.h"
#include "graphics/thintel15.qff.c"

static painter_device_t oled;
static painter_font_handle_t font;
void ui_init(void)
{
oled = qp_st7735_make_spi_device(128, 160, OLED_CS_PIN, OLED_DC_PIN, OLED_RST_PIN, 8, 0);
font = qp_load_font_mem(font_thintel15);
qp_init(oled, QP_ROTATION_0);
qp_rect(oled, 0, 0, 130, 162, 0, 0, 0, true);
qp_rect(oled, 20, 20, 108, 60, 55, 55, 55, true);
qp_rect(oled, 20, 80, 108, 120, 55, 55, 55, true);
qp_flush(oled);
}

void ui_task(void)
{
static const char *text = "Layer:";
int16_t width = qp_textwidth(font, text);
qp_drawtext(oled, 20, 140, font, text);

switch (get_highest_layer(layer_state))
{
case 0:
qp_drawtext(oled, (20 + width), 140, font, "QWERTY");
break;
case 1:
qp_drawtext(oled, (20 + width), 140, font, "SYMBOL");
break;
case 2:
qp_drawtext(oled, (20 + width), 140, font, "NUMBER");
break;
default:
qp_drawtext(oled, (20 + width), 140, font, "_PANIC_");
break;
}
}
44 changes: 44 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright 2022 @boardsource
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H

enum layers
{
_MAIN,
_RAISE,
_LOWER,
};

#define LOWER MO(_LOWER)
#define RAISE MO(_RAISE)
extern void ui_init(void);
extern void ui_task(void);

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_MAIN] = LAYOUT_ortho_4x12(
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_ESC, 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, KC_ENT,
KC_PIPE, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT),
[_RAISE] = LAYOUT_ortho_4x12(
KC_TILD, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_BSPC,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), KC_HOME, KC_END, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY),
[_LOWER] = LAYOUT_ortho_4x12(
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_BSPC,
KC_DEL, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS,
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, KC_PGUP, KC_PGDN, _______,
_______, _______, _______, _______, _______, _______, _______, _______, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY)};

void keyboard_post_init_user(void)
{
// Init the display
ui_init();
}

void housekeeping_task_user(void)
{
// Draw the display
ui_task();
}
1 change: 1 addition & 0 deletions keyboards/boardsource/equals/48/keymaps/default/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SRC += ui.c
43 changes: 43 additions & 0 deletions keyboards/boardsource/equals/48/keymaps/default/ui.c
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be moved to the keyboard level.

And it may help to add bool callback functions so that the behavior can be overwritten. For instance:

__attribute__((weak)) bool ui_init_user(void) { return true; }

void ui_init(void) {
    if (!ui_init_user()) { return; }
    // rest of normal code
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im sorry I dont quite understand. This was meant to provide an example to users of what could be done with the tft. By keyboard level do you mean move it to 48.c?

Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2022 @boardsource
// SPDX-License-Identifier: GPL-2.0-or-later
#include <stdio.h>
#include QMK_KEYBOARD_H
#include "qp.h"
#include "qp_st7735.h"
#include "graphics/thintel15.qff.c"

static painter_device_t oled;
static painter_font_handle_t font;
void ui_init(void)
{
oled = qp_st7735_make_spi_device(128, 160, OLED_CS_PIN, OLED_DC_PIN, OLED_RST_PIN, 8, 0);
font = qp_load_font_mem(font_thintel15);
qp_init(oled, QP_ROTATION_0);
qp_rect(oled, 0, 0, 130, 162, 0, 0, 0, true);
qp_rect(oled, 20, 20, 108, 60, 55, 55, 55, true);
qp_rect(oled, 20, 80, 108, 120, 55, 55, 55, true);
qp_flush(oled);
}

void ui_task(void)
{
static const char *text = "Layer:";
int16_t width = qp_textwidth(font, text);
qp_drawtext(oled, 20, 140, font, text);

switch (get_highest_layer(layer_state))
{
case 0:
qp_drawtext(oled, (20 + width), 140, font, "QWERTY");
break;
case 1:
qp_drawtext(oled, (20 + width), 140, font, "SYMBOL");
break;
case 2:
qp_drawtext(oled, (20 + width), 140, font, "NUMBER");
break;
default:
qp_drawtext(oled, (20 + width), 140, font, "_PANIC_");
break;
}
}
Loading