moved folder, cleaned up code

This commit is contained in:
Felix Jen 2023-02-06 18:18:55 -06:00
parent 985376e8d4
commit 22c16d6664
No known key found for this signature in database
GPG Key ID: 4E7AA63CBBCE400E
11 changed files with 20 additions and 141 deletions

View File

@ -1,116 +0,0 @@
/*
Copyright 2021 <felix@fjlaboratories.com>
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 "analog.h"
#include "print.h"
#include "string.h"
enum layers {
_LAYER0,
_LAYER1,
_LAYER2,
_LAYER3
};
enum custom_keycodes { // Define keycodes for MIDI usage of the volume knob
A_CW = USER00,
A_CCW
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_LAYER1] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_LAYER0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_LAYER2] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[_LAYER3] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
};
#endif
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_LAYER0] = LAYOUT(
QK_GESC, 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_DEL,
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_PGUP,
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_BSPC, KC_PGDN,
KC_LSFT, KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_MUTE,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT
),
[_LAYER1] = LAYOUT(
QK_GESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_DEL, KC_HOME,
KC_TRNS, RGB_TOG, RGB_MOD, RGB_HUI, RGB_HUD, RGB_SAI, RGB_SAD, RGB_VAI, RGB_VAD, KC_TRNS, KC_PSCR, KC_SCRL, KC_PAUSE, QK_BOOT, KC_PGUP,
KC_TRNS, RGB_SPI, RGB_SPD, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_PGDN,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, NK_TOGG, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_AUDIO_VOL_UP, KC_AUDIO_MUTE,
KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MEDIA_PREV_TRACK, KC_AUDIO_VOL_DOWN, KC_MEDIA_NEXT_TRACK
),
[_LAYER2] = LAYOUT(
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, KC_TRNS, KC_TRNS
),
[_LAYER3] = LAYOUT(
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, KC_TRNS, KC_TRNS
),
};
/* Define MIDI custom keycodes here */
extern MidiDevice midi_device;
#define MIDI_CC_OFF 0
#define MIDI_CC_ON 127
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case A_CW:
if (record->event.pressed) {
midi_send_cc(&midi_device, midi_config.channel, 89, 1);
}
return true;
case A_CCW:
if (record->event.pressed) {
midi_send_cc(&midi_device, midi_config.channel, 89, 127);
}
return true;
default:
return true;
};
}
/* MIDI Slider controls */
uint16_t denoise_level = 16;
uint8_t last_val = 0;
void slider(void) {
uint8_t current_val = analogReadPin(SLIDER_PINA) >>3;
if ( last_val - current_val < -1 || last_val - current_val > 1 ) {
midi_send_cc(&midi_device, 0, 90, current_val ); // (&midi_device, chan, message, highest control value - (current pin reading) >>resolution)
last_val = current_val;
}
}
void matrix_scan_user(void) {
slider();
}

View File

@ -1,3 +0,0 @@
VIA_ENABLE = yes
ENCODER_MAP_ENABLE = yes
SRC += analog.c

View File

@ -1,5 +1,5 @@
/*
Copyright 2021 <felix@fjlaboratories.com>
Copyright 2022 <hello@keebfront.com>
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

View File

@ -1,8 +1,8 @@
{
"keyboard_name": "Vanguard65",
"manufacturer": "FJLaboratories",
"url": "https://www.fjlaboratories.com",
"maintainer": "FJLabs",
"manufacturer": "Keebfront",
"url": "https://www.keebfront.com",
"maintainer": "Keebfront",
"usb": {
"vid": "0x7074",
"pid": "0x1823",

View File

@ -1,5 +1,5 @@
/*
Copyright 2021 <felix@fjlaboratories.com>
Copyright 2022 <hello@keebfront.com>
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

View File

@ -1,5 +1,5 @@
/*
Copyright 2021 <felix@fjlaboratories.com>
Copyright 2022 <hello@keebfront.com>
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
@ -14,7 +14,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include QMK_KEYBOARD_H
#include "analog.h"
#include "print.h"
#include "string.h"
enum layers {
@ -29,7 +28,6 @@ enum custom_keycodeas {
A_CCW
};
// Set up EEPROM. Mostly boilerplate from QMK docs
typedef union {
uint32_t raw;
@ -38,14 +36,13 @@ typedef union {
};
} user_config_t;
user_config_t user_config;
uint8_t slider_func = 0;
// On keyboard initialization, pull the EEPROM values
void keyboard_post_init_user(void) {
// Call the keymap level matrix init.
user_config.raw = eeconfig_read_user();
slider_func = user_config.slider_func_state;
};
@ -101,7 +98,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
};
/* Define MIDI custom keycodes here */
/* Configure custom MIDI Keycodes that will be placed on USER_00 and USER_01 */
extern MidiDevice midi_device;
#define MIDI_CC_OFF 0
#define MIDI_CC_ON 127
@ -211,18 +208,19 @@ uint8_t rgb_sat = 0;
void slider(void) {
uint8_t current_val = analogReadPin(SLIDER_PINA) >>3;
uint8_t current_val = analogReadPin(SLIDER_PINA) >>3; // Bit shift 2^10 [1024] to 2^7 [128]
if ( last_val - current_val < -1 || last_val - current_val > 1 ) {
// Underglow RGB Brightness
if ( slider_func == 0 ) {
uint8_t rounded_val = 0;
uint8_t round_coefficient = 3; // Set round-to-zero value target
rgb_hue = rgblight_get_hue(); // Pull current hue and saturation values since we're just adjusting brightness
rgb_sat = rgblight_get_sat();
// Since the lower end range of the slider can be a little bit noisy, it's going to make the zero-value a little hard to hit when it bounces around between 0-1-2. Better off to round any super low values to zero so the lights will affirmatively turn off at lower values.
if ( current_val < 3 ) {
if ( current_val < round_coefficient ) {
rounded_val = 0;
} else {
rounded_val = current_val;
@ -233,12 +231,12 @@ void slider(void) {
// MIDI CC 90
else if ( slider_func == 1 ) {
midi_send_cc(&midi_device, 0, 90, current_val ); // (&midi_device, chan, message, highest control value - (current pin reading) >>resolution)
midi_send_cc(&midi_device, 0, 90, current_val );
}
// Layer shift between layers 1 - 4
else if ( slider_func == 2 ) {
layer_move(current_val >>5);
layer_move(current_val >>5); // Bit shift 2^7 to 2^2
}
else {

View File

@ -1,15 +1,15 @@
# PaperSky Studio Kyuu Hotswap
# Keebfront Vanguard65
The following is the QMK Firmware for the Kyuu compatible Hotswap PCB
The following is the QMK Firmware for the Keebfront Vanguard65
---
* Keyboard Maintainer: FJLabs
* Hardware Supported: Kyuu Hotswap PCB
* Keyboard Maintainer: Keebfront
* Hardware Supported: Vanguard65
Make example for this keyboard (after setting up your build environment):
make fjlabs/kyuu:default
make keebfront/vanguard65:default
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).

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 <felix@fjlaboratories.com>
Copyright 2022 <hello@keebfront.com>
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

View File

@ -1,5 +1,5 @@
/*
Copyright 2022 <felix@fjlaboratories.com>
Copyright 2022 <hello@keebfront.com>
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