Remove obvious user keymaps, keyboards/{d,e,f}* edition. (#22695)
				
					
				
			This commit is contained in:
		
							parent
							
								
									d235352504
								
							
						
					
					
						commit
						a1c8b1ebf7
					
				
					 480 changed files with 0 additions and 33279 deletions
				
			
		| 
						 | 
				
			
			@ -1,22 +0,0 @@
 | 
			
		|||
/* Copyright 2019-2020 DMQ Design
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
#define RGBLIGHT_EFFECT_RAINBOW_MOOD
 | 
			
		||||
#define RGBLIGHT_HUE_STEP 8
 | 
			
		||||
#define MIDI_ADVANCED
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1,152 +0,0 @@
 | 
			
		|||
/* Copyright 2019-2020 DMQ Design
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
#include "midi.h"
 | 
			
		||||
#include "qmk_midi.h"
 | 
			
		||||
 | 
			
		||||
enum layers
 | 
			
		||||
{
 | 
			
		||||
  _BL,
 | 
			
		||||
  _FL,
 | 
			
		||||
  _TL
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
uint8_t currentLayer;
 | 
			
		||||
 | 
			
		||||
//The below layers are intentionally empty in order to give a good starting point for how to configure multiple layers.
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
    [_BL] = LAYOUT(/* Base */
 | 
			
		||||
                KC_KP_7, KC_KP_8, KC_KP_9, TO(_BL),
 | 
			
		||||
                KC_KP_4, KC_KP_5, KC_KP_6, TO(_FL),
 | 
			
		||||
                KC_KP_1, KC_KP_2, KC_KP_3, TO(_TL),
 | 
			
		||||
                KC_KP_0, RGB_TOG, RGB_MOD
 | 
			
		||||
                ),
 | 
			
		||||
 | 
			
		||||
    [_FL] = LAYOUT(/* Base */
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_MS_BTN1, KC_NO, KC_MS_BTN2
 | 
			
		||||
                ),
 | 
			
		||||
 | 
			
		||||
    [_TL] = LAYOUT(/* Base */
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO
 | 
			
		||||
                )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool encoder_update_user(uint8_t index, bool clockwise) {
 | 
			
		||||
    if (index == 0) { /* First encoder */
 | 
			
		||||
        switch (currentLayer) {     //break each encoder update into a switch statement for the current layer
 | 
			
		||||
            case _BL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    rgblight_increase_hue();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgblight_decrease_hue();
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _FL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x14, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x15, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _TL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1A, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1B, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (index == 1) { /* Second encoder */
 | 
			
		||||
        switch (currentLayer) {
 | 
			
		||||
            case _BL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    tap_code(KC_VOLU);
 | 
			
		||||
                } else {
 | 
			
		||||
                    tap_code(KC_VOLD);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _FL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x16, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x17, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _TL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1C, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1D, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (index == 2) { /* Third encoder */
 | 
			
		||||
        switch (currentLayer) {
 | 
			
		||||
            case _BL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    rgblight_increase_val();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgblight_decrease_val();
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _FL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x18, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x19, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _TL:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1E, 1);
 | 
			
		||||
                } else {
 | 
			
		||||
                    midi_send_cc(&midi_device, 0, 0x1F, 1);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
 | 
			
		||||
    currentLayer = get_highest_layer(state);
 | 
			
		||||
 | 
			
		||||
    switch (currentLayer) {
 | 
			
		||||
        case _BL:
 | 
			
		||||
            setrgb(RGB_WHITE, &led[0]); //Set the top LED to white for the bottom layer
 | 
			
		||||
            setrgb(0, 0, 0, &led[1]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[2]);
 | 
			
		||||
            break;
 | 
			
		||||
        case _FL:
 | 
			
		||||
            setrgb(0, 0, 0, &led[0]); //Set the middle LED to white for the middle layer
 | 
			
		||||
            setrgb(RGB_WHITE, &led[1]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[2]);
 | 
			
		||||
            break;
 | 
			
		||||
        case _TL:
 | 
			
		||||
            setrgb(0, 0, 0, &led[0]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[1]);
 | 
			
		||||
            setrgb(RGB_WHITE, &led[2]); //Set the bottom LED to white for the top layer
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
    rgblight_set();
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
# This keymap is intended to demonstrate how to implement different encoder functions dependent on layer, and on how to implement MIDI control with encoders.
 | 
			
		||||
| 
						 | 
				
			
			@ -1,34 +0,0 @@
 | 
			
		|||
/* Copyright 2019-2020 DMQ Design
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
#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 RGBLIGHT_HUE_STEP 8
 | 
			
		||||
 | 
			
		||||
// Use one or the other, determines the orientation of
 | 
			
		||||
// the OLED display
 | 
			
		||||
// #define RIGHT_HAND
 | 
			
		||||
#define LEFT_HAND
 | 
			
		||||
| 
						 | 
				
			
			@ -1,249 +0,0 @@
 | 
			
		|||
/* Copyright 2019-2020 DMQ Design
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
enum layers {
 | 
			
		||||
    _NUMPAD,
 | 
			
		||||
    _RGB,
 | 
			
		||||
    _MACRO
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
    HELLO_WORLD = SAFE_RANGE,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//The below layers are intentionally empty in order to give a good starting point for how to configure multiple layers.
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
    [_NUMPAD] = LAYOUT(/* Base */
 | 
			
		||||
                KC_7, KC_8, KC_9, TO(_NUMPAD),
 | 
			
		||||
                KC_4, KC_5, KC_6, TO(_RGB),
 | 
			
		||||
                KC_1, KC_2, KC_3, TO(_MACRO),
 | 
			
		||||
                KC_0, KC_DOT, KC_ENTER
 | 
			
		||||
                ),
 | 
			
		||||
 | 
			
		||||
    [_RGB] = LAYOUT(/* Base */
 | 
			
		||||
                RGB_HUI,  RGB_SAI, RGB_VAI, KC_TRNS,
 | 
			
		||||
                RGB_HUD,  RGB_SAD, RGB_VAD, KC_TRNS,
 | 
			
		||||
                KC_NO,    KC_NO,   KC_NO,   KC_TRNS,
 | 
			
		||||
                RGB_RMOD, RGB_TOG, RGB_MOD
 | 
			
		||||
                ),
 | 
			
		||||
 | 
			
		||||
    [_MACRO] = LAYOUT(/* Base */
 | 
			
		||||
                HELLO_WORLD, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO, KC_TRNS,
 | 
			
		||||
                KC_NO, KC_NO, KC_NO
 | 
			
		||||
                )
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        case HELLO_WORLD:
 | 
			
		||||
            if (record->event.pressed) {
 | 
			
		||||
                SEND_STRING("Hello, world!");
 | 
			
		||||
            }
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool encoder_update_user(uint8_t index, bool clockwise) {
 | 
			
		||||
    if (index == 0) { /* First encoder */
 | 
			
		||||
        switch (get_highest_layer(layer_state)) {     //break each encoder update into a switch statement for the current layer
 | 
			
		||||
            case _NUMPAD:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    tap_code(KC_DOWN);
 | 
			
		||||
                } else {
 | 
			
		||||
                    tap_code(KC_UP);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _RGB:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    rgblight_increase_hue();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgblight_decrease_hue();
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _MACRO:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    break;
 | 
			
		||||
                } else {
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (index == 1) { /* Second encoder */
 | 
			
		||||
        switch (get_highest_layer(layer_state)) {
 | 
			
		||||
            case _NUMPAD:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    tap_code(KC_PGDN);
 | 
			
		||||
                } else {
 | 
			
		||||
                    tap_code(KC_PGUP);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _RGB:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    rgblight_increase_sat();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgblight_decrease_sat();
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _MACRO:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    break;
 | 
			
		||||
                } else {
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    } else if (index == 2) { /* Third encoder */
 | 
			
		||||
        switch (get_highest_layer(layer_state)) {
 | 
			
		||||
            case _NUMPAD:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    tap_code(KC_VOLU);
 | 
			
		||||
                } else {
 | 
			
		||||
                    tap_code(KC_VOLD);
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _RGB:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    rgblight_increase_val();
 | 
			
		||||
                } else {
 | 
			
		||||
                    rgblight_decrease_val();
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
            case _MACRO:
 | 
			
		||||
                if (clockwise) {
 | 
			
		||||
                    break;
 | 
			
		||||
                } else {
 | 
			
		||||
                    break;
 | 
			
		||||
                }
 | 
			
		||||
                break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_user(layer_state_t state) { //This will run every time the layer is updated
 | 
			
		||||
    switch (get_highest_layer(state)) {
 | 
			
		||||
        case _NUMPAD:
 | 
			
		||||
            setrgb(RGB_WHITE, &led[0]); //Set the top LED to white for the bottom layer
 | 
			
		||||
            setrgb(0, 0, 0, &led[1]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[2]);
 | 
			
		||||
            break;
 | 
			
		||||
        case _RGB:
 | 
			
		||||
            setrgb(0, 0, 0, &led[0]); //Set the middle LED to white for the middle layer
 | 
			
		||||
            setrgb(RGB_WHITE, &led[1]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[2]);
 | 
			
		||||
            break;
 | 
			
		||||
        case _MACRO:
 | 
			
		||||
            setrgb(0, 0, 0, &led[0]);
 | 
			
		||||
            setrgb(0, 0, 0, &led[1]);
 | 
			
		||||
            setrgb(RGB_WHITE, &led[2]); //Set the bottom LED to white for the top layer
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
    rgblight_set();
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef OLED_ENABLE
 | 
			
		||||
 | 
			
		||||
static const char *ANIMATION_NAMES[] = {
 | 
			
		||||
	"unknown",
 | 
			
		||||
	"static",
 | 
			
		||||
	"breathing I",
 | 
			
		||||
	"breathing II",
 | 
			
		||||
	"breathing III",
 | 
			
		||||
	"breathing IV",
 | 
			
		||||
	"rainbow mood I",
 | 
			
		||||
	"rainbow mood II",
 | 
			
		||||
	"rainbow mood III",
 | 
			
		||||
	"rainbow swirl I",
 | 
			
		||||
	"rainbow swirl II",
 | 
			
		||||
	"rainbow swirl III",
 | 
			
		||||
	"rainbow swirl IV",
 | 
			
		||||
	"rainbow swirl V",
 | 
			
		||||
	"rainbow swirl VI",
 | 
			
		||||
	"snake I",
 | 
			
		||||
	"snake II",
 | 
			
		||||
	"snake III",
 | 
			
		||||
	"snake IV",
 | 
			
		||||
	"snake V",
 | 
			
		||||
	"snake VI",
 | 
			
		||||
	"knight I",
 | 
			
		||||
	"knight II",
 | 
			
		||||
	"knight III",
 | 
			
		||||
	"christmas",
 | 
			
		||||
	"static gradient I",
 | 
			
		||||
	"static gradient II",
 | 
			
		||||
	"static gradient III",
 | 
			
		||||
	"static gradient IV",
 | 
			
		||||
	"static gradient V",
 | 
			
		||||
	"static gradient VI",
 | 
			
		||||
	"static gradient VII",
 | 
			
		||||
	"static gradient VIII",
 | 
			
		||||
	"static gradient IX",
 | 
			
		||||
	"static gradient X",
 | 
			
		||||
	"rgb test",
 | 
			
		||||
	"alternating",
 | 
			
		||||
	"twinkle I",
 | 
			
		||||
	"twinkle II",
 | 
			
		||||
	"twinkle III",
 | 
			
		||||
	"twinkle IV",
 | 
			
		||||
	"twinkle V",
 | 
			
		||||
	"twinkle VI"
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void rgblight_get_mode_name(uint8_t mode, size_t bufsize, char *buf) {
 | 
			
		||||
    snprintf(buf, bufsize, "%-25s", ANIMATION_NAMES[mode]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
oled_rotation_t oled_init_user(oled_rotation_t rotation) {
 | 
			
		||||
#ifdef LEFT_HAND
 | 
			
		||||
    return OLED_ROTATION_180;
 | 
			
		||||
#else
 | 
			
		||||
    return OLED_ROTATION_0;
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool oled_task_user(void) {
 | 
			
		||||
    // Host Keyboard Layer Status
 | 
			
		||||
    oled_write_P(PSTR("Layer: "), false);
 | 
			
		||||
 | 
			
		||||
    switch (get_highest_layer(layer_state)) {
 | 
			
		||||
        case _NUMPAD:
 | 
			
		||||
            oled_write_P(PSTR("Numpad\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case _RGB:
 | 
			
		||||
            oled_write_P(PSTR("RGB\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        case _MACRO:
 | 
			
		||||
            oled_write_P(PSTR("Macro\n"), false);
 | 
			
		||||
            break;
 | 
			
		||||
        default:
 | 
			
		||||
            // Or use the write_ln shortcut over adding '\n' to the end of your string
 | 
			
		||||
            oled_write_ln_P(PSTR("Undefined"), false);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    static char rgb_mode_name[30];
 | 
			
		||||
    rgblight_get_mode_name(rgblight_get_mode(), sizeof(rgb_mode_name), rgb_mode_name);
 | 
			
		||||
 | 
			
		||||
    oled_write_P(PSTR("Mode: "), false);
 | 
			
		||||
    oled_write_ln(rgb_mode_name, false);
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
# Keymap for Spin
 | 
			
		||||
 | 
			
		||||
* Encoder button push changes layers
 | 
			
		||||
* First layer is a number pad
 | 
			
		||||
* Second layer is RGB control layer
 | 
			
		||||
* Third layer is macro layer
 | 
			
		||||
* OLED support
 | 
			
		||||
| 
						 | 
				
			
			@ -1,3 +0,0 @@
 | 
			
		|||
OLED_ENABLE = yes
 | 
			
		||||
MOUSEKEY_ENABLE    = no
 | 
			
		||||
MIDI_ENABLE        = no
 | 
			
		||||
| 
						 | 
				
			
			@ -1,41 +0,0 @@
 | 
			
		|||
/* Copyright 2019-2020 DMQ Design
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
#define RGBLIGHT_HUE_STEP 8
 | 
			
		||||
 | 
			
		||||
// place overrides here
 | 
			
		||||
 | 
			
		||||
#define NO_ACTION_ONESHOT
 | 
			
		||||
#undef LOCKING_SUPPORT_ENABLE
 | 
			
		||||
 | 
			
		||||
#define LAYER_STATE_8BIT
 | 
			
		||||
#define MAX_LAYER 5
 | 
			
		||||
 | 
			
		||||
#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_STATIC_GRADIENT
 | 
			
		||||
#define RGBLIGHT_EFFECT_ALTERNATING
 | 
			
		||||
#define RGBLIGHT_EFFECT_TWINKLE
 | 
			
		||||
 | 
			
		||||
#define RGBLIGHT_SLEEP
 | 
			
		||||
#define RGBLIGHT_LAYERS
 | 
			
		||||
#define RGBLIGHT_LAYER_BLINK
 | 
			
		||||
#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
 | 
			
		||||
| 
						 | 
				
			
			@ -1,221 +0,0 @@
 | 
			
		|||
/* Copyright 2020 Joshua Moses Diamond
 | 
			
		||||
 *
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
#include "version.h"
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
 | 
			
		||||
#define RGB_LAYER_ACK_DURATION 500
 | 
			
		||||
 | 
			
		||||
enum layers { _MACRO, _NUMPAD, _CURSOR, _RGB, _FN };
 | 
			
		||||
 | 
			
		||||
enum layer_base {
 | 
			
		||||
    LAYER_BASE     = _MACRO,
 | 
			
		||||
    LAYER_BASE_END = _FN + 1,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum custom_keycodes {
 | 
			
		||||
    HELLO = SAFE_RANGE,
 | 
			
		||||
    CH_SUSP,  // Suspend
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// clang-format off
 | 
			
		||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
 | 
			
		||||
    [_MACRO] = LAYOUT(
 | 
			
		||||
        A(S(KC_N)),    HELLO,         CH_SUSP,       TO(_MACRO),
 | 
			
		||||
        KC_MPRV,       KC_MPLY,       KC_MNXT,       TO(_NUMPAD),
 | 
			
		||||
        C(A(KC_COMM)), KC_F5,         C(A(KC_DOT)),  TO(_RGB),
 | 
			
		||||
        MO(_FN),       KC_ASST,       KC_CPNL),
 | 
			
		||||
 | 
			
		||||
    [_NUMPAD] = LAYOUT(
 | 
			
		||||
        KC_KP_7,   KC_KP_8,   KC_KP_9,   KC_TRNS,
 | 
			
		||||
        KC_KP_4,   KC_KP_5,   KC_KP_6,   TO(_CURSOR),
 | 
			
		||||
        KC_KP_1,   KC_KP_2,   KC_KP_3,   KC_TRNS,
 | 
			
		||||
        KC_KP_0,   KC_PDOT,   KC_PENT),
 | 
			
		||||
 | 
			
		||||
    [_CURSOR] = LAYOUT(
 | 
			
		||||
        KC_HOME,   KC_UP,     KC_PGUP,   KC_TRNS,
 | 
			
		||||
        KC_LEFT,   KC_NO,     KC_RIGHT,  TO(_NUMPAD),
 | 
			
		||||
        KC_END,    KC_DOWN,   KC_PGDN,   KC_TRNS,
 | 
			
		||||
        KC_INS,    KC_DEL,    KC_PENT),
 | 
			
		||||
 | 
			
		||||
    [_RGB] = LAYOUT(
 | 
			
		||||
        RGB_HUI,   RGB_SAI,   RGB_VAI,   KC_TRNS,
 | 
			
		||||
        RGB_HUD,   RGB_SAD,   RGB_VAD,   TO(_NUMPAD),
 | 
			
		||||
        RGB_SPD,   RGB_SPI,   KC_NO,     KC_TRNS,
 | 
			
		||||
        RGB_RMOD,  RGB_TOG,   RGB_MOD),
 | 
			
		||||
 | 
			
		||||
    [_FN] = LAYOUT(
 | 
			
		||||
        KC_NO,     DB_TOGG,   QK_BOOT,   KC_TRNS,
 | 
			
		||||
        KC_NO,     KC_NO,     EE_CLR,    KC_TRNS,
 | 
			
		||||
        KC_NO,     KC_NO,     KC_NO,     KC_TRNS,
 | 
			
		||||
        KC_TRNS,   KC_NO,     KC_NO),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
 | 
			
		||||
    [_MACRO]  = { ENCODER_CCW_CW(KC_BRID,       KC_BRIU),      ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD,    KC_VOLU) },
 | 
			
		||||
    [_NUMPAD] = { ENCODER_CCW_CW(KC_BRID,       KC_BRIU),      ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD,    KC_VOLU) },
 | 
			
		||||
    [_CURSOR] = { ENCODER_CCW_CW(KC_BRID,       KC_BRIU),      ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD,    KC_VOLU) },
 | 
			
		||||
    [_RGB]    = { ENCODER_CCW_CW(RGB_HUD,       RGB_HUI     ), ENCODER_CCW_CW(RGB_SAD,    RGB_SAI  ), ENCODER_CCW_CW(RGB_VAD,    RGB_VAI) },
 | 
			
		||||
    [_FN]     = { ENCODER_CCW_CW(KC_BRID,       KC_BRIU),      ENCODER_CCW_CW(C(KC_MINS), C(KC_EQL)), ENCODER_CCW_CW(KC_VOLD,    KC_VOLU) },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// clang-format on
 | 
			
		||||
 | 
			
		||||
typedef enum layer_ack {
 | 
			
		||||
    ACK_NO = 0,
 | 
			
		||||
    ACK_YES,
 | 
			
		||||
    ACK_MEH,
 | 
			
		||||
} layer_ack_t;
 | 
			
		||||
 | 
			
		||||
#define LAYER_OFFSET 0
 | 
			
		||||
const rgblight_segment_t PROGMEM _macro_layer[]  = RGBLIGHT_LAYER_SEGMENTS({0, 1, HSV_TEAL});
 | 
			
		||||
const rgblight_segment_t PROGMEM _numpad_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_TEAL});
 | 
			
		||||
const rgblight_segment_t PROGMEM _cursor_layer[] = RGBLIGHT_LAYER_SEGMENTS({1, 1, HSV_BLUE});
 | 
			
		||||
const rgblight_segment_t PROGMEM _rgb_layer[]    = RGBLIGHT_LAYER_SEGMENTS({2, 1, HSV_TEAL});
 | 
			
		||||
const rgblight_segment_t PROGMEM _fn_layer[]     = RGBLIGHT_LAYER_SEGMENTS({0, 3, HSV_PURPLE});
 | 
			
		||||
 | 
			
		||||
#define ACK_OFFSET 4
 | 
			
		||||
const rgblight_segment_t PROGMEM _no_layer[]  = RGBLIGHT_LAYER_SEGMENTS({0, 3, HSV_RED});
 | 
			
		||||
const rgblight_segment_t PROGMEM _yes_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 3, HSV_GREEN});
 | 
			
		||||
const rgblight_segment_t PROGMEM _meh_layer[] = RGBLIGHT_LAYER_SEGMENTS({0, 3, HSV_YELLOW});
 | 
			
		||||
 | 
			
		||||
// clang-format on
 | 
			
		||||
const rgblight_segment_t *const PROGMEM _rgb_layers[] = {
 | 
			
		||||
    [LAYER_OFFSET + 0] = _macro_layer,
 | 
			
		||||
    [LAYER_OFFSET + 1] = _numpad_layer,
 | 
			
		||||
    [LAYER_OFFSET + 2] = _cursor_layer,
 | 
			
		||||
    [LAYER_OFFSET + 3] = _rgb_layer,
 | 
			
		||||
    [LAYER_OFFSET + 4] = _fn_layer,
 | 
			
		||||
 | 
			
		||||
    [ACK_OFFSET + ACK_NO] = _no_layer,
 | 
			
		||||
    [ACK_OFFSET + ACK_YES] = _yes_layer,
 | 
			
		||||
    [ACK_OFFSET + ACK_MEH] = _meh_layer,
 | 
			
		||||
 | 
			
		||||
    [ACK_OFFSET + ACK_MEH + 1] = NULL
 | 
			
		||||
};
 | 
			
		||||
// clang-format off
 | 
			
		||||
 | 
			
		||||
const uint8_t PROGMEM _n_rgb_layers = ARRAY_SIZE(_rgb_layers) - 1;
 | 
			
		||||
 | 
			
		||||
void clear_rgb_layers(void) {
 | 
			
		||||
    dprint("clear_rgb_layers()\n");
 | 
			
		||||
    for (uint8_t i = 0; i < _n_rgb_layers; i++) {
 | 
			
		||||
        rgblight_set_layer_state(i, false);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void do_rgb_layers(layer_state_t state, uint8_t start, uint8_t end) {
 | 
			
		||||
    dprintf("start=%u, end=%u, LAYER_OFFSET=%u\n", start, end, LAYER_OFFSET);
 | 
			
		||||
    for (uint8_t i = start; i < end; i++) {
 | 
			
		||||
        bool    is_on = layer_state_cmp(state, i);
 | 
			
		||||
        uint8_t rl    = LAYER_OFFSET + i;
 | 
			
		||||
        dprintf("layer[%u]=%u, rl=%u\n", i, is_on, rl);
 | 
			
		||||
        rgblight_set_layer_state(rl, is_on);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
layer_state_t layer_state_set_user(layer_state_t state) {
 | 
			
		||||
    do_rgb_layers(state, LAYER_BASE, LAYER_BASE_END);
 | 
			
		||||
    return state;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rgb_layer_ack(layer_ack_t n) {
 | 
			
		||||
    uint8_t layer = ACK_OFFSET + n;
 | 
			
		||||
    dprintf("rgb_layer_ack(%u) ==> %u\n", n, layer);
 | 
			
		||||
    rgblight_blink_layer(layer, RGB_LAYER_ACK_DURATION);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void rgb_layer_ack_yn(bool yn) { rgb_layer_ack(yn ? ACK_YES : ACK_NO); }
 | 
			
		||||
 | 
			
		||||
void keyboard_post_init_user(void) {
 | 
			
		||||
    // Enable the LED layers
 | 
			
		||||
    rgblight_layers = _rgb_layers;
 | 
			
		||||
    do_rgb_layers(layer_state, LAYER_BASE, LAYER_BASE_END);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool shutdown_user(bool jump_to_bootloader) {
 | 
			
		||||
    clear_rgb_layers();
 | 
			
		||||
    rgblight_enable();
 | 
			
		||||
    rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
 | 
			
		||||
    rgblight_sethsv_noeeprom(HSV_RED);
 | 
			
		||||
    return false;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void spidey_glow(void) {
 | 
			
		||||
    rgblight_enable();
 | 
			
		||||
    rgblight_mode(RGBLIGHT_MODE_RAINBOW_MOOD);
 | 
			
		||||
    rgblight_sethsv(255, 230, 128);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void eeconfig_init_user(void) {
 | 
			
		||||
    spidey_glow();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    dprintf("key event: kc: %02X, col: %02u, row: %02u, pressed: %u mods: %08b "
 | 
			
		||||
#if !defined(NO_ACTION_ONESHOT)
 | 
			
		||||
            "os: %08b "
 | 
			
		||||
#endif
 | 
			
		||||
            "weak: %08b\n",
 | 
			
		||||
            keycode, record->event.key.col, record->event.key.row, record->event.pressed, bitrev(get_mods()),
 | 
			
		||||
#if !defined(NO_ACTION_ONESHOT)
 | 
			
		||||
            bitrev(get_oneshot_mods()),
 | 
			
		||||
#endif
 | 
			
		||||
            bitrev(get_weak_mods()));
 | 
			
		||||
 | 
			
		||||
    if (record->event.pressed) {
 | 
			
		||||
        switch (keycode) {
 | 
			
		||||
            // Re-implement this here, but fix the persistence!
 | 
			
		||||
            case QK_DEBUG_TOGGLE:
 | 
			
		||||
                if (!debug_enable) {
 | 
			
		||||
                    debug_enable = 1;
 | 
			
		||||
                } else if (!debug_keyboard) {
 | 
			
		||||
                    debug_keyboard = 1;
 | 
			
		||||
                } else if (!debug_matrix) {
 | 
			
		||||
                    debug_matrix = 1;
 | 
			
		||||
                } else {
 | 
			
		||||
                    debug_enable   = 0;
 | 
			
		||||
                    debug_keyboard = 0;
 | 
			
		||||
                    debug_matrix   = 0;
 | 
			
		||||
                }
 | 
			
		||||
                uprintf("DEBUG: enable=%u, keyboard=%u, matrix=%u\n", debug_enable, debug_keyboard, debug_matrix);
 | 
			
		||||
                uprintln(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION ", Built on: " QMK_BUILDDATE);
 | 
			
		||||
                eeconfig_update_debug(debug_config.raw);
 | 
			
		||||
                return false;
 | 
			
		||||
 | 
			
		||||
                // clang-format off
 | 
			
		||||
            case CH_SUSP: tap_code16(LGUI(LSFT(KC_L))); return true;
 | 
			
		||||
            case HELLO:   SEND_STRING("Hello, world!"); return true;
 | 
			
		||||
                // clang-format on
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
void post_process_record_user(uint16_t keycode, keyrecord_t *record) {
 | 
			
		||||
    switch (keycode) {
 | 
			
		||||
        // Acks follow...
 | 
			
		||||
        case QK_DEBUG_TOGGLE:
 | 
			
		||||
            rgb_layer_ack_yn(debug_enable);
 | 
			
		||||
            break;
 | 
			
		||||
        case RGB_TOG:
 | 
			
		||||
            rgb_layer_ack_yn(rgblight_is_enabled());
 | 
			
		||||
            break;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1 +0,0 @@
 | 
			
		|||
spidey3 keymap for spin keypad
 | 
			
		||||
| 
						 | 
				
			
			@ -1,7 +0,0 @@
 | 
			
		|||
MOUSEKEY_ENABLE    = no
 | 
			
		||||
MIDI_ENABLE        = no
 | 
			
		||||
BOOTMAGIC_ENABLE   = yes
 | 
			
		||||
LTO_ENABLE         = yes
 | 
			
		||||
CONSOLE_ENABLE     = yes
 | 
			
		||||
GRAVE_ESC_ENABLE   = no
 | 
			
		||||
ENCODER_MAP_ENABLE = yes
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue