Skip to content

Commit

Permalink
Add SNES Macropad keyboard (qmk#22377)
Browse files Browse the repository at this point in the history
Co-authored-by: jack <0x6a73@protonmail.com>
  • Loading branch information
2 people authored and Nathan committed Feb 11, 2024
1 parent 395c7cc commit 947459a
Show file tree
Hide file tree
Showing 11 changed files with 682 additions and 0 deletions.
12 changes: 12 additions & 0 deletions keyboards/snes_macropad/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Copyright 2023 John Barbero Unenge (@jbarberu)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_LED GP25
#define RP2040_BOOTLOADER_DOUBLE_TAP_RESET_TIMEOUT 500U

#define I2C_DRIVER I2CD1
#define I2C1_SDA_PIN GP14
#define I2C1_SCL_PIN GP15
8 changes: 8 additions & 0 deletions keyboards/snes_macropad/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright 2023 John Barbero Unenge (@jbarberu)
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

#define HAL_USE_I2C TRUE

#include_next <halconf.h>
79 changes: 79 additions & 0 deletions keyboards/snes_macropad/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"manufacturer": "JBarberU's",
"keyboard_name": "SNES Macropad",
"maintainer": "jbarberu",
"bootloader": "rp2040",
"diode_direction": "COL2ROW",
"features": {
"bootmagic": false,
"command": false,
"console": true,
"extrakey": true,
"mousekey": true,
"nkro": true,
"rgblight": true,
"oled": true
},
"ws2812": {
"pin": "GP5",
"driver": "vendor"
},
"processor": "RP2040",
"matrix_size": {
"cols": 4,
"rows": 6
},
"url": "",
"usb": {
"device_version": "1.0.0",
"pid": "0x0000",
"vid": "0xFEED"
},
"layouts": {
"LAYOUT": {
"layout": [
{"matrix": [0, 0], "x": 0, "y": 0},
{"matrix": [0, 1], "x": 1, "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, 1], "x": 1, "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},

{"matrix": [3, 0], "x": 0, "y": 3},
{"matrix": [3, 1], "x": 1, "y": 3},
{"matrix": [3, 2], "x": 2, "y": 3},
{"matrix": [3, 3], "x": 3, "y": 3},
{"matrix": [4, 0], "x": 0, "y": 4},
{"matrix": [4, 1], "x": 1, "y": 4},
{"matrix": [4, 2], "x": 2, "y": 4},
{"matrix": [4, 3], "x": 3, "y": 4},
{"matrix": [5, 0], "x": 0, "y": 5},
{"matrix": [5, 1], "x": 1, "y": 5},
{"matrix": [5, 2], "x": 2, "y": 5},
{"matrix": [5, 3], "x": 3, "y": 5}
]
}
},
"rgblight": {
"led_count": 12,
"max_brightness": 80,
"animations": {
"alternating": true,
"breathing": true,
"christmas": true,
"knight": true,
"rainbow_mood": true,
"rainbow_swirl": true,
"rgb_test": true,
"snake": true,
"static_gradient": true,
"twinkle": true
}
}
}
75 changes: 75 additions & 0 deletions keyboards/snes_macropad/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2023 John Barbero Unenge (@jbarberu)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum Layer {
L_Numpad = 0,
L_Symbols,
L_RGB,
};

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* Macropad Button Order
* ┌───┬───┬───┬───┐
* │ 7 │ 8 │ 9 │ - │
* ├───┼───┼───┼───┤
* │ 4 │ 5 │ 6 │ + │
* ├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │ 0 │
* └───┴───┴───┴───┘
*
* SNES Button Order
* ┌────────┬────────┬────────┬────────┐
* │ LT │ RT │ START │ SELECT │
* ├────────┼────────┼────────┼────────┤
* │ UP │ DOWN │ LEFT │ RIGHT │
* ├────────┼────────┼────────┼────────┤
* │ A │ B │ X │ Y │
* └────────┴────────┴────────┴────────┘
*
*/
[L_Numpad] = LAYOUT(
KC_P7, KC_P8, KC_P9, TO(L_RGB)
, KC_P4, KC_P5, KC_P6, LT(L_Symbols, KC_PCMM)
, KC_P1, KC_P2, KC_P3, KC_P0

, KC_A, KC_S, KC_ENT, KC_BSPC
, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT
, KC_X, KC_Z, LSFT(KC_F1),KC_TAB
),
[L_RGB] = LAYOUT(
RGB_M_P, RGB_M_B, RGB_TOG, KC_NO
, RGB_MOD, RGB_HUI, RGB_VAI, TO(L_Numpad)
, RGB_RMOD, RGB_HUD, RGB_VAD, KC_NO

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
),
[L_Symbols] = LAYOUT(
KC_PPLS, KC_PMNS, KC_PEQL, KC_NO
, KC_PAST, KC_PSLS, KC_ENT, KC_TRNS
, KC_NUM, KC_NO, KC_NO, QK_BOOT

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
)
};
// clang-format on

