~ruther/qmk_firmware

59ea42099288dce99ec52f4517512124ae71caa0 — owlab-git 3 years ago 2c18dcc
[Keyboard] Add OwLab Spring (#15614)

A keyboards/owlab/spring/config.h => keyboards/owlab/spring/config.h +68 -0
@@ 0,0 1,68 @@
/* 
Copyright 2021 OwLab

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0x4F53  //0x4F53 for OwLab
#define PRODUCT_ID      0x5350  //0x514B SP for Spring
#define DEVICE_VER      0x0001 
#define MANUFACTURER    OwLab 
#define PRODUCT         Spring


/* key matrix size */
#define MATRIX_ROWS 5
#define MATRIX_COLS 15

/* Keyboard Matrix Assignments */
#define MATRIX_ROW_PINS { B0, B7, D0, D1, D2 }
#define MATRIX_COL_PINS { D5, D4, D6, D7, B4, B5, B6, C6, C7, F4, F7, F6, F5, F1, F0 }
/* COL2ROW, ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

/* NKRO */
#define FORCE_NKRO 

/* RGB Strip*/
#define RGB_DI_PIN D3
#ifdef RGB_DI_PIN
#    define RGBLIGHT_EFFECT_BREATHING
#    define RGBLIGHT_EFFECT_RAINBOW_MOOD
#    define RGBLIGHT_EFFECT_RAINBOW_SWIRL
#    define RGBLIGHT_EFFECT_SNAKE
#    define RGBLIGHT_EFFECT_KNIGHT
#    define RGBLIGHT_EFFECT_CHRISTMAS
#    define RGBLIGHT_EFFECT_STATIC_GRADIENT
#    define RGBLIGHT_EFFECT_RGB_TEST
#    define RGBLIGHT_EFFECT_ALTERNATING
#    define RGBLIGHT_EFFECT_TWINKLE
#    define RGBLED_NUM 8
#    define RGBLIGHT_HUE_STEP 8
#    define RGBLIGHT_SAT_STEP 8
#    define RGBLIGHT_VAL_STEP 10
#    define RGBLIGHT_LIMIT_VAL 255    
#    define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_SWIRL
#    define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL/2
#endif



A keyboards/owlab/spring/info.json => keyboards/owlab/spring/info.json +78 -0
@@ 0,0 1,78 @@
{
    "keyboard_name": "Spring",
    "url": "",
    "maintainer": "OwLab",
    "layouts": {
        "LAYOUT_spring": {
            "layout": [
                {"x":0.5, "y":0},
                {"x":1.75, "y":0},
                {"x":2.75, "y":0},
                {"x":3.75, "y":0},
                {"x":4.75, "y":0},
                {"x":5.75, "y":0},
                {"x":6.75, "y":0},
                {"x":7.75, "y":0},
                {"x":8.75, "y":0},
                {"x":9.75, "y":0},
                {"x":10.75, "y":0},
                {"x":11.75, "y":0},
                {"x":12.75, "y":0},
                {"x":13.75, "y":0},
                {"x":14.75, "y":0, "w":2},
                {"x":0.25, "y":1},
                {"x":1.5, "y":1, "w":1.5},
                {"x":3, "y":1},
                {"x":4, "y":1},
                {"x":5, "y":1},
                {"x":6, "y":1},
                {"x":7, "y":1},
                {"x":8, "y":1},
                {"x":9, "y":1},
                {"x":10, "y":1},
                {"x":11, "y":1},
                {"x":12, "y":1},
                {"x":13, "y":1},
                {"x":14, "y":1},
                {"x":15, "y":1, "w":1.5},
                {"x":0, "y":2},
                {"x":1.25, "y":2, "w":1.75},
                {"x":3, "y":2},
                {"x":4, "y":2},
                {"x":5, "y":2},
                {"x":6, "y":2},
                {"x":7, "y":2},
                {"x":8, "y":2},
                {"x":9, "y":2},
                {"x":10, "y":2},
                {"x":11, "y":2},
                {"x":12, "y":2},
                {"x":13, "y":2},
                {"x":14, "y":2, "w":2.25},
                {"x":1, "y":3, "w":2.25},
                {"x":3.25, "y":3},
                {"x":4.25, "y":3},
                {"x":5.25, "y":3},
                {"x":6.25, "y":3},
                {"x":7.25, "y":3},
                {"x":8.25, "y":3},
                {"x":9.25, "y":3},
                {"x":10.25, "y":3},
                {"x":11.25, "y":3},
                {"x":12.25, "y":3},
                {"x":13.25, "y":3},
                {"x":14.25, "y":3},
                {"x":15.25, "y":3, "w":1.75},
                {"x":1, "y":4, "w":1.25},
                {"x":2.25, "y":4, "w":1.25},
                {"x":4.75, "y":4, "w":1.25},
                {"x":6, "y":4, "w":2.25},
                {"x":8.25, "y":4, "w":2.75},
                {"x":11, "y":4, "w":1.25},
                {"x":13.25, "y":4},
		        {"x":14.25, "y":4},
                {"x":15.25, "y":4}
            ]
        }
    }
}
\ No newline at end of file

A keyboards/owlab/spring/keymaps/default/keymap.c => keyboards/owlab/spring/keymaps/default/keymap.c +38 -0
@@ 0,0 1,38 @@
/* 
Copyright 2021 qwertykeys

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H


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

	[0] = LAYOUT_spring(
		KC_ESC,  KC_GRV,  KC_1, KC_2, KC_3,   KC_4,   KC_5, KC_6, KC_7, KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, 
		KC_PGUP, 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_RBRC, KC_BSLS, 
		KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D,   KC_F,   KC_G, KC_H, KC_J, KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT, 
		         KC_LSFT, KC_Z, KC_X, KC_C,   KC_V,   KC_B, KC_B, KC_N, KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_UP,   KC_RSFT, 
		         KC_LCTL, KC_LGUI,    KC_LALT,  KC_SPC,  KC_SPC,    MO(1),                        KC_LEFT, KC_DOWN, KC_RGHT
	),

	[1] = LAYOUT_spring(
		KC_TRNS, KC_TRNS, KC_F1,   KC_F2,   KC_F3,    KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,    KC_F10,  KC_F11,  KC_F12,  RESET, 
		KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD,  KC_PSCR, KC_SLCK, KC_PAUS, 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_INS,  KC_HOME, KC_TRNS, 
		         KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_DEL,  KC_END,  KC_TRNS, KC_TRNS, 
		         KC_TRNS, KC_TRNS,          KC_TRNS, KC_TRNS,  KC_TRNS, KC_TRNS,                                      KC_TRNS, KC_TRNS, KC_TRNS
	)

};
\ No newline at end of file

A keyboards/owlab/spring/keymaps/via/keymap.c => keyboards/owlab/spring/keymaps/via/keymap.c +54 -0
@@ 0,0 1,54 @@
/* 
Copyright 2021 qwertykeys

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include QMK_KEYBOARD_H


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

	[0] = LAYOUT_spring(
		KC_ESC,  KC_GRV,  KC_1, KC_2, KC_3,   KC_4,   KC_5, KC_6, KC_7, KC_8,    KC_9,    KC_0,    KC_MINS, KC_EQL,  KC_BSPC, 
		KC_PGUP, 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_RBRC, KC_BSLS, 
		KC_PGDN, KC_CAPS, KC_A, KC_S, KC_D,   KC_F,   KC_G, KC_H, KC_J, KC_K,    KC_L,    KC_SCLN, KC_QUOT, KC_ENT, 
		         KC_LSFT, KC_Z, KC_X, KC_C,   KC_V,   KC_B, KC_B, KC_N, KC_M,    KC_COMM, KC_DOT,  KC_SLSH, KC_UP,   KC_RSFT, 
		         KC_LCTL, KC_LGUI,    KC_LALT,  KC_SPC,  KC_SPC,    MO(1),                        KC_LEFT, KC_DOWN, KC_RGHT
	),

	[1] = LAYOUT_spring(
		KC_TRNS, KC_TRNS, KC_F1,   KC_F2,   KC_F3,    KC_F4,   KC_F5,   KC_F6,   KC_F7,   KC_F8,   KC_F9,    KC_F10,  KC_F11,  KC_F12,  RESET, 
		KC_TRNS, KC_TRNS, RGB_TOG, RGB_MOD, RGB_RMOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD,  KC_PSCR, KC_SLCK, KC_PAUS, 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_INS,  KC_HOME, KC_TRNS, 
		         KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,  KC_DEL,  KC_END,  KC_TRNS, KC_TRNS, 
		         KC_TRNS, KC_TRNS,          KC_TRNS, KC_TRNS,  KC_TRNS, KC_TRNS,                                      KC_TRNS, KC_TRNS, KC_TRNS
	),

	[2] = LAYOUT_spring(
		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_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_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_TRNS, 
		         KC_TRNS, KC_TRNS,          KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,                                     KC_TRNS, KC_TRNS, KC_TRNS
	),

	[3] = LAYOUT_spring(
		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_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_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_TRNS, 
		         KC_TRNS, KC_TRNS,          KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS,                                     KC_TRNS, KC_TRNS, KC_TRNS
	)

};
\ No newline at end of file

A keyboards/owlab/spring/keymaps/via/rules.mk => keyboards/owlab/spring/keymaps/via/rules.mk +2 -0
@@ 0,0 1,2 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
\ No newline at end of file

A keyboards/owlab/spring/readme.md => keyboards/owlab/spring/readme.md +21 -0
@@ 0,0 1,21 @@
# Spring - PCB

![Spring](https://i.imgur.com/Ro1LhHh.png)

An Alice style board with arrowkeys made by OwLab, based on the Fate Arisu layout.

* Keyboard Maintainer: [OwLab](https://github.com/owlab-git)
* Hardware Supported: Spring PCB
* Hardware Availability: 

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

    make owlab/spring:default

Flashing example for this keyboard:

    make owlab/spring:default:flash

**Bootloader:** Press the physical reset button on the bottom side of the PCB (labeled SW1) or hold down ESC while plugging in the board.

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).

A keyboards/owlab/spring/rules.mk => keyboards/owlab/spring/rules.mk +18 -0
@@ 0,0 1,18 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
BOOTLOADER = atmel-dfu

# Build Options
#   change yes to no to disable
#
BOOTMAGIC_ENABLE = yes  # Enable Bootmagic Lite
MOUSEKEY_ENABLE = yes   # Mouse keys
EXTRAKEY_ENABLE = yes   # Audio control and System control
CONSOLE_ENABLE = no     # Console for debug
COMMAND_ENABLE = no     # Commands for debug and configuration
NKRO_ENABLE = yes       # Enable N-Key Rollover	
BACKLIGHT_ENABLE = no   # Enable keyboard backlight functionality
RGBLIGHT_ENABLE = yes   # Enable keyboard RGB underglow
AUDIO_ENABLE = no       # Audio output
\ No newline at end of file

A keyboards/owlab/spring/spring.c => keyboards/owlab/spring/spring.c +125 -0
@@ 0,0 1,125 @@
/* 
Copyright 2021 OwLab

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#include "spring.h"

enum caps_modes{
    CAPS_MODE_UPPER = 0, //UPPER CASE 
    CAPS_MODE_LOWER      //LOWER CASE
};

uint8_t caps_mode_index;
rgblight_config_t pre_rgb;
uint8_t dir_hue, dir_sat;

bool caps_in = false; 
uint32_t caps_timer; 




void switch_caps_mode(uint8_t mode){
       switch(mode){
            case CAPS_MODE_UPPER:
            dir_hue = 0;
            dir_sat = 240; 
            break;

            case CAPS_MODE_LOWER: 
            dir_hue = 88;
            dir_sat = 255;
            break;

            default:
            break;           
        }
        rgblight_sethsv_noeeprom(dir_hue,dir_sat,pre_rgb.val); 
    
}


void init_caps_mode(uint8_t mode){
    pre_rgb.mode = rgblight_get_mode();
    pre_rgb.hue = rgblight_get_hue();
    pre_rgb.sat = rgblight_get_sat();
    pre_rgb.val = rgblight_get_val();
    caps_in = true;

    rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);  
    switch_caps_mode(mode);

}


void set_caps_mode(uint8_t mode){
    if(caps_in == false){
       init_caps_mode(mode);
    }else{
        switch_caps_mode(mode);
    }
    caps_timer = timer_read32();
    
    
}


void matrix_scan_kb(void) {
	if(caps_in){
		if(timer_elapsed32(caps_timer) > 3000){
            rgblight_sethsv(pre_rgb.hue, pre_rgb.sat, pre_rgb.val);	
			rgblight_mode(pre_rgb.mode);
            caps_in = false;
		}
	}

    matrix_scan_user();
}


bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
  if (record->event.pressed) {
    switch(keycode) {
        case RGB_TOG:
        case RGB_MOD:
        case RGB_RMOD:
        case RGB_HUI:
        case RGB_HUD:
        case RGB_SAI:
        case RGB_SAD:
        case RGB_VAI:
        case RGB_VAD:
            if(caps_in){  
                return false;
            }  
        break;


        case KC_CAPS:
            if(IS_LED_ON(host_keyboard_leds(), USB_LED_CAPS_LOCK)){ 
                caps_mode_index = CAPS_MODE_LOWER;
            } else{
                caps_mode_index = CAPS_MODE_UPPER;
            }
            set_caps_mode(caps_mode_index); 
        break;

   
        default:
        break;
    }
  }
  return process_record_user(keycode, record);
}

A keyboards/owlab/spring/spring.h => keyboards/owlab/spring/spring.h +33 -0
@@ 0,0 1,33 @@
/* 
Copyright 2021 OwLab

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once
#include "quantum.h"

#define LAYOUT_spring( \
	K000, K001, K002, K003, K004, K005, K006, K007, K008, K009, K010, K011, K012, K013, K014, \
	K100, K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, K113, K114, \
	K200, K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, K213,       \
	      K300, K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, K313, \
	      K400, K401,       K402, K404, K405, K409,                         K411, K412, K413  \
) { \
	{ K000,  K001,  K002,  K003,  K004,  K005,  K006,  K007,  K008,  K009,  K010,  K011,  K012,  K013,  K014 }, \
	{ K100,  K101,  K102,  K103,  K104,  K105,  K106,  K107,  K108,  K109,  K110,  K111,  K112,  K113,  K114 }, \
	{ K200,  K201,  K202,  K203,  K204,  K205,  K206,  K207,  K208,  K209,  K210,  K211,  K212,  K213,  KC_NO }, \
	{ K300,  K301,  K302,  K303,  K304,  K305,  K306,  K307,  K308,  K309,  K310,  K311,  K312,  K313,  KC_NO }, \
	{ K400,  K401,  K402,  KC_NO, K404,  K405,  KC_NO, KC_NO, KC_NO, K409,  KC_NO, K411,  K412,  K413,  KC_NO }  \
}