Skip to content

Commit

Permalink
updated w3by2 to current version
Browse files Browse the repository at this point in the history
  • Loading branch information
JanLunge committed Aug 19, 2023
1 parent 12ddfc4 commit 74415cc
Show file tree
Hide file tree
Showing 10 changed files with 319 additions and 0 deletions.
16 changes: 16 additions & 0 deletions keyboards/janlunge/w3by2/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

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

#define WS2812_DI_PIN F4
#define RGB_MATRIX_LED_COUNT 6
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
#define RGB_MATRIX_KEYPRESSES

/* Set 0 if debouncing isn't needed */
#define DEBOUNCE 5
#define VIAL_KEYBOARD_UID {0x6F, 0xD2, 0x03, 0xC4, 0x16, 0xAF, 0x61, 0x27}
#define VIAL_UNLOCK_COMBO_ROWS { 1, 0 }
#define VIAL_UNLOCK_COMBO_COLS { 0, 1 }
75 changes: 75 additions & 0 deletions keyboards/janlunge/w3by2/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"keyboard_name": "w3by2",
"manufacturer": "Jan Lunge",
"keyboard": "w3by2",
"url": "https://blog.heaper.de/e/w3by2",
"maintainer": "Jan Lunge",
"width": 4,
"height": 2,
"keymap": "default",
"diode_direction": "COL2ROW",
"matrix_pins": {
"cols": ["F7", "B1", "B3", "B4"],
"rows": ["F6", "B2"]
},
"features": {
"encoder": true
},
"encoder": {
"rotary": [
{ "pin_a": "D0", "pin_b": "D1" }
]
},
"usb": {
"vid": "0xEEEE",
"pid": "0xFF00",
"device_version": "1.0.0"
},
"layouts": {
"LAYOUT_horizontal": {
"layout": [
{
"x": 0,
"y": 0,
"matrix": [0, 0]
},
{
"x": 1,
"y": 0,
"matrix": [0, 1]
},
{
"x": 2,
"y": 0,
"matrix": [0, 2]
},
{
"x": 3,
"y": 0,
"matrix": [0, 3]
},
{
"x": 0,
"y": 1,
"matrix": [1, 0]
},
{
"x": 1,
"y": 1,
"matrix": [1, 1]
},
{
"x": 2,
"y": 1,
"matrix": [1, 2]
},
{
"x": 3,
"y": 1,
"matrix": [1, 3]
}
]
}
}

}
8 changes: 8 additions & 0 deletions keyboards/janlunge/w3by2/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include QMK_KEYBOARD_H

const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_h(
KC_F13 , KC_F14 , KC_F15,
KC_F16 , KC_F17 , KC_F18
)
};
99 changes: 99 additions & 0 deletions keyboards/janlunge/w3by2/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
#include QMK_KEYBOARD_H
#include "raw_hid.h"
#include "quantum.h"

// 224x64
led_config_t g_led_config = { {
// Key Matrix to LED Index
{ 0, 1, 2, NO_LED },
{ 5, 4, 3, NO_LED },
}, {
// LED Index to Physical Position
{ 0, 0}, { 112, 0}, { 224,0 },
{ 224, 64}, { 112,64 }, { 0, 64},
}, {
// LED Index to Flag
4, 4, 4, 4, 4, 4
} };

#define ____ KC_TRNS
#define XXXX KC_NO

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

[0] = LAYOUT(
KC_B, KC_D, KC_F, XXXX,
KC_A, KC_C, KC_E, TO(1)
),

[1] = LAYOUT(
____, ____, ____, XXXX,
____, ____, ____, TO(2)
),

[2] = LAYOUT(
____, ____, ____, XXXX,
____, ____, ____, TO(3)
),

[3] = LAYOUT(
____, ____, ____, XXXX,
____, ____, ____, TO(0)

),

};

#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(RGB_HUD, RGB_HUI) },
[2] = { ENCODER_CCW_CW(RGB_SAD, RGB_SAI) },
[3] = { ENCODER_CCW_CW(KC_RIGHT, KC_LEFT) },
// Encoder 1
};
#endif

bool rgb_matrix_indicators_advanced_user(uint8_t led_min, uint8_t led_max) {
// the index of the led to set as an indicator
const int led_index = 2;
switch(get_highest_layer(layer_state)) {
case 1:
rgb_matrix_set_color(led_index, RGB_WHITE);
return true;
case 2:
rgb_matrix_set_color(led_index, RGB_BLUE);
return true;
case 3:
rgb_matrix_set_color(led_index, RGB_GREEN);
return true;
default:
return false;
}
}