const char* get_layer_name_user(int layer) {
switch (layer) {
case L_Numpad:
return "Numpad";
case L_RGB:
return "RGB Controls";
case L_Symbols:
return "Symbols";
default:
return "Undef";
}
}
99 changes: 99 additions & 0 deletions keyboards/snes_macropad/keymaps/jbarberu/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
// Copyright 2023 John Barbero Unenge (@jbarberu)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum Layer {
L_Numpad = 0,
L_Symbols,
L_EasyEDA,
L_RGB,
L_Adjust
};

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* Macropad Button Order
* ┌───┬───┬───┬───┐
* │ 7 │ 8 │ 9 │ - │
* ├───┼───┼───┼───┤
* │ 4 │ 5 │ 6 │ + │
* ├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │ 0 │
* └───┴───┴───┴───┘
*
* SNES Button Order
* ┌────────┬────────┬────────┬────────┐
* │ LT │ RT │ START │ SELECT │
* ├────────┼────────┼────────┼────────┤
* │ UP │ DOWN │ LEFT │ RIGHT │
* ├────────┼────────┼────────┼────────┤
* │ A │ B │ X │ Y │
* └────────┴────────┴────────┴────────┘
*
*/
[L_Numpad] = LAYOUT(
KC_P7, KC_P8, KC_P9, TO(L_EasyEDA)
, KC_P4, KC_P5, KC_P6, LT(L_Symbols, KC_PCMM)
, KC_P1, KC_P2, KC_P3, KC_P0

, KC_A, KC_S, KC_ENT, KC_BSPC
, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT
, KC_X, KC_Z, LSFT(KC_F1), KC_TAB
),
[L_EasyEDA] = LAYOUT(
KC_COMM, KC_DOT, KC_K, TO(L_RGB)
, KC_LSFT, KC_M, KC_N, TO(L_Numpad)
, KC_LCTL, KC_SPC, KC_DEL, KC_BSPC

, KC_A, KC_B, KC_C, KC_D
, QK_BOOT, KC_TRNS, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
),
[L_RGB] = LAYOUT(
RGB_M_P, RGB_M_B, RGB_TOG, TO(L_Adjust)
, RGB_MOD, RGB_HUI, RGB_VAI, TO(L_Numpad)
, RGB_RMOD, RGB_HUD, RGB_VAD, KC_NO

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
),
[L_Adjust] = LAYOUT(
KC_NO, KC_P8, KC_NO, KC_NO
, KC_NO, RGB_HUD, KC_NO, TO(L_Numpad)
, RGB_HUI, KC_NO, KC_TRNS, KC_NO

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
),
[L_Symbols] = LAYOUT(
KC_PPLS, KC_PMNS, KC_PEQL, KC_NO
, KC_PAST, KC_PSLS, KC_ENT, KC_TRNS
, KC_NUM, KC_NO, KC_NO, QK_BOOT

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
)
};
// clang-format on

const char * get_layer_name_user(int layer) {
switch (layer) {
case L_Numpad:
return "Numpad";
case L_EasyEDA:
return "EasyEDA";
case L_RGB:
return "RGB Controls";
case L_Adjust:
return "Adjust";
case L_Symbols:
return "Symbols";
default:
return "Undef";
}
}
75 changes: 75 additions & 0 deletions keyboards/snes_macropad/keymaps/test/keymap.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Copyright 2023 John Barbero Unenge (@jbarberu)
// SPDX-License-Identifier: GPL-2.0-or-later

#include QMK_KEYBOARD_H

enum Layer {
L_Numpad = 0,
L_Symbols,
L_RGB
};

// clang-format off
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
* Macropad Button Order
* ┌───┬───┬───┬───┐
* │ 7 │ 8 │ 9 │ - │
* ├───┼───┼───┼───┤
* │ 4 │ 5 │ 6 │ + │
* ├───┼───┼───┼───┤
* │ 1 │ 2 │ 3 │ 0 │
* └───┴───┴───┴───┘
*
* SNES Button Order
* ┌────────┬────────┬────────┬────────┐
* │ LT │ RT │ START │ SELECT │
* ├────────┼────────┼────────┼────────┤
* │ UP │ DOWN │ LEFT │ RIGHT │
* ├────────┼────────┼────────┼────────┤
* │ A │ B │ X │ Y │
* └────────┴────────┴────────┴────────┘
*
*/
[L_Numpad] = LAYOUT(
KC_1, KC_2, KC_3, KC_4
, KC_5, KC_6, KC_7, KC_8
, KC_9, KC_0, KC_A, KC_S

, KC_A, KC_S, KC_ENT, KC_BSPC
, KC_UP, KC_DOWN, KC_LEFT, KC_RIGHT
, KC_X, KC_Z, LSFT(KC_F1),KC_TAB
),
[L_RGB] = LAYOUT(
RGB_M_P, RGB_M_B, RGB_TOG, KC_NO
, RGB_MOD, RGB_HUI, RGB_VAI, TO(L_Numpad)
, RGB_RMOD, RGB_HUD, RGB_VAD, KC_NO

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
),
[L_Symbols] = LAYOUT(
KC_PPLS, KC_PMNS, KC_PEQL, KC_NO
, KC_PAST, KC_PSLS, KC_ENT, KC_TRNS
, KC_NUM, KC_NO, KC_NO, QK_BOOT

, KC_A, KC_B, KC_C, KC_D
, KC_E, KC_F, KC_G, KC_H
, KC_I, KC_J, KC_K, KC_L
)
};
// clang-format on

const char * get_layer_name_user(int layer) {
switch (layer) {
case L_Numpad:
return "Numpad";
case L_RGB:
return "RGB Controls";
case L_Symbols:
return "Symbols";
default:
return "Undef";
}
}
Loading

0 comments on commit 947459a

Please sign in to comment.