~ruther/qmk_firmware

28c11ed34820860a2061cce264791a285a75d27a — Markus Knutsson 2 years ago d732b0b
Lotus58 glow (#20386)



Co-authored-by: jack <0x6a73@protonmail.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Pablo Martínez <58857054+elpekenin@users.noreply.github.com>
A keyboards/tweetydabird/lotus58/config.h => keyboards/tweetydabird/lotus58/config.h +13 -0
@@ 0,0 1,13 @@
// Copyright 2022 Markus Knutsson (@TweetyDaBird)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

// Options not yet fully implemented in info.json
#define RGBLIGHT_LIMIT_VAL 175
#define RGBLIGHT_DEFAULT_VAL ( RGBLIGHT_LIMIT_VAL / 2 )

#define SPLIT_HAND_PIN B5
#define SPLIT_LAYER_STATE_ENABLE
#define SPLIT_LED_STATE_ENABLE
#define SPLIT_OLED_ENABLE

A keyboards/tweetydabird/lotus58/elite_c/info.json => keyboards/tweetydabird/lotus58/elite_c/info.json +3 -0
@@ 0,0 1,3 @@
{
	"bootloader": "atmel-dfu"
}

A keyboards/tweetydabird/lotus58/elite_c/rules.mk => keyboards/tweetydabird/lotus58/elite_c/rules.mk +1 -0
@@ 0,0 1,1 @@
# This file intentionally left blank

A keyboards/tweetydabird/lotus58/info.json => keyboards/tweetydabird/lotus58/info.json +136 -0
@@ 0,0 1,136 @@
{
    "manufacturer": "Tweetys Wild Thinking",
    "keyboard_name": "Lotus 58 Glow (QMK)",
    "maintainer": "TweetyDaBird",
    "bootloader_instructions": "Short marked pads on PCB, or hold top-outer key when plugging in each hand.",
    "build": {
        "lto": true
    },
    "diode_direction": "COL2ROW",
    "encoder": {
        "rotary": [
            { "pin_a": "F5", "pin_b": "F4", "resolution": 2 }
        ]
    },
    "features": {
        "bootmagic": true,
        "command": false,
        "console": false,
        "extrakey": true,
        "mousekey": true,
        "nkro": true,
        "oled": true,
        "encoder": true,
        "rgblight": true,
        "split": true,
	    "tri_layer": true
    },
    "matrix_pins": {
        "cols": ["B1", "B2", "B3", "B6", "F7", "F6"],
        "rows": ["D4", "C6", "D7", "E6", "B4"]
    },
    "pin_compatible": "promicro",
    "processor": "atmega32u4",
    "rgblight": {
        "led_count": 70,
        "pin": "D3",
        "split": true,
        "split_count": [35, 35],
        "sleep": true
    },
    "split": {
		"bootmagic": {
            "matrix": [5, 0]
        },
		"enabled": true,
        "encoder": {
            "right": {
                "rotary": [
                    { "pin_a": "F4", "pin_b": "F5", "resolution": 2 }
                ]
            }
        },
        "soft_serial_pin": "D2",
        "transport": {
            "protocol": "serial",
            "sync_matrix_state": true,
            "sync_modifiers": true
        },
        "usb_detect": {
            "enabled": true
        }
    },
    "url": "https://lectronz.com/stores/tweetys-wild-thinking",
    "usb": {
        "vid": "0xFEED",
        "pid": "0x23B0",
        "device_version": "1.2.3",
        "force_nkro": true
    },
    "layouts": {
        "LAYOUT": {
            "layout": [
                { "label": "Esc", "matrix": [0, 0], "x": 0, "y": 0.75 },
                { "label": "1", "matrix": [0, 1], "x": 1, "y": 0.5 },
                { "label": "2", "matrix": [0, 2], "x": 2, "y": 0.25 },
                { "label": "3", "matrix": [0, 3], "x": 3, "y": 0 },
                { "label": "4", "matrix": [0, 4], "x": 4, "y": 0.25 },
                { "label": "5", "matrix": [0, 5], "x": 5, "y": 0.5 },
                { "label": "Left ENC", "matrix": [4, 0], "x": 6.25, "y": 0.75 },
                { "label": "Right ENC", "matrix": [9, 0], "x": 7.75, "y": 0.75 },
                { "label": "6", "matrix": [5, 5], "x": 9, "y": 0.5 },
                { "label": "7", "matrix": [5, 4], "x": 10, "y": 0.25 },
                { "label": "8", "matrix": [5, 3], "x": 11, "y": 0 },
                { "label": "9", "matrix": [5, 2], "x": 12, "y": 0.25 },
                { "label": "0", "matrix": [5, 1], "x": 13, "y": 0.5 },
                { "label": "-", "matrix": [5, 0], "x": 14, "y": 0.75 },
                { "label": "Tab", "matrix": [1, 0], "x": 0, "y": 1.75 },
                { "label": "Q", "matrix": [1, 1], "x": 1, "y": 1.5 },
                { "label": "W", "matrix": [1, 2], "x": 2, "y": 1.25 },
                { "label": "E", "matrix": [1, 3], "x": 3, "y": 1 },
                { "label": "R", "matrix": [1, 4], "x": 4, "y": 1.25 },
                { "label": "T", "matrix": [1, 5], "x": 5, "y": 1.5 },
                { "label": "Y", "matrix": [6, 5], "x": 9, "y": 1.5 },
                { "label": "U", "matrix": [6, 4], "x": 10, "y": 1.25 },
                { "label": "I", "matrix": [6, 3], "x": 11, "y": 1 },
                { "label": "O", "matrix": [6, 2], "x": 12, "y": 1.25 },
                { "label": "P", "matrix": [6, 1], "x": 13, "y": 1.5 },
                { "label": "{", "matrix": [6, 0], "x": 14, "y": 1.75 },
                { "label": "Caps Lock", "matrix": [2, 0], "x": 0, "y": 2.75 },
                { "label": "A", "matrix": [2, 1], "x": 1, "y": 2.5 },
                { "label": "S", "matrix": [2, 2], "x": 2, "y": 2.25 },
                { "label": "D", "matrix": [2, 3], "x": 3, "y": 2 },
                { "label": "F", "matrix": [2, 4], "x": 4, "y": 2.25 },
                { "label": "G", "matrix": [2, 5], "x": 5, "y": 2.5 },
                { "label": "H", "matrix": [7, 5], "x": 9, "y": 2.5 },
                { "label": "J", "matrix": [7, 4], "x": 10, "y": 2.25 },
                { "label": "K", "matrix": [7, 3], "x": 11, "y": 2 },
                { "label": "L", "matrix": [7, 2], "x": 12, "y": 2.25 },
                { "label": ":", "matrix": [7, 1], "x": 13, "y": 2.5 },
                { "label": "\"", "matrix": [7, 0], "x": 14, "y": 2.75 },
                { "label": "L_Ctrl", "matrix": [3, 0], "x": 0, "y": 3.75 },
                { "label": "Z", "matrix": [3, 1], "x": 1, "y": 3.5 },
                { "label": "X", "matrix": [3, 2], "x": 2, "y": 3.25 },
                { "label": "C", "matrix": [3, 3], "x": 3, "y": 3 },
                { "label": "V", "matrix": [3, 4], "x": 4, "y": 3.25 },
                { "label": "B", "matrix": [3, 5], "x": 5, "y": 3.5 },
                { "label": "Down", "matrix": [4, 5], "x": 6, "y": 3 },
                { "label": "Up", "matrix": [9, 5], "x": 8, "y": 3 },
                { "label": "N", "matrix": [8, 5], "x": 9, "y": 3.5 },
                { "label": "M", "matrix": [8, 4], "x": 10, "y": 3.25 },
                { "label": ",", "matrix": [8, 3], "x": 11, "y": 3 },
                { "label": ".", "matrix": [8, 2], "x": 12, "y": 3.25 },
                { "label": "?", "matrix": [8, 1], "x": 13, "y": 3.5 },
                { "label": "R_Ctrl", "matrix": [8, 0], "x": 14, "y": 3.75 },
                { "label": "Win", "matrix": [4, 1], "x": 2.5, "y": 4.25 },
                { "label": "Lower", "matrix": [4, 2], "x": 3.5, "y": 4.25 },
                { "label": "Alt", "matrix": [4, 3], "x": 4.5, "y": 4.5 },
                { "label": "Space", "matrix": [4, 4], "x": 6, "y": 4.25, "h": 1.25 },
                { "label": "Enter", "matrix": [9, 4], "x": 8, "y": 4.25, "h": 1.25 },
                { "label": "AltGr", "matrix": [9, 3], "x": 9.5, "y": 4.5 },
                { "label": "Raise", "matrix": [9, 2], "x": 10.5, "y": 4.25 },
                { "label": "BckSp", "matrix": [9, 1], "x": 11.5, "y": 4.25 }
            ]
        }
    }
}

A keyboards/tweetydabird/lotus58/keymaps/default/keymap.c => keyboards/tweetydabird/lotus58/keymaps/default/keymap.c +86 -0
@@ 0,0 1,86 @@
// Copyright 2022 Markus Knutsson (@TweetyDaBird)
// SPDX-License-Identifier: GPL-2.0-or-later
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
    [0] = LAYOUT(
      KC_ESC,    KC_1,    KC_2,    KC_3,    KC_4,    KC_5,    KC_MPLY,        KC_MPLY, KC_6,    KC_7,    KC_8,    KC_9,    KC_0,    KC_MINS,
      KC_TAB,    KC_Q,    KC_W,    KC_E,    KC_R,    KC_T,                             KC_Y,    KC_U,    KC_I,    KC_O,    KC_P,    KC_LBRC,
      KC_CAPS,   KC_A,    KC_S,    KC_D,    KC_F,    KC_G,                             KC_H,    KC_J,    KC_K,    KC_L,    KC_SCLN, KC_QUOT,
LCTL_T(KC_LEFT), KC_Z,    KC_X,    KC_C,    KC_V,    KC_B,    KC_DOWN,        KC_UP,   KC_N,    KC_M,    KC_COMM, KC_DOT,  KC_SLSH, RCTL_T(KC_RGHT),
                                   KC_LGUI, TG(2),   KC_LALT, LSFT_T(KC_SPC), RSFT_T(KC_ENT),   KC_RALT, TG(1), RGUI_T(KC_BSPC)
    ),

    [1] = LAYOUT(
        _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   _______,        _______, KC_CIRC, KC_KP_7, KC_KP_8, KC_KP_9, XXXXXXX, XXXXXXX,
        _______, XXXXXXX, KC_UP,   XXXXXXX, XXXXXXX, XXXXXXX,                          KC_HASH, KC_KP_4, KC_KP_5, KC_KP_6, XXXXXXX, XXXXXXX,
        XXXXXXX, KC_LEFT, KC_DOWN, KC_RIGHT,KC_LBRC, KC_RBRC,                          KC_AMPR, KC_KP_1, KC_KP_2, KC_KP_3, XXXXXXX, XXXXXXX,
        _______, XXXXXXX, KC_PAST, KC_PPLS, KC_PSLS, KC_EQL,  _______,        _______, KC_DLR,  KC_KP_0, KC_PDOT, KC_COLN, KC_PMNS, _______,
                                   _______, _______, _______, _______,        _______, _______, _______, _______ 
    ),

    [2] = LAYOUT(
        _______, KC_F1,   KC_F2,   KC_F3,   KC_F4,   KC_F5,   _______,        _______, KC_F6,   KC_F7,   KC_F8,   KC_F9,   KC_F10,  _______,
        _______, _______, _______, _______, _______, _______,                          _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______, _______,                          _______, _______, _______, _______, _______, _______,
        _______, _______, _______, _______, _______, _______, _______,        _______, _______, _______, _______, _______, _______, _______,
                                            _______, _______, _______,        _______, _______, _______, _______, _______
    ),

    [3] = LAYOUT(
        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, _______,        _______, XXXXXXX, XXXXXXX, XXXXXXX, RGB_MOD, RGB_SAI, RGB_TOG,
        QK_BOOT, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,                          XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD,RGB_SAD, RGB_M_P,
        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, KC_CAPS,                          XXXXXXX, XXXXXXX, XXXXXXX, RGB_HUI, RGB_VAI, RGB_M_B,
        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,        XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_HUD, RGB_VAD, RGB_M_R,
                                   _______, _______, _______, _______,        _______, _______, _______, _______ 
    )
};

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
    [0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
    [1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
    [2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
    [3] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }
};
#endif

#ifdef OLED_ENABLE
static void print_status_narrow(void) {
    // Create OLED content
    oled_write_P(PSTR("\n"), false);
    oled_write_P(PSTR(""), false);
    oled_write_P(PSTR("Lotus -58-"), false);
    oled_write_P(PSTR("\n"), false);

    // Print current layer
    oled_write_P(PSTR("Layer"), false);
    switch (get_highest_layer(layer_state)) {
        case 0:
            oled_write_P(PSTR("-Base\n"), false);
            break;
        case 1:
            oled_write_P(PSTR("-Num \n"), false);
            break;
        case 2:
            oled_write_P(PSTR("-Func\n"), false);
            break;
        case 3:
            oled_write_P(PSTR("-Sys \n"), false);
            break;
        default:
            oled_write_P(PSTR("Undef"), false);
    }
    
    oled_write_P(PSTR("\n"), false);
    led_t led_usb_state = host_keyboard_led_state();
    oled_write_ln_P(PSTR("Caps- lock"), led_usb_state.caps_lock);
    
}

bool oled_task_user(void) {
    // Render the OLED
    print_status_narrow();
    return false;
}
#endif
\ No newline at end of file

A keyboards/tweetydabird/lotus58/keymaps/default/rules.mk => keyboards/tweetydabird/lotus58/keymaps/default/rules.mk +2 -0
@@ 0,0 1,2 @@
ENCODER_MAP_ENABLE = yes
AUTO_SHIFT_ENABLE = yes

A keyboards/tweetydabird/lotus58/lotus58.c => keyboards/tweetydabird/lotus58/lotus58.c +29 -0
@@ 0,0 1,29 @@
// Copyright 2022 Markus Knutsson (@TweetyDaBird)
// SPDX-License-Identifier: GPL-2.0-or-later

#include "quantum.h"

#ifdef OLED_ENABLE

oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
    return OLED_ROTATION_90;
}

