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

Add via keymap for Plaid-Pad #10057

Merged
merged 18 commits into from
Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from 17 commits
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
28 changes: 18 additions & 10 deletions keyboards/keycapsss/plaid_pad/config.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
/* Copyright 2020 Ben Roesner (keycapsss.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/>.
*/

#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID 0xFEED
#define PRODUCT_ID 0xAF12
#define DEVICE_VER 0x0001
#define VENDOR_ID 0x7983
#define PRODUCT_ID 0x5050 // "PP"
#define MANUFACTURER Keycapsss
#define PRODUCT Plaid-Pad
#define DESCRIPTION 4x4 numpad with through hole components

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

#define MATRIX_ROW_PINS { C0, C1, C2, C3 }
#define MATRIX_COL_PINS { B0, D7, D6, D5 }
#define UNUSED_PINS { B3, B4, B5, D4}

#define ENCODERS_PAD_A { D1, B2 }
#define ENCODERS_PAD_B { D0, B1 }


#define ENCODER_RESOLUTION 4

Expand Down
16 changes: 16 additions & 0 deletions keyboards/keycapsss/plaid_pad/keymaps/default/config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* Copyright 2020 Ben Roesner (keycapsss.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/>.
*/

#pragma once

// place overrides here
41 changes: 35 additions & 6 deletions keyboards/keycapsss/plaid_pad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,46 @@ void keyboard_post_init_user(void) {
}

void encoder_update_user(uint8_t index, bool clockwise) {
if (index == 0) { // First encoder - top left
/*
Rev1.1 Rev1
,-----------------------, ,-----------------------,
| E1 | E2 | E3 | E4 | | E1 | | | E2 |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E3 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E2 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E1 | | | | | |
`-----------------------' `-----------------------'
*/

// First encoder (E1)
if (index == 0) {
if (clockwise) {
tap_code(KC_F17);
} else {
tap_code(KC_F18);
}
// Second encoder (E2)
} else if (index == 1) {
if (clockwise) {
tap_code(KC_F19);
} else {
tap_code(KC_F20);
}
// Third encoder (E3)
} else if (index == 2) {
if (clockwise) {
tap_code(KC_RIGHT);
tap_code(KC_F21);
} else {
tap_code(KC_LEFT);
tap_code(KC_F22);
}
} else if (index == 1) { // Second encoder - top right
// Forth encoder (E4)
} else if (index == 3) {
if (clockwise) {
tap_code(KC_UP);
tap_code(KC_F23);
} else {
tap_code(KC_DOWN);
tap_code(KC_F24);
}
}
}
13 changes: 0 additions & 13 deletions keyboards/keycapsss/plaid_pad/keymaps/default/readme.md

This file was deleted.

100 changes: 100 additions & 0 deletions keyboards/keycapsss/plaid_pad/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/* Copyright 2020 Ben Roesner (keycapsss.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

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* ,-----------------------,
* | 7 | 8 | 9 | / |
* |-----+-----+-----+-----|
* | 4 | 5 | 6 | * |
* |-----+-----+-----+-----|
* | 1 | 2 | 3 | - |
* |-----+-----+-----+-----|
* | 0 | . | = | + |
* `-----------------------'
*/
[0] = LAYOUT_ortho_4x4(
KC_P7, KC_P8, KC_P9, KC_PSLS,
KC_P4, KC_P5, KC_P6, KC_PAST,
KC_P1, KC_P2, KC_P3, KC_PMNS,
KC_P0, KC_PDOT, KC_PEQL, KC_PPLS ),
[1] = LAYOUT_ortho_4x4(
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 ),
[2] = LAYOUT_ortho_4x4(
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_ortho_4x4(
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 ),
};

// Set LED1 state during powerup
void keyboard_post_init_user(void) {
writePinHigh(LED_RED);
}

void encoder_update_user(uint8_t index, bool clockwise) {
/*
Rev1.1 Rev1
,-----------------------, ,-----------------------,
| E1 | E2 | E3 | E4 | | E1 | | | E2 |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E3 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E2 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E1 | | | | | |
`-----------------------' `-----------------------'
*/

// First encoder (E1)
if (index == 0) {
fauxpark marked this conversation as resolved.
Show resolved Hide resolved
if (clockwise) {
tap_code(KC_F17);
} else {
tap_code(KC_F18);
}
// Second encoder (E2)
} else if (index == 1) {
if (clockwise) {
tap_code(KC_F19);
} else {
tap_code(KC_F20);
}
// Third encoder (E3)
} else if (index == 2) {
if (clockwise) {
tap_code(KC_F21);
} else {
tap_code(KC_F22);
}
// Forth encoder (E4)
} else if (index == 3) {
if (clockwise) {
tap_code(KC_F23);
} else {
tap_code(KC_F24);
}
}
}
4 changes: 4 additions & 0 deletions keyboards/keycapsss/plaid_pad/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VIA_ENABLE = yes
LTO_ENABLE = yes
EXTRAKEY_ENABLE = no
MOUSEKEY_ENABLE = no
BenRoe marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 16 additions & 0 deletions keyboards/keycapsss/plaid_pad/plaid_pad.c
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
/* Copyright 2020 Ben Roesner (keycapsss.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 "plaid_pad.h"
16 changes: 16 additions & 0 deletions keyboards/keycapsss/plaid_pad/plaid_pad.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/* Copyright 2020 Ben Roesner (keycapsss.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/>.
*/

#pragma once

#include "quantum.h"
Expand Down
54 changes: 48 additions & 6 deletions keyboards/keycapsss/plaid_pad/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,66 @@
<img src="https://i.imgur.com/Jovhxpr.jpg" width="400">
<img src="https://i.imgur.com/V82cMqq.png" width="400">

A 4x4 numpad with only through hole components.
It's a great companion to the Plaid keyboard by [hsgw](https://github.com/hsgw/) and heavily inspired by it.
A 4x4 numpad/macro pad with only through hole components. It supports up to 4 rotary encoder. The positions for the encoder are interchangeable with keyboard switches.

Below you can see the possible positions for the 4 rotary encoder (Rev1 only 2).
*If you place a encoder in the top left corner (E1), you can't use another encoder in the lower right corner.*
```
Rev1.1 Rev1
,-----------------------, ,-----------------------,
| E1 | E2 | E3 | E4 | | E1 | | | E2 |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E3 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E2 | | | | | |
|-----+-----+-----+-----| |-----+-----+-----+-----|
| | | | E1 | | | | | |
`-----------------------' `-----------------------'
```

- Encoder E1 performs a tap on `KC_F17` and `KC_F18`.
- Encoder E2 performs a tap on `KC_F19` and `KC_F20`.
- Encoder E3 performs a tap on `KC_F21` and `KC_F22`.
- Encoder E4 performs a tap on `KC_F23` and `KC_F24`.

*The F17-F24 keys are intended to be customized via [Karabiner-Elements (OSX)](https://github.com/pqrs-org/Karabiner-Elements), or [AutoHotkey](https://github.com/Lexikos/AutoHotkey_L) (WIN)*

It's a great companion to the Plaid keyboard by [hsgw](https://github.com/hsgw/) and heavily inspired by it.
* Keyboard Maintainer: BenRoe [GitHub](https://github.com/BenRoe) / [Twitter](https://twitter.com/keycapsss)
* Hardware Supported: ATmega328P with VUSB ([see Bootloader section](#Bootloader))
* Hardware Availability: [Keycapsss.com](https://keycapsss.com)

Make example for this keyboard (after setting up your build environment):
## QMK Firmware
_Bootloader and Firmware ([default keymap](https://github.com/qmk/qmk_firmware/tree/master/keyboards/keycapsss/plaid_pad)) are already on the ATmega328P chip._

Make example for this keyboard (after [setting up your build environment](https://docs.qmk.fm/#/getting_started_build_tools)):

make keycapsss/plaid_pad:default
// or
qmk compile -kb keycapsss/plaid_pad -km default

Flashing example for this keyboard:

make keycapsss/plaid_pad:default:flash
// or
qmk flash -kb keycapsss/plaid_pad -km 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).

## Bootloader
- same usbasploader as Plaid ([Instruction](https://github.com/hsgw/plaid/blob/master/doc/en/bootloader.md), [Repository](https://github.com/hsgw/USBaspLoader/tree/plaid))
- same `usbasploader` as used for Plaid ([Instructions](https://github.com/hsgw/plaid/blob/master/doc/en/bootloader.md), [Repository](https://github.com/hsgw/USBaspLoader/tree/plaid))

---
### Enter bootloader mode (to flash a new firmware)
- Plug in the USB cable
- Push and hold RESET switch
- Push and hold BOOT switch
- Release RESET switch
- Release BOOT switch

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).
or an alternative method:
- Unplug the USB cable
- Hold down the BOOT switch
- Plug in the USB cable
- Release the BOOT switch

If you succeed to enter bootloader mode, you can see usbasp in device manager, or `*** USBAsp device connected` in [QMK Toolbox](https://github.com/qmk/qmk_toolbox).
25 changes: 25 additions & 0 deletions keyboards/keycapsss/plaid_pad/rev1/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Copyright 2020 Ben Roesner (keycapsss.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/>.
*/

#pragma once

#define PRODUCT Plaid-Pad Rev1
#define DEVICE_VER 0x0001

#define UNUSED_PINS { B3, B4, B5, D4}

#define ENCODERS_PAD_A { D1, B2 }
#define ENCODERS_PAD_B { D0, B1 }
17 changes: 17 additions & 0 deletions keyboards/keycapsss/plaid_pad/rev1/rev1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* Copyright 2020 Ben Roesner (keycapsss.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 "rev1.h"
Loading