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

Bring up Qvex Lynepad #10826

Merged
merged 4 commits into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions keyboards/qvex/lynepad/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
Copyright 2020 KemoNine

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 0x5156
#define PRODUCT_ID 0x4C50
#define DEVICE_VER 0x0001
#define MANUFACTURER QVEX
#define PRODUCT Lynepad
#define DESCRIPTION Macro Keypad
mcrosson marked this conversation as resolved.
Show resolved Hide resolved

/* key matrix size */
#define MATRIX_ROWS 3
#define MATRIX_COLS 4

/* Basic matrix config */
#define MATRIX_ROW_PINS { C7, F7, F6}
#define MATRIX_COL_PINS { F0, F1, F4, F5 }
#define UNUSED_PINS

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION COL2ROW

/* Encoders */
#define ENCODERS_PAD_A { D0, B5 }
#define ENCODERS_PAD_B { D1, D6 }

/* LEDs */
#define RGB_DI_PIN D3
#ifdef RGB_DI_PIN
#undef RGBLIGHT_ANIMATIONS
#define RGBLED_NUM 4
#define RGBLIGHT_HUE_STEP 8
#define RGBLIGHT_SAT_STEP 8
#define RGBLIGHT_VAL_STEP 8
#define RGBLIGHT_LIMIT_VAL 240
#endif

/* Definitions for encoder tilt/press support */
#define ENC_TILT_THRESHOLD 1
#define PIN_TW_SW D2 // Center
#define PIN_RJ_SW C6 // Center
#define PIN_RJ_DIR_A D4 // Up
#define PIN_RJ_DIR_B D7 // Left
#define PIN_RJ_DIR_C B6 // Down
#define PIN_RJ_DIR_D B4 // Right
19 changes: 19 additions & 0 deletions keyboards/qvex/lynepad/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/* Copyright 2020 KemoNine
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
*
* 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

// place overrides here
123 changes: 123 additions & 0 deletions keyboards/qvex/lynepad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/* Copyright 2020 KemoNine
*
* 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 <print.h>
mcrosson marked this conversation as resolved.
Show resolved Hide resolved

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Keymap (Base Layer) Default Layer
* |----------------------------|
* | 1 | 2 | 3 | 4 | |
* | 5 | 6 | 7 | 8 | |
* | 9 | 10 | 11 | |
* |----------------------------|
*/
[0] = LAYOUT_Lynepad(
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
KC_MS_BTN4, KC_MS_BTN2, KC_MS_UP, KC_MS_BTN1,
KC_MS_BTN5, KC_MS_LEFT, KC_MS_DOWN, KC_MS_RIGHT,
KC_MS_ACCEL0, KC_MS_ACCEL1, KC_MS_ACCEL2
)
};

// Standard encoder functionality
void encoder_update_user(uint8_t index, bool clockwise) {
// Process encoder rotational movements
if (index == 0) { /* First encoder */
if (clockwise) {
tap_code(KC_AUDIO_VOL_DOWN);
} else {
tap_code(KC_AUDIO_VOL_UP);
}
} else if (index == 1) { /* Second encoder */
if (clockwise) {
tap_code(KC_MS_WH_UP);
} else {
tap_code(KC_MS_WH_DOWN);
}
}
}

// Encoder press / tilt event handling
// the core lynepad implementation will update the below variables on each matrix scan
// Update the various codes below for customizing the tilt / push config

extern int16_t enc1Center;
extern int16_t enc1CenterPrev;
extern int16_t enc2Center;
extern int16_t enc2CenterPrev;
extern int16_t enc2Up;
extern int16_t enc2UpPrev;
extern int16_t enc2Down;
extern int16_t enc2DownPrev;
extern int16_t enc2Left;
extern int16_t enc2LeftPrev;
extern int16_t enc2Right;
extern int16_t enc2RightPrev;

