diff --git a/keyboards/jcpm2/config.h b/keyboards/jcpm2/config.h new file mode 100644 index 000000000000..0f06cd1466b2 --- /dev/null +++ b/keyboards/jcpm2/config.h @@ -0,0 +1,20 @@ +/* Copyright 2025 Jeremy Cook Consulting LLC + * + * 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. + * + * If you did not receive a copy of the GNU General Public License + * along with this program, see . + */ + +#pragma once + +#define OLED_DISPLAY_128X64 +#define OLED_TIMEOUT 2000000 diff --git a/keyboards/jcpm2/jcpm2.c b/keyboards/jcpm2/jcpm2.c new file mode 100644 index 000000000000..9439a6a677b4 --- /dev/null +++ b/keyboards/jcpm2/jcpm2.c @@ -0,0 +1,46 @@ +/* Copyright 2025 Jeremy Cook Consulting LLC + * + * 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 . + */ + #include "quantum.h" + +#ifdef OLED_ENABLE +static uint32_t logo_timer = 0; + +oled_rotation_t oled_init_kb(oled_rotation_t rotation) { + logo_timer = timer_read(); + return OLED_ROTATION_180; +} + +static void render_logo(void) { + static const char PROGMEM qmk_logo[] = { + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, 0x93, 0x94, + 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, 0xB4, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0x00 + }; + oled_write_P(qmk_logo, false); +} + +bool oled_task_kb(void) { + if (timer_elapsed32(logo_timer) < 1000) { + render_logo(); + return false; + } + if (!oled_task_user()) { + return false; + } + return true; +} + +#endif diff --git a/keyboards/jcpm2/keyboard.json b/keyboards/jcpm2/keyboard.json new file mode 100644 index 000000000000..17734a0ed072 --- /dev/null +++ b/keyboards/jcpm2/keyboard.json @@ -0,0 +1,79 @@ +{ + "manufacturer": "jeremyscook", + "keyboard_name": "jcpm2", + "maintainer": "jeremyscook", + "development_board": "promicro", + "encoder": { + "rotary": [ + {"pin_a": "D2", "pin_b": "D3"} + ] + }, + "features": { + "bootmagic": true, + "encoder": true, + "extrakey": true, + "mousekey": true, + "nkro": true, + "oled": true, + "rgb_matrix": true + }, + "matrix_pins": { + "direct": [ + ["D4", null, "F4", "B3"], + ["B4", null, "F5", "B2"], + ["B1", "F7", "F6", "B6"] + ] + }, + "rgb_matrix": { + "animations": { + "digital_rain": true, + "hue_breathing": true, + "typing_heatmap": true + }, + "default": { + "animation": "typing_heatmap", + "val": 180 + }, + "driver": "ws2812", + "layout": [ + {"matrix": [2, 0], "x": 0, "y": 64, "flags": 4}, + {"matrix": [2, 1], "x": 75, "y": 64, "flags": 4}, + {"matrix": [2, 2], "x": 150, "y": 64, "flags": 4}, + {"matrix": [1, 2], "x": 150, "y": 32, "flags": 4}, + {"matrix": [0, 2], "x": 150, "y": 0, "flags": 4}, + {"matrix": [0, 3], "x": 224, "y": 0, "flags": 4}, + {"matrix": [1, 3], "x": 224, "y": 32, "flags": 4}, + {"matrix": [2, 3], "x": 224, "y": 64, "flags": 4}, + {"x": 224, "y": 0, "flags": 2}, + {"x": 224, "y": 64, "flags": 2}, + {"x": 112, "y": 64, "flags": 2}, + {"x": 0, "y": 64, "flags": 2} + ], + "sleep": true + }, + "url": "https://github.com/JeremySCook/JC-Pro-Macro-2", + "usb": { + "device_version": "1.0.0", + "pid": "0x0000", + "vid": "0xFEED" + }, + "ws2812": { + "pin": "C6" + }, + "layouts": { + "LAYOUT": { + "layout": [ + {"matrix": [0, 0], "x": 0, "y": 0}, + {"matrix": [0, 2], "x": 2, "y": 0}, + {"matrix": [0, 3], "x": 3, "y": 0}, + {"matrix": [1, 0], "x": 0, "y": 1}, + {"matrix": [1, 2], "x": 2, "y": 1}, + {"matrix": [1, 3], "x": 3, "y": 1}, + {"matrix": [2, 0], "x": 0, "y": 2}, + {"matrix": [2, 1], "x": 1, "y": 2}, + {"matrix": [2, 2], "x": 2, "y": 2}, + {"matrix": [2, 3], "x": 3, "y": 2} + ] + } + } +} diff --git a/keyboards/jcpm2/keymaps/default/keymap.c b/keyboards/jcpm2/keymaps/default/keymap.c new file mode 100644 index 000000000000..706f94312dc7 --- /dev/null +++ b/keyboards/jcpm2/keymaps/default/keymap.c @@ -0,0 +1,154 @@ +// Copyright 2023 QMK +// SPDX-License-Identifier: GPL-2.0-or-later + +#include QMK_KEYBOARD_H + +// Define the layers +enum layer_names { + _LAYER0, + _LAYER0_MOD, + _LAYER1, + _LAYER2, + _LAYER3 //unused +}; + +#define UNDERGLOW 60 + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ┌───┬───┬───┬───┐ + * │ E │ n │ 6 │ 7 │ + * ├───┼───┼───┼───┤ + * │ B │ n │ 5 │ 8 │ + * ├───┼───┼───┼───┤ + * │ 2 │ 3 │ 4 │ 9 │ + * └───┴───┴───┴───┘ + */ + [_LAYER0] = LAYOUT( // default + KC_MUTE, LSFT(KC_COMM), LSFT(KC_DOT), + DF(_LAYER1), KC_J, KC_L, + KC_MPRV, KC_MPLY, KC_MNXT, TG(_LAYER0_MOD) // btm-right one shot mod layer + ), + [_LAYER0_MOD] = LAYOUT( // default MOD + _______, RM_VALU, RM_NEXT, // _______ transparent, goes to above layer + _______, RM_VALD, RM_TOGG, + LCTL(LGUI(KC_SPC)), _______, _______, TG(_LAYER0_MOD) + ), + [_LAYER1] = LAYOUT( // FCPX + LSFT(LGUI(KC_B)), LGUI(KC_B), LGUI(KC_EQL), + DF(_LAYER2), LALT(KC_K), LGUI(KC_MINS), + KC_J, KC_K, KC_L, KC_BSPC + ), + [_LAYER2] = LAYOUT( // KICAD + KC_E, KC_ESC, KC_M, + DF(_LAYER0), LGUI(KC_Z), KC_X, + KC_V, KC_D, KC_U, KC_BSPC + ), + [_LAYER3] = LAYOUT( // Unused + MI_AOFF, MI_B3, MI_C4, + DF(_LAYER0), MI_G3, MI_A3, + MI_C3, MI_D3, MI_E3, MI_F3 + ), +}; + +#ifdef ENCODER_MAP_ENABLE +const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = { + [_LAYER0] = { ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }, // default + [_LAYER0_MOD] = { ENCODER_CCW_CW(_______, _______) }, // default MOD + [_LAYER1] = { ENCODER_CCW_CW(KC_LEFT, KC_RIGHT) }, // FCPX + [_LAYER2] = { ENCODER_CCW_CW(KC_R, S(KC_R)) }, // KICAD + [_LAYER3] = { ENCODER_CCW_CW(_______, _______) }, // UNUSED +}; +#endif + +#ifdef OLED_ENABLE +// Function to display the current layer and information on the OLED +bool oled_task_user(void) { + switch (get_highest_layer(layer_state | default_layer_state)) { + case _LAYER0: + oled_write_ln_P(PSTR("(VOL- VOL+) LAYER0"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("MUTE SLOW FAST"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("LAYR RSET 10BK 10FW"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("MREV MPLA MFWD +OPT"), false); + break; + case _LAYER0_MOD: + oled_write_ln_P(PSTR("____ ____ 0-MOD"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("____ BRI+ ANIM"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("____ ____ BRI- TOGG"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("EMOJ ____ ____ -OPT"), false); + break; + case _LAYER1: + oled_write_ln_P(PSTR("(FRA- FRA+) FCPX"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("XXXX BRAK ZOM+"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("LAYR RSET KFRA ZOM-"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("BACK STOP FORW DELT"), false); + break; + case _LAYER2: + oled_write_ln_P(PSTR("(RO L RO R) KICAD"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("EDIT ESCP MOVE"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("LAYR RSET UNDO TRAK"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("VIA DRAG SALL DELT"), false); + break; + case _LAYER3: //not used + oled_write_ln_P(PSTR("(RO L RO R) MIDI"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("EDIT B3 C4"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("LAYR RSET G3 A3"), false); + oled_write_ln_P(PSTR(""), false); + oled_write_ln_P(PSTR("C3 D3 E3 F3"), false); + break; + } + return false; +} +#endif + +bool rgb_matrix_indicators_user(void) { + switch(get_highest_layer(layer_state|default_layer_state)) { + case _LAYER2: + rgb_matrix_set_color(11, 0, 0, UNDERGLOW); + rgb_matrix_set_color(10, 0, 0, UNDERGLOW); + rgb_matrix_set_color(9, 0, 0, UNDERGLOW); + rgb_matrix_set_color(8, 0, 0, UNDERGLOW); + break; + case _LAYER1: + rgb_matrix_set_color(11, 0, UNDERGLOW, 0); + rgb_matrix_set_color(10, 0, UNDERGLOW, 0); + rgb_matrix_set_color(9, 0, UNDERGLOW, 0); + rgb_matrix_set_color(8, 0, UNDERGLOW, 0); + break; + case _LAYER0_MOD: + rgb_matrix_set_color(11, UNDERGLOW/2, 0, UNDERGLOW/2); + rgb_matrix_set_color(10, UNDERGLOW/2, 0, UNDERGLOW/2); + rgb_matrix_set_color(9, UNDERGLOW/2, 0, UNDERGLOW/2); + rgb_matrix_set_color(8, UNDERGLOW/2, 0, UNDERGLOW/2); + break; + case _LAYER0: + rgb_matrix_set_color(11, UNDERGLOW, 0, 0); + rgb_matrix_set_color(10, UNDERGLOW, 0, 0); + rgb_matrix_set_color(9, UNDERGLOW, 0, 0); + rgb_matrix_set_color(8, UNDERGLOW, 0, 0); + break; + case _LAYER3: //not used + rgb_matrix_set_color(11, 0, UNDERGLOW/2, UNDERGLOW/2); + rgb_matrix_set_color(10, 0, UNDERGLOW/2, UNDERGLOW/2); + rgb_matrix_set_color(9, 0, UNDERGLOW/2, UNDERGLOW/2); + rgb_matrix_set_color(8, 0, UNDERGLOW/2, UNDERGLOW/2); + break; + default: + break; + } + return false; +} diff --git a/keyboards/jcpm2/keymaps/default/rules.mk b/keyboards/jcpm2/keymaps/default/rules.mk new file mode 100644 index 000000000000..ee325681483f --- /dev/null +++ b/keyboards/jcpm2/keymaps/default/rules.mk @@ -0,0 +1 @@ +ENCODER_MAP_ENABLE = yes diff --git a/keyboards/jcpm2/readme.md b/keyboards/jcpm2/readme.md new file mode 100644 index 000000000000..9a5560dfd091 --- /dev/null +++ b/keyboards/jcpm2/readme.md @@ -0,0 +1,27 @@ +# jcpm2 + +![jcpm2](https://i.imgur.com/EM5JoGC.jpeg) + +An 8-key macro pad with rotary encoder, RGB backlighting and underlighting. Made and sold by JCC LLC. + +* Keyboard Maintainer: [jeremyscook](https://github.com/jeremyscook) +* Hardware Supported: JCPM2 PCB, Pro Micro +* Hardware Availability: [Tindie.com](https://www.tindie.com/products/25414) + +Make example for this keyboard (after setting up your build environment): + + make jcpm2:default + +Flashing example for this keyboard: + + make jcpm2:default:flash + +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 + +Enter the bootloader in 3 ways: + +* **Bootmagic reset**: Hold down the rotary encoder and plug in the keyboard +* **Physical reset button**: Double-click the small inside button on top of the PCB +* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available