void raw_hid_receive_kb(uint8_t *data, uint8_t length) {
if(data[0] == 0xFC){
switch (data[1]) {
case 0x01:{
// move to layer
data[1] = 0xFD;
layer_move(data[2]);
break;
}
case 0x02:{
// turn on layer
data[1] = 0xFD;
layer_on(data[2]);
break;
}
case 0x03:{
// turn off layer
data[1] = 0xFD;
layer_off(data[2]);
break;
}
}
}
raw_hid_send(data, length);
}
10 changes: 10 additions & 0 deletions keyboards/janlunge/w3by2/keymaps/via/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
VIA_ENABLE = yes
VIAL_ENABLE = yes
ENCODER_MAP_ENABLE = yes

QMK_SETTINGS = no
TAP_DANCE_ENABLE = no
COMBO_ENABLE = no
COMMAND_ENABLE = no
CONSOLE_ENABLE = no
EXTRAFLAGS += -flto
34 changes: 34 additions & 0 deletions keyboards/janlunge/w3by2/keymaps/via/vial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "w3by2",
"lighting": "vialrgb",
"matrix": {
"rows": 2,
"cols": 4
},
"layouts": {
"keymap": [
[
"1,0",
"0,0"
],
[
"1,1",
"0,1",
{
"x": 0.25
},
"0,0\n\n\n\n\n\n\n\n\ne",
"0,1\n\n\n\n\n\n\n\n\ne"

],
[
"1,2",
"0,2",
{
"x": 0.75
},
"1,3"
]
]
}
}
48 changes: 48 additions & 0 deletions keyboards/janlunge/w3by2/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 🎹 w3by2: Compact Mechanical Keypad
(Website)[https://blog.heaper.de/e/w3by2]


┌─────────┬─────────┬─────────┐
│ K00 │ K01 │ K02 │
├─────────┼─────────┼─────────┤ Encoder
│ K03 │ K04 │ K05 │ ( K06 )
└─────────┴─────────┴─────────┘



## Overview 🌐

**w3by2** is a beautifully compact 6-key mechanical keypad tailored for a .

💡 **What's New?** Now enhanced with a rotary encoder support, adding dynamic control right at your fingertips!

## Features 🌟

- **Compact Design:** Fully 3D printed case, printable on even the smaller 3D Printers also Perfect for tight desks and portable use.
- **Customizable:** Handwired from scratch implementation as well as the source files for the case in Fusion360.
- **Rotary Encoder:** Experience a new dimension of control with the integrated rotary encoder.
- **Maintained:** The keypad is updated and maintained by [Jan Lunge](https://github.com/janlunge). Follow the macropad series on youtube to see it evolve [w3by2 Macropad playlist on Youtube](https://www.youtube.com/playlist?list=PLdbIj_aeQsBbMI7IzhRsqTc7gNtt5SXVv).

## Available Keymaps 🔖

- **Default**: For general usage.
- **VIA**: Customize on-the-fly, no need to recompile. supports Via and Vial

## Contribute & Support

If you're interested in contributing or want to discuss features and improvements, feel free to reach out or submit a pull request on GitHub.

---

Let this be a starting point. You can further enhance the README by adding sections about how to setup, install, or customize the keyboard, and possibly adding images or GIFs showcasing the keyboard in action.

---

## Layer LED controls
switching the layers toggles the color of one of the leds as an indicator by default the rotary knob button is the layer switcher

## Print your own
* with rotary encoder https://github.com/JanLunge/keyboards/tree/main/w3by2-rotary
* base version https://github.com/JanLunge/keyboards/tree/main/w3by2%20Raised
* low profile https://github.com/JanLunge/keyboards/tree/main/w3by2%20Low%20profile
* pi pico https://github.com/JanLunge/keyboards/tree/main/w3by2%20-%20pico
20 changes: 20 additions & 0 deletions keyboards/janlunge/w3by2/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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
BOOTLOADER = caterina

EXTRAKEY_ENABLE = yes
NKRO_ENABLE = yes
MOUSEKEY_ENABLE = yes

RGB_MATRIX_ENABLE = yes
RGB_MATRIX_DRIVER = WS2812
VIALRGB_ENABLE = yes
1 change: 1 addition & 0 deletions keyboards/janlunge/w3by2/w3by2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "w3by2.h"
8 changes: 8 additions & 0 deletions keyboards/janlunge/w3by2/w3by2.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once

#include "quantum.h"

#define LAYOUT_h( K00, K01, K02, K03, K04, K05, K06, K07 ) \
{ { K00, K01, K02, K03 },\
{ K04, K05, K06, K07 } }
#define LAYOUT LAYOUT_h

0 comments on commit 74415cc

Please sign in to comment.