void matrix_scan_user(void) {
if (enc1Center != enc1CenterPrev) {
if (enc1Center < ENC_TILT_THRESHOLD) {
}
else {
reset_keyboard();
}
}
if (enc2Center != enc2CenterPrev) {
if (enc2Center < ENC_TILT_THRESHOLD) {
register_code16(KC_MS_BTN3);
}
else {
unregister_code16(KC_MS_BTN3);
}
/*
* Encoder sets ALL values when center is pressed so bail out at this point\
* to avoid the rest of the encoder buttons registering events
*/
return;
}
if (enc2Up != enc2UpPrev) {
if (enc2Up < ENC_TILT_THRESHOLD) {
register_code16(RGB_VAI);
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
}
else {
unregister_code16(RGB_VAI);
}
}
if (enc2Down != enc2DownPrev) {
if (enc2Down < ENC_TILT_THRESHOLD) {
register_code16(RGB_VAD);
}
else {
unregister_code16(RGB_VAD);
}
}
if (enc2Left != enc2LeftPrev) {
if (enc2Left < ENC_TILT_THRESHOLD) {
register_code16(RGB_TOG);
}
else {
unregister_code16(RGB_TOG);
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
}
}
if (enc2Right != enc2RightPrev) {
if (enc2Right < ENC_TILT_THRESHOLD) {
register_code16(RGB_MODE_FORWARD);
}
else {
unregister_code16(RGB_MODE_FORWARD);
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
1 change: 1 addition & 0 deletions keyboards/qvex/lynepad/keymaps/default/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# The default keymap for lynepad
52 changes: 52 additions & 0 deletions keyboards/qvex/lynepad/lynepad.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#include "lynepad.h"
mcrosson marked this conversation as resolved.
Show resolved Hide resolved

#include <print.h>
mcrosson marked this conversation as resolved.
Show resolved Hide resolved

void keyboard_pre_init_kb(void) {
// Encoder pins
setPinInput(PIN_TW_SW);
setPinInput(PIN_RJ_SW);
setPinInput(PIN_RJ_DIR_A);
setPinInput(PIN_RJ_DIR_C);
setPinInput(PIN_RJ_DIR_B);
setPinInput(PIN_RJ_DIR_D);
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
}

// void keyboard_post_init_user(void) {
// debug_enable=true;
// debug_matrix=true;
// debug_keyboard=true;
// debug_mouse=true;
// }

int16_t enc1Center = 1;
int16_t enc1CenterPrev = 1;
int16_t enc2Center = 1;
int16_t enc2CenterPrev = 1;
int16_t enc2Up = 1;
int16_t enc2UpPrev = 1;
int16_t enc2Down = 1;
int16_t enc2DownPrev = 1;
int16_t enc2Left = 1;
int16_t enc2LeftPrev = 1;
int16_t enc2Right = 1;
int16_t enc2RightPrev = 1;

void matrix_scan_kb(void) {
enc1CenterPrev = enc1Center;
enc1Center = readPin(PIN_TW_SW);

enc2CenterPrev = enc2Center;
enc2Center = readPin(PIN_RJ_SW);
enc2UpPrev = enc2Up;
enc2Up = readPin(PIN_RJ_DIR_A);
enc2DownPrev = enc2Down;
enc2Down = readPin(PIN_RJ_DIR_C);
enc2LeftPrev = enc2Left;
enc2Left = readPin(PIN_RJ_DIR_B);
enc2RightPrev = enc2Right;
enc2Right = readPin(PIN_RJ_DIR_D);

// Ensure any user customizations are called (for some reason this wasn't happening by default)
matrix_scan_user();
}
37 changes: 37 additions & 0 deletions keyboards/qvex/lynepad/lynepad.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/* Copyright 2020 KemoNine
*
* 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"

/* This a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/
#define LAYOUT_Lynepad( \
K00, K01, K02, K03, \
K10, K11, K12, K13, \
K20, K21, K22 \
) \
{ \
{ K00, K01, K02, K03 }, \
{ K10, K11, K12, K13 }, \
{ K20, K21, K22, KC_NO } \
}
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
13 changes: 13 additions & 0 deletions keyboards/qvex/lynepad/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# QVEX Lynepad

Macro pad with 11 keys and 2 rotary encoders.

Keyboard Maintainer: [KemoNine](https://git.kemonine.info/kemonine/keyboard)
Hardware Supported: QVEX Lynepad: macro keypad
Hardware Availability: Tindie [Keyboard Kit](https://www.tindie.com/products/qvex_tech/qvex-lynepad-macro-keypad/)
mcrosson marked this conversation as resolved.
Show resolved Hide resolved

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

make qvex/lynepad: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).
28 changes: 28 additions & 0 deletions keyboards/qvex/lynepad/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# MCU name
MCU = atmega32u4

# Bootloader selection
# Teensy halfkay
# Pro Micro caterina
# Atmel DFU atmel-dfu
# LUFA DFU lufa-dfu
# QMK DFU qmk-dfu
# ATmega32A bootloadHID
# ATmega328P USBasp
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
BOOTLOADER = caterina

# Build Options
# change yes to no to disable
#
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
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
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = yes # USB Nkey Rollover
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality on B7 by default
RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow
ENCODER_ENABLE = yes # Enable the encoders
mcrosson marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 7 additions & 0 deletions keyboards/qvex/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# QVEX

QVEX is a keyboard vendor based in Czechia

## Online Stores

**Website:** https://www.tindie.com/products/qvex_tech/qvex-lynepad-macro-keypad/