diff --git a/keyboards/phantagom/oled_mpad/config.h b/keyboards/phantagom/oled_mpad/config.h new file mode 100644 index 000000000000..3005fc08ccce --- /dev/null +++ b/keyboards/phantagom/oled_mpad/config.h @@ -0,0 +1,56 @@ +/* +Copyright 2022 + +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 . +*/ + +#pragma once + +#include "config_common.h" + + +#define TAPPING_TERM 400 + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 5 + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS { GP23, GP22, GP21, GP20, GP19, GP18 } +#define MATRIX_COL_PINS { GP17, GP16, GP15 , GP14, GP11 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP4 +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U +/* #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED_MASK 0U */ + +#define BOOTMAGIC_LITE_ROW 1 +#define BOOTMAGIC_LITE_COLUMN 0 + +#define I2C_DRIVER I2CD1 +#define OLED_DISPLAY_128X64 +#define I2C1_SDA_PIN GP12 +#define I2C1_SCL_PIN GP13 diff --git a/keyboards/phantagom/oled_mpad/info.json b/keyboards/phantagom/oled_mpad/info.json new file mode 100644 index 000000000000..db39d87741ed --- /dev/null +++ b/keyboards/phantagom/oled_mpad/info.json @@ -0,0 +1,53 @@ +{ + "name": "oled_mpad", + "keyboard_name": "oled_mpad", + "manufacturer": "Phantagom", + "vendorId": "0xF8E8", + "productId": "0x0001", + "matrix": { "rows": 6, "cols": 5 }, + "url": "", + "lighting": "qmk_rgblight", + "maintainer": "Phantagom", + "usb": { + "vid": "0xF8E8", + "pid": "0x0001", + "device_version": "0.0.3" + }, + "layouts": { + "LAYOUT_numpad_6x5": { + "layout": [ + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + {"x": 4, "y": 0}, + + {"x": 0, "y": 1}, + {"x": 1, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1}, + {"x": 4, "y": 1}, + + {"x": 0, "y": 2}, + {"x": 1, "y": 2}, + {"x": 2, "y": 2}, + {"x": 3, "y": 2}, + {"x": 4, "y": 2, "h": 2}, + + {"x": 0, "y": 3}, + {"x": 1, "y": 3}, + {"x": 2, "y": 3}, + {"x": 3, "y": 3}, + + {"x": 0, "y": 4}, + {"x": 1, "y": 4}, + {"x": 2, "y": 4}, + {"x": 3, "y": 4}, + {"x": 4, "y": 4, "h": 2}, + + {"x": 0, "y": 5}, + {"x": 1, "y": 5, "w": 2}, + {"x": 3, "y": 5} + ] + } + } +} diff --git a/keyboards/phantagom/oled_mpad/keymaps/default/keymap.c b/keyboards/phantagom/oled_mpad/keymaps/default/keymap.c new file mode 100644 index 000000000000..04932d47d816 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/keymaps/default/keymap.c @@ -0,0 +1,189 @@ +/* +Copyright 2022 + +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 QMK_KEYBOARD_H + +enum Layer { + _NUMPAD = 0, // Standard QWERTY layer + _MOUSE, // Function key layer + _NAV, +}; +#define _NP _NUMPAD +#define _MS _MOUSE +#define _NV _NAV + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ,-------------------. + * | Fx | Fx | Fx | Fx | + * |----|----|----|----| + * | NL | / | * | - | + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | . | | + * `-------------------' + */ + + [_NUMPAD] = LAYOUT_numpad_6x5( + MO(_MS), KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + TO(_NP), KC_P7, KC_P8, KC_P9, + TO(_MS), KC_P4, KC_P5, KC_P6, KC_PPLS, + TO(_NV), KC_P1, KC_P2, KC_P3, + KC_A, KC_P0, KC_PDOT, KC_PENT + ), + + [_MOUSE] = LAYOUT_numpad_6x5( + _______, KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_BTN1, KC_BTN2, KC_BTN3, + TO(_NP), KC_P7, KC_MS_U, KC_P9, + TO(_MS), KC_MS_L, KC_P5, KC_MS_R, KC_PPLS, + TO(_NV), KC_P1, KC_MS_D, KC_P3, + KC_A, KC_P0, KC_PDOT, KC_PENT + ), + + [_NAV] = LAYOUT_numpad_6x5( + MO(_MS), KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + TO(_NP), KC_HOME, KC_UP, KC_PGUP, + TO(_MS), KC_LEFT, _______, KC_RIGHT, KC_PPLS, + TO(_NV), KC_END, KC_DOWN, KC_PGDOWN, + KC_A, KC_INS, KC_DEL, KC_PENT + ), +}; + +void matrix_init_user(void) { + // set CapsLock LED to output and low + setPinOutput(GP4); + writePinLow(GP4); + // set NumLock LED to output and low + setPinOutput(GP5); + writePinLow(GP5); + // set ScrollLock LED to output and low + setPinOutput(GP6); + writePinLow(GP6); +} + +void led_update_ports(led_t led_state) { + writePin(GP4, led_state.num_lock); + writePin(GP5, led_state.caps_lock); + writePin(GP6, led_state.scroll_lock); +} + +static uint16_t type_count = 0; + void count_type ( void ) { + type_count++; +} + +// Function to be called when the key is pressed/released +// If the function itself is not added, add each function, if it is, add only in `#ifdef OLED_ENABLE` +bool process_record_user ( uint16_t keycode, keyrecord_t *record) { + #ifdef OLED_ENABLE + if (record->event.pressed) { + count_type (); + } +#endif + return true ; +} + +void oled_write_type_count ( void ) { + oled_write_P ( PSTR ( "Type count: " ), false ); + oled_write_ln (get_u16_str(type_count, ' '), false ); +} + +// Layer state +void oled_write_layer_state ( void ) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _NUMPAD: + oled_write_P(PSTR("Numpad\n"), false); + break; + case _MOUSE: + oled_write_P(PSTR("Mouse\n"), false); + break; + case _NAV: + oled_write_P(PSTR("Navigation\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined\n"), false); + } +} + +// State of NumLock/CapsLock/ScrollLock +void oled_write_host_led_state ( void ) { + const led_t led_state = host_keyboard_led_state (); + oled_write_P ( PSTR ( "NL:" ), false ); + oled_write_P (led_state.num_lock ? PSTR ( "on" ) : PSTR ( "- " ), false ); + oled_write_P ( PSTR ( " CL:" ), false ); + oled_write_P (led_state.caps_lock ? PSTR ( "on" ) :PSTR ( "- " ), false ); + oled_write_P ( PSTR ( " SL:" ), false ); + oled_write_ln_P (led_state.scroll_lock ? PSTR ( "on\n" ) : PSTR ( "-\n" ), false ); +} + +// Uptime +// write given digit, with leading zero if digit < 10 +void oled_write_2digit(unsigned int digit) { + static char buf[6]; + itoa(digit, buf, 10); + if (digit < 10) { + oled_write_char('0', false); + } + oled_write(buf, false); +} + +void oled_write_uptime(void) { + static uint32_t uptime_s; + uptime_s = timer_read32() / 1000; + oled_write_P(PSTR("Uptime "), false); + // hour + oled_write_2digit((uptime_s / 3600) % 60); + oled_write_char(':', false); + // minutes + oled_write_2digit((uptime_s / 60) % 60); + oled_write_char(':', false); + // seconds + oled_write_2digit(uptime_s % 60); + oled_write_char('\n', false); +} + +void oled_render_logo(void) { + static const char PROGMEM crkbd_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, + 0}; + oled_write_P(crkbd_logo, false); +} + +#ifdef OLED_ENABLE +bool oled_task_user(void) { + + oled_render_logo(); + oled_write_host_led_state (); + oled_write_layer_state (); + oled_write_type_count (); + oled_write_uptime (); + return false; +} +#endif \ No newline at end of file diff --git a/keyboards/phantagom/oled_mpad/keymaps/via/keymap.c b/keyboards/phantagom/oled_mpad/keymaps/via/keymap.c new file mode 100644 index 000000000000..4fe927b4ffc6 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/keymaps/via/keymap.c @@ -0,0 +1,193 @@ +/* +Copyright 2022 + +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 QMK_KEYBOARD_H + +enum Layer { + _NUMPAD = 0, // Standard QWERTY layer + _MOUSE, // Function key layer + _NAV, +}; +#define _NP _NUMPAD +#define _MS _MOUSE +#define _NV _NAV + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ,-------------------. + * | Fx | Fx | Fx | Fx | + * |----|----|----|----| + * | NL | / | * | - | + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | . | | + * `-------------------' + */ + + [_NUMPAD] = LAYOUT_numpad_6x5( + MO(_MS), KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + TO(_NP), KC_P7, KC_P8, KC_P9, + TO(_MS), KC_P4, KC_P5, KC_P6, KC_PPLS, + TO(_NV), KC_P1, KC_P2, KC_P3, + KC_A, KC_P0, KC_PDOT, KC_PENT + ), + + [_MOUSE] = LAYOUT_numpad_6x5( + _______, KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_BTN1, KC_BTN2, KC_BTN3, + TO(_NP), KC_P7, KC_MS_U, KC_P9, + TO(_MS), KC_MS_L, KC_P5, KC_MS_R, KC_PPLS, + TO(_NV), KC_P1, KC_MS_D, KC_P3, + KC_A, KC_P0, KC_PDOT, KC_PENT + ), + + [_NAV] = LAYOUT_numpad_6x5( + MO(_MS), KC_MUTE, KC_VOLD, KC_VOLU, + KC_PSCR, KC_NUM, KC_PSLS, KC_PAST, KC_PMNS, + TO(_NP), KC_HOME, KC_UP, KC_PGUP, + TO(_MS), KC_LEFT, _______, KC_RIGHT, KC_PPLS, + TO(_NV), KC_END, KC_DOWN, KC_PGDOWN, + KC_A, KC_INS, KC_DEL, KC_PENT + ), +}; + +void matrix_init_user(void) { + // set CapsLock LED to output and low + setPinOutput(GP4); + writePinLow(GP4); + // set NumLock LED to output and low + setPinOutput(GP5); + writePinLow(GP5); + // set ScrollLock LED to output and low + setPinOutput(GP6); + writePinLow(GP6); +} + +bool led_update_kb(led_t led_state) { + bool res = led_update_user(led_state); + if(res) { + writePin(GP4, led_state.num_lock); + writePin(GP5, led_state.caps_lock); + //writePin(B2, led_state.scroll_lock); + } + return res; +} + +static uint16_t type_count = 0; + void count_type ( void ) { + type_count++; +} + +// Function to be called when the key is pressed/released +// If the function itself is not added, add each function, if it is, add only in `#ifdef OLED_ENABLE` +bool process_record_user ( uint16_t keycode, keyrecord_t *record) { + #ifdef OLED_ENABLE + if (record->event.pressed) { + count_type (); + } +#endif + return true ; +} + +void oled_write_type_count ( void ) { + oled_write_P ( PSTR ( "Type count: " ), false ); + oled_write_ln (get_u16_str(type_count, ' '), false ); +} + +// Layer state +void oled_write_layer_state ( void ) { + // Host Keyboard Layer Status + oled_write_P(PSTR("Layer: "), false); + + switch (get_highest_layer(layer_state)) { + case _NUMPAD: + oled_write_P(PSTR("Numpad\n"), false); + break; + case _MOUSE: + oled_write_P(PSTR("Mouse\n"), false); + break; + case _NAV: + oled_write_P(PSTR("Navigation\n"), false); + break; + default: + // Or use the write_ln shortcut over adding '\n' to the end of your string + oled_write_ln_P(PSTR("Undefined\n"), false); + } +} + +// State of NumLock/CapsLock/ScrollLock +void oled_write_host_led_state ( void ) { + const led_t led_state = host_keyboard_led_state (); + oled_write_P ( PSTR ( "NL:" ), false ); + oled_write_P (led_state.num_lock ? PSTR ( "on" ) : PSTR ( "- " ), false ); + oled_write_P ( PSTR ( " CL:" ), false ); + oled_write_P (led_state.caps_lock ? PSTR ( "on" ) :PSTR ( "- " ), false ); + oled_write_P ( PSTR ( " SL:" ), false ); + oled_write_ln_P (led_state.scroll_lock ? PSTR ( "on\n" ) : PSTR ( "-\n" ), false ); +} + +// Uptime +// write given digit, with leading zero if digit < 10 +void oled_write_2digit(unsigned int digit) { + static char buf[6]; + itoa(digit, buf, 10); + if (digit < 10) { + oled_write_char('0', false); + } + oled_write(buf, false); +} + +void oled_write_uptime(void) { + static uint32_t uptime_s; + uptime_s = timer_read32() / 1000; + oled_write_P(PSTR("Uptime "), false); + // hour + oled_write_2digit((uptime_s / 3600) % 60); + oled_write_char(':', false); + // minutes + oled_write_2digit((uptime_s / 60) % 60); + oled_write_char(':', false); + // seconds + oled_write_2digit(uptime_s % 60); + oled_write_char('\n', false); +} + +void oled_render_logo(void) { + static const char PROGMEM crkbd_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, + 0}; + oled_write_P(crkbd_logo, false); +} + +#ifdef OLED_ENABLE +bool oled_task_user(void) { + + oled_render_logo(); + oled_write_host_led_state (); + oled_write_layer_state (); + oled_write_type_count (); + oled_write_uptime (); + return false; +} +#endif \ No newline at end of file diff --git a/keyboards/phantagom/oled_mpad/keymaps/via/rules.mk b/keyboards/phantagom/oled_mpad/keymaps/via/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/phantagom/oled_mpad/mcuconf.h b/keyboards/phantagom/oled_mpad/mcuconf.h new file mode 100644 index 000000000000..80c9738ad724 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/mcuconf.h @@ -0,0 +1,26 @@ +/* +Copyright 2022 + +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 . +*/ + +#pragma once + +#include_next + +#undef RP_I2C_USE_I2C0 +#define RP_I2C_USE_I2C0 TRUE + +#undef RP_I2C_USE_I2C1 +#define RP_I2C_USE_I2C1 FALSE diff --git a/keyboards/phantagom/oled_mpad/oled_mpad.c b/keyboards/phantagom/oled_mpad/oled_mpad.c new file mode 100644 index 000000000000..cb699d736acd --- /dev/null +++ b/keyboards/phantagom/oled_mpad/oled_mpad.c @@ -0,0 +1,17 @@ +/* +Copyright 2022 + +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 "oled_mpad.h" diff --git a/keyboards/phantagom/oled_mpad/oled_mpad.h b/keyboards/phantagom/oled_mpad/oled_mpad.h new file mode 100644 index 000000000000..4e710ebbee80 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/oled_mpad.h @@ -0,0 +1,55 @@ +/* +Copyright 2022 + +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 . +*/ +#pragma once +#include "quantum.h" + +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define LAYOUT_numpad_6x5( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, k14, \ + k20, k21, k22, k23, \ + k30, k31, k32, k33, k24, \ + k40, k41, k42, k43, \ + k50, k51, k52, k44 \ +) \ +{ \ + {KC_NO, k00, k01, k02, k03}, \ + {k10, k11, k12, k13, k14}, \ + {k20, k21, k22, k23, k24}, \ + {k30, k31, k32, k33, KC_NO}, \ + {k40, k41, k42, k43, k44}, \ + {k50, k51, KC_NO, k52, KC_NO} \ +} + +/* matrix layout + * ,------------------------. + * | | 00 | 01 | 03 | 04 | + * |----|----|----|----|----| + * | 10 | 11 | 12 | 13 | 14 | + * |----|----|----|----|----| + * | 20 | 21 | 22 | 23 | | + * |----|----|----|----| 24 | + * | 30 | 31 | 32 | 33 | | + * |----|----|----|----|----| + * | 40 | 41 | 42 | 43 | | + * |----|----|----|----| 44 | + * | 50 | 51 | 52 | | + * `------------------------' + */ + + diff --git a/keyboards/phantagom/oled_mpad/readme.md b/keyboards/phantagom/oled_mpad/readme.md new file mode 100644 index 000000000000..41a23ca8a674 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/readme.md @@ -0,0 +1,8 @@ +# OLED_MPAD + +![OLED_MPAD](https://i.imgur.com/EEJFeOl.jpeg) + +A marco numpad with oled display, with a RP2040. + +* Keyboard Maintainer: [phantagom](https://github.com/dkruyt/) +* Project page: [blog](https://kruyt.org/numpads/) diff --git a/keyboards/phantagom/oled_mpad/rules.mk b/keyboards/phantagom/oled_mpad/rules.mk new file mode 100644 index 000000000000..90f23ef638f1 --- /dev/null +++ b/keyboards/phantagom/oled_mpad/rules.mk @@ -0,0 +1,24 @@ +# MCU name +MCU = RP2040 +# Bootloader selection +BOOTLOADER = rp2040 +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow +AUDIO_ENABLE = no # Audio output +SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend +WPM_ENABLE = yes +OLED_ENABLE = yes +OLED_DRIVER = SSD1306 + +OPT_DEFS += -DHAL_USE_I2C=TRUE + +LAYOUTS = numpad_6x5 diff --git a/keyboards/phantagom/rgb_npad/config.h b/keyboards/phantagom/rgb_npad/config.h new file mode 100644 index 000000000000..7a631c00d95a --- /dev/null +++ b/keyboards/phantagom/rgb_npad/config.h @@ -0,0 +1,74 @@ +/* +Copyright 2022 + +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 . +*/ + +#pragma once + +#include "config_common.h" + +#define TAPPING_TERM 400 + +/* key matrix size */ +#define MATRIX_ROWS 6 +#define MATRIX_COLS 4 + +// RGB +#define RGB_DI_PIN GP28 +#define RGBLED_NUM 23 +#define NOP_FUDGE 0.4 + +/*== all animations enable ==*/ +//# define RGBLIGHT_ANIMATIONS +/*== or choose animations ==*/ +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_RGB_TEST +# define RGBLIGHT_EFFECT_ALTERNATING +/*== customize breathing effect ==*/ +/*==== (DEFAULT) use fixed table instead of exp() and sin() ====*/ +//# define RGBLIGHT_BREATHE_TABLE_SIZE 256 // 256(default) or 128 or 64 +/*==== use exp() and sin() ====*/ +//# define RGBLIGHT_EFFECT_BREATHE_CENTER 1.85 // 1 to 2.7 +//# define RGBLIGHT_EFFECT_BREATHE_MAX 255 // 0 to 255 + + +// ROWS: Top to bottom, COLS: Left to right + +#define MATRIX_ROW_PINS { GP23, GP22, GP21, GP20, GP19, GP18 } +#define MATRIX_COL_PINS { GP17, GP16, GP15 , GP14 } + +/* COL2ROW or ROW2COL */ +#define DIODE_DIRECTION COL2ROW + +/* Set 0 if debouncing isn't needed */ +#define DEBOUNCE 5 + +/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */ +#define LOCKING_SUPPORT_ENABLE +/* Locking resynchronize hack */ +#define LOCKING_RESYNC_ENABLE + +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET +#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U +/* #define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED_MASK 0U */ + +#define BOOTMAGIC_LITE_ROW 0 +#define BOOTMAGIC_LITE_COLUMN 0 diff --git a/keyboards/phantagom/rgb_npad/info.json b/keyboards/phantagom/rgb_npad/info.json new file mode 100644 index 000000000000..9ef840feba75 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/info.json @@ -0,0 +1,44 @@ +{ + "name": "rgb_npad", + "keyboard_name": "rgb_npad", + "manufacturer": "Phantagom", + "url": "", + "maintainer": "Phantagom", + "usb": { + "vid": "0xF8E8", + "pid": "0x0002", + "device_version": "0.0.3" + }, + "layouts": { + "LAYOUT_numpad_6x4": { + "layout": [ + {"x": 0, "y": 0}, + {"x": 1, "y": 0}, + {"x": 2, "y": 0}, + {"x": 3, "y": 0}, + + {"x": 0, "y": 1}, + {"x": 1, "y": 1}, + {"x": 2, "y": 1}, + {"x": 3, "y": 1}, + + {"x": 0, "y": 2}, + {"x": 1, "y": 2}, + {"x": 2, "y": 2}, + {"x": 3, "y": 2, "h": 2}, + + {"x": 0, "y": 3}, + {"x": 1, "y": 3}, + {"x": 2, "y": 3}, + + {"x": 0, "y": 4}, + {"x": 1, "y": 4}, + {"x": 2, "y": 4}, + {"x": 3, "y": 4, "h": 2}, + + {"x": 0, "y": 5, "w": 2}, + {"x": 2, "y": 5} + ] + } + } +} diff --git a/keyboards/phantagom/rgb_npad/keymaps/default/keymap.c b/keyboards/phantagom/rgb_npad/keymaps/default/keymap.c new file mode 100644 index 000000000000..c665b11df052 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/keymaps/default/keymap.c @@ -0,0 +1,70 @@ +/* +Copyright 2022 + +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 QMK_KEYBOARD_H + +enum Layer { + _NUMPAD = 0, // Standard QWERTY layer + _MOUSE, // Function key layer + _RGB, // RGB +}; +#define _NP _NUMPAD +#define _MS _MOUSE + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + /* + * ,-------------------. + * | Fx | Fx | Fx | Fx | + * |----|----|----|----| + * | NL | / | * | - | + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | . | | + * `-------------------' + */ + + [_NUMPAD] = LAYOUT_numpad_6x4( + TO(_MS), RGB_TOG, RGB_MODE_FORWARD, KC_VOLU, + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT + ), + + [_MOUSE] = LAYOUT_numpad_6x4( + TO(_RGB), RGB_TOG, RGB_MODE_FORWARD, KC_VOLU, + _______, KC_BTN1, KC_BTN2, KC_BTN3, + _______, KC_MS_U, _______, + KC_MS_L, KC_P5, KC_MS_R, _______, + _______, KC_MS_D, _______, + _______, _______, _______ + ), + + [_RGB] = LAYOUT_numpad_6x4( + TO(_NP), RGB_TOG, RGB_MODE_FORWARD, _______, + _______, _______, _______, _______, + RGB_HUI, RGB_VAI, RGB_HUD , + RGB_SAD, _______, RGB_SAI, _______, + _______, RGB_VAD, _______, + _______, _______, _______ + ), +}; \ No newline at end of file diff --git a/keyboards/phantagom/rgb_npad/keymaps/via/keymap.c b/keyboards/phantagom/rgb_npad/keymaps/via/keymap.c new file mode 100644 index 000000000000..6fefadd9a642 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/keymaps/via/keymap.c @@ -0,0 +1,68 @@ +/* +Copyright 2022 + +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 QMK_KEYBOARD_H + + /* + * ,-------------------. + * | Fx | Fx | Fx | Fx | + * |----|----|----|----| + * | NL | / | * | - | + * |----|----|----|----| + * | 7 | 8 | 9 | | + * |----|----|----| + | + * | 4 | 5 | 6 | | + * |----|----|----|----| + * | 1 | 2 | 3 | | + * |----|----|----| En | + * | 0 | . | | + * `-------------------' + */ + +const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { + [0] = LAYOUT_numpad_6x4( /* Base */ + KC_ESC, KC_LCTL, KC_LALT, KC_BSPC, + KC_NLCK, KC_PSLS, KC_PAST, KC_PMNS, + KC_P7, KC_P8, KC_P9, + KC_P4, KC_P5, KC_P6, KC_PPLS, + KC_P1, KC_P2, KC_P3, + KC_P0, KC_PDOT, KC_PENT + ), + [1] = LAYOUT_numpad_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), + [2] = LAYOUT_numpad_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), + [3] = LAYOUT_numpad_6x4( + _______, _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______, _______, + _______, _______, _______, + _______, _______, _______ + ), +}; \ No newline at end of file diff --git a/keyboards/phantagom/rgb_npad/keymaps/via/rules.mk b/keyboards/phantagom/rgb_npad/keymaps/via/rules.mk new file mode 100644 index 000000000000..1e5b99807cb7 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/keymaps/via/rules.mk @@ -0,0 +1 @@ +VIA_ENABLE = yes diff --git a/keyboards/phantagom/rgb_npad/mcuconf.h b/keyboards/phantagom/rgb_npad/mcuconf.h new file mode 100644 index 000000000000..2e4e9ac893df --- /dev/null +++ b/keyboards/phantagom/rgb_npad/mcuconf.h @@ -0,0 +1,19 @@ +/* +Copyright 2022 + +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 . +*/ +#pragma once + +#include_next diff --git a/keyboards/phantagom/rgb_npad/readme.md b/keyboards/phantagom/rgb_npad/readme.md new file mode 100644 index 000000000000..82916fe5e82c --- /dev/null +++ b/keyboards/phantagom/rgb_npad/readme.md @@ -0,0 +1,8 @@ +# RGB_NPAD + +![RGB_NPAD](https://i.imgur.com/EuGAMye.jpeg) + +A marco numpad with oled display, with a RP2040. + +* Keyboard Maintainer: [phantagom](https://github.com/dkruyt/) +* Project page: [blog](https://kruyt.org/numpads/) diff --git a/keyboards/phantagom/rgb_npad/rgb_npad.c b/keyboards/phantagom/rgb_npad/rgb_npad.c new file mode 100644 index 000000000000..59d216403398 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/rgb_npad.c @@ -0,0 +1,17 @@ +/* +Copyright 2022 + +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 "rgb_npad.h" diff --git a/keyboards/phantagom/rgb_npad/rgb_npad.h b/keyboards/phantagom/rgb_npad/rgb_npad.h new file mode 100644 index 000000000000..63f5f6334c72 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/rgb_npad.h @@ -0,0 +1,55 @@ +/* +Copyright 2022 + +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 . +*/ +#pragma once +#include "quantum.h" + +// The first section contains all of the arguments +// The second converts the arguments into a two-dimensional array +#define LAYOUT_numpad_6x4( \ + k00, k01, k02, k03, \ + k10, k11, k12, k13, \ + k20, k21, k22, \ + k30, k31, k32, k23, \ + k40, k41, k42, \ + k50, k51, k43 \ +) \ +{ \ + {k00, k01, k02, k03}, \ + {k10, k11, k12, k13}, \ + {k20, k21, k22, k23}, \ + {k30, k31, k32, KC_NO}, \ + {k40, k41, k42, k43}, \ + {k50, KC_NO, k51, KC_NO} \ +} + +/* matrix layout + * ,-------------------. + * | 00 | 01 | 02 | 03 | + * |----|----|----|----| + * | 10 | 11 | 12 | 13 | + * |----|----|----|----| + * | 20 | 21 | 22 | | + * |----|----|----| 23 | + * | 30 | 31 | 32 | | + * |----|----|----|----| + * | 40 | 41 | 42 | | + * |----|----|----| 43 | + * | 50 | 51 | | + * `-------------------' + */ + + diff --git a/keyboards/phantagom/rgb_npad/rules.mk b/keyboards/phantagom/rgb_npad/rules.mk new file mode 100644 index 000000000000..59c88efb14b9 --- /dev/null +++ b/keyboards/phantagom/rgb_npad/rules.mk @@ -0,0 +1,20 @@ +# MCU name +MCU = RP2040 +# Bootloader selection +BOOTLOADER = rp2040 +# Build Options +# change yes to no to disable +# +BOOTMAGIC_ENABLE = yes # Enable Bootmagic Lite +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 +NKRO_ENABLE = yes # Enable N-Key Rollover +BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality +RGBLIGHT_ENABLE = yes # Enable keyboard RGB underglow +RGBLIGHT_DRIVER = WS2812 +WS2812_DRIVER = vendor +AUDIO_ENABLE = no # Audio output + +LAYOUTS = numpad_6x4