void render_logo(void) {
    // QMK Logo
    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(qmk_logo, false);
}

bool oled_task_kb(void) {
    if (!oled_task_user()) {
        return false;
    }
    render_logo();
    return false;
}
#endif
\ No newline at end of file

A keyboards/tweetydabird/lotus58/nanoboot/rules.mk => keyboards/tweetydabird/lotus58/nanoboot/rules.mk +2 -0
@@ 0,0 1,2 @@
BOOTLOADER = qmk-hid
BOOTLOADER_SIZE = 512

A keyboards/tweetydabird/lotus58/promicro/info.json => keyboards/tweetydabird/lotus58/promicro/info.json +3 -0
@@ 0,0 1,3 @@
{
    "bootloader": "caterina"
}

A keyboards/tweetydabird/lotus58/promicro/rules.mk => keyboards/tweetydabird/lotus58/promicro/rules.mk +1 -0
@@ 0,0 1,1 @@
# This file intentionally left blank

A keyboards/tweetydabird/lotus58/readme.md => keyboards/tweetydabird/lotus58/readme.md +37 -0
@@ 0,0 1,37 @@
# Lotus 58 Glow

![lotus58](https://i.imgur.com/WWgpp0Sh.jpeg)

* Lotus 58 Glow is a fully programmable 58-key split, ortho-columnar keyboard with a 4x6 main matrix and 4+1 thumb-keys per hand. Optional support for one OLED screen per hand/side showing information such as active layer, CapsLock/NumLock etc. as well as one Rotary Encoder per hand, with optional placement.

* Keyboard Maintainer: [TweetyDaBird](https://github.com/TweetyDaBird)
* Hardware Supported: *Lotus 58 Glow v1.11 - 1.2x PCB, Pro Micro or pin-compatible*
* Hardware Availability: [Lectronz Store](https://lectronz.com/stores/tweetys-wild-thinking)
* Hardware Design: [GitHub](https://github.com/TweetyDaBird/Lotus58)


#### This keyboard firmware contains three different versions, all for the same PCB/hardware, but depending on your choice of controller/bootloader. 


* promicro - This uses the default Caterina bootloader.
* elite_c - This uses the Atmel-DFU bootloader.
* nanoBoot - A tiny 512 byte bootloader giving far more usable memory for features (can be used on both Elite C and Pro Micro).


Make example for this keyboard (after setting up your build environment):

    make tweetydabird/lotus58/promicro:default

Flashing example for this keyboard:

    make tweetydabird/lotus58/elite_c:default:flash

See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

## Bootloader

Enter the bootloader in 3 ways:

* **Bootmagic reset**: Hold down the top outer key for each hand as it is plugged in
* **Physical reset**: Briefly short the marked pads on PCB
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if mapped (not in default keymap)