From d0de81367c61c61c4727487b91712bbfc584b299 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Sat, 18 Mar 2023 23:01:25 +0900
Subject: [PATCH 01/10] rotary encoder fix
---
keyboards/bandominedoni/config.h | 24 +++++++-----------------
keyboards/bandominedoni/info.json | 22 ++++++++++++++++++++++
keyboards/bandominedoni/rules.mk | 12 ------------
3 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/keyboards/bandominedoni/config.h b/keyboards/bandominedoni/config.h
index 7a25216afdd9..0e41fbdac2f2 100644
--- a/keyboards/bandominedoni/config.h
+++ b/keyboards/bandominedoni/config.h
@@ -15,29 +15,12 @@
*/
#pragma once
-
-/*
- * Keyboard Matrix Assignments
- *
- * Change this to how you wired your keyboard
- * COLS: AVR pins used for columns, left to right
- * ROWS: AVR pins used for rows, top to bottom
- * DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
- * ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
- *
- */
-#define MATRIX_ROW_PINS { B5, B4, D7, F6, C6, D4 }
-#define MATRIX_COL_PINS { D1, E6, F7, B1, B3, B2, D0 }
-
#define MASTER_RIGHT
#ifndef MASTER_RIGHT
// SPLIT_HAND_MATRIX_GRID was initially designed to use with left hand side diode D35 mounted and not pressing K7 on the right hand side during boot. However when a USB cable is reconnected immediately, it fails. Decided to use "MASTER_RIGHT" to make it more reliable.
# define SPLIT_HAND_MATRIX_GRID B5, D0
#endif
-/* COL2ROW, ROW2COL */
-#define DIODE_DIRECTION COL2ROW
-
#define SPLIT_USB_DETECT
#define RGB_DI_PIN D3
@@ -158,3 +141,10 @@
#endif // MIDI_ENABLE
#define TAP_CODE_DELAY 10
+
+/*
+ * Encoder options
+ */
+#ifdef ENCODER_ENABLE
+# define ENCODER_RESOLUTIONS_RIGHT { 4 }
+#endif // ENCODER_ENABLE
diff --git a/keyboards/bandominedoni/info.json b/keyboards/bandominedoni/info.json
index d0d470a4e47f..51bb19a3848f 100644
--- a/keyboards/bandominedoni/info.json
+++ b/keyboards/bandominedoni/info.json
@@ -3,13 +3,35 @@
"manufacturer": "3araht",
"url": "https://github.com/3araht",
"maintainer": "3araht",
+ "features": {
+ "midi": true,
+ "extrakey": true,
+ "encoder": true,
+ "bootmagic": false,
+ "command": false,
+ "console": false,
+ "mousekey": false,
+ "nkro": false,
+ "rgblight": false,
+ "audio": false
+ },
+ "encoder": {
+ "rotary": []
+ },
+ "diode_direction": "COL2ROW",
+ "matrix_pins": {
+ "cols": [ "D1", "E6", "F7", "B1", "B3", "B2", "D0" ],
+ "rows": [ "B5", "B4", "D7", "F6", "C6", "D4" ]
+ },
"usb": {
"vid": "0xFEED",
"pid": "0xF4B5",
"device_version": "0.0.1"
},
"split": {
+ "enabled": true,
"soft_serial_pin": "D2",
+ "soft_serial_speed": 1,
"encoder": {
"right": {
"rotary": [
diff --git a/keyboards/bandominedoni/rules.mk b/keyboards/bandominedoni/rules.mk
index 18ccf846ecc8..298d2fd1a931 100644
--- a/keyboards/bandominedoni/rules.mk
+++ b/keyboards/bandominedoni/rules.mk
@@ -1,18 +1,6 @@
# Build Options
# change yes to no to disable
#
-BOOTMAGIC_ENABLE = no # Enable Bootmagic Lite
-MOUSEKEY_ENABLE = no # 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 = no # Enable N-Key Rollover
-BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
-RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
-AUDIO_ENABLE = no # Audio output
-MIDI_ENABLE = yes # MIDI support
-ENCODER_ENABLE = yes # encoder on mute button
-SPLIT_KEYBOARD = yes # Enables split keyboard support
RGB_MATRIX_ENABLE = no # Use RGB matrix (Don't enable this when RGBLIGHT_ENABLE is used.)
RGB_MATRIX_DRIVER = WS2812 #
From 62f9fda47f77871d3f087643e693ce593225382d Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Sun, 19 Mar 2023 10:07:13 +0900
Subject: [PATCH 02/10] Default setting " "soft_serial_speed": 1" is deleted
from info.json.
---
keyboards/bandominedoni/info.json | 1 -
1 file changed, 1 deletion(-)
diff --git a/keyboards/bandominedoni/info.json b/keyboards/bandominedoni/info.json
index 51bb19a3848f..f6cb10da49c5 100644
--- a/keyboards/bandominedoni/info.json
+++ b/keyboards/bandominedoni/info.json
@@ -31,7 +31,6 @@
"split": {
"enabled": true,
"soft_serial_pin": "D2",
- "soft_serial_speed": 1,
"encoder": {
"right": {
"rotary": [
From d638e3d5010db2261de9952cb121e02dd0d39202 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Tue, 4 Apr 2023 20:59:07 +0900
Subject: [PATCH 03/10] Pull request number 20179 will fix the issue. Reverted.
---
keyboards/bandominedoni/config.h | 7 -------
keyboards/bandominedoni/info.json | 3 +--
2 files changed, 1 insertion(+), 9 deletions(-)
diff --git a/keyboards/bandominedoni/config.h b/keyboards/bandominedoni/config.h
index 0e41fbdac2f2..df9c7cf5fc7a 100644
--- a/keyboards/bandominedoni/config.h
+++ b/keyboards/bandominedoni/config.h
@@ -141,10 +141,3 @@
#endif // MIDI_ENABLE
#define TAP_CODE_DELAY 10
-
-/*
- * Encoder options
- */
-#ifdef ENCODER_ENABLE
-# define ENCODER_RESOLUTIONS_RIGHT { 4 }
-#endif // ENCODER_ENABLE
diff --git a/keyboards/bandominedoni/info.json b/keyboards/bandominedoni/info.json
index f6cb10da49c5..f0e9a62b08b2 100644
--- a/keyboards/bandominedoni/info.json
+++ b/keyboards/bandominedoni/info.json
@@ -6,7 +6,6 @@
"features": {
"midi": true,
"extrakey": true,
- "encoder": true,
"bootmagic": false,
"command": false,
"console": false,
@@ -16,7 +15,7 @@
"audio": false
},
"encoder": {
- "rotary": []
+ "enabled": true
},
"diode_direction": "COL2ROW",
"matrix_pins": {
From aee823faa719b72b5c570fd6c1c4cffd214c2029 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Tue, 4 Apr 2023 21:58:30 +0900
Subject: [PATCH 04/10] version output format changed.
---
keyboards/bandominedoni/keymaps/default/keymap.c | 2 +-
keyboards/bandominedoni/keymaps/led/keymap.c | 2 +-
keyboards/bandominedoni/keymaps/lednotg/keymap.c | 2 +-
keyboards/bandominedoni/keymaps/via/keymap.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/keyboards/bandominedoni/keymaps/default/keymap.c b/keyboards/bandominedoni/keymaps/default/keymap.c
index 880dc4bcc029..58415da32001 100644
--- a/keyboards/bandominedoni/keymaps/default/keymap.c
+++ b/keyboards/bandominedoni/keymaps/default/keymap.c
@@ -99,7 +99,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
}
diff --git a/keyboards/bandominedoni/keymaps/led/keymap.c b/keyboards/bandominedoni/keymaps/led/keymap.c
index b0f0e95528fe..480ef06d3290 100644
--- a/keyboards/bandominedoni/keymaps/led/keymap.c
+++ b/keyboards/bandominedoni/keymaps/led/keymap.c
@@ -197,7 +197,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
}
diff --git a/keyboards/bandominedoni/keymaps/lednotg/keymap.c b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
index 80410eadac8a..2ae51f79c50c 100644
--- a/keyboards/bandominedoni/keymaps/lednotg/keymap.c
+++ b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
@@ -197,7 +197,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
}
diff --git a/keyboards/bandominedoni/keymaps/via/keymap.c b/keyboards/bandominedoni/keymaps/via/keymap.c
index a546373b8c9d..5ad794fcc921 100644
--- a/keyboards/bandominedoni/keymaps/via/keymap.c
+++ b/keyboards/bandominedoni/keymaps/via/keymap.c
@@ -133,7 +133,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " | " QMK_BUILDDATE);
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
}
From 5eaaf794cae659af9008772192d9d86ad46076c8 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Tue, 4 Apr 2023 23:09:07 +0900
Subject: [PATCH 05/10] version output format changed.
---
keyboards/bandominedoni/keymaps/via/keymap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/keyboards/bandominedoni/keymaps/via/keymap.c b/keyboards/bandominedoni/keymaps/via/keymap.c
index 5ad794fcc921..84ccc1d37e0e 100644
--- a/keyboards/bandominedoni/keymaps/via/keymap.c
+++ b/keyboards/bandominedoni/keymaps/via/keymap.c
@@ -133,7 +133,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION QMK_GIT_HASH " | " QMK_BUILDDATE);
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
}
From 014d7273122d71efd8d7767669aa1efafd7d945f Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Thu, 6 Apr 2023 22:59:23 +0900
Subject: [PATCH 06/10] An issue with multiple same notes played at the same
time is fixed.
---
keyboards/bandominedoni/bandominedoni.h | 3 +
.../bandominedoni/keymaps/default/keymap.c | 204 +++++++++++++++--
keyboards/bandominedoni/keymaps/led/keymap.c | 212 ++++++++++++++++--
.../bandominedoni/keymaps/lednotg/keymap.c | 206 +++++++++++++++--
4 files changed, 580 insertions(+), 45 deletions(-)
diff --git a/keyboards/bandominedoni/bandominedoni.h b/keyboards/bandominedoni/bandominedoni.h
index c83958ce8a50..b18259625847 100644
--- a/keyboards/bandominedoni/bandominedoni.h
+++ b/keyboards/bandominedoni/bandominedoni.h
@@ -83,3 +83,6 @@
// However, It enables to decide the handedness by the HW by adding one condition: "not to press any keys (especially r30) dusing startup."
bool is_keyboard_left(void);
+#ifdef MIDI_ENABLE
+extern MidiDevice midi_device;
+#endif // MIDI_ENABLE
diff --git a/keyboards/bandominedoni/keymaps/default/keymap.c b/keyboards/bandominedoni/keymaps/default/keymap.c
index 58415da32001..beeccdde01a9 100644
--- a/keyboards/bandominedoni/keymaps/default/keymap.c
+++ b/keyboards/bandominedoni/keymaps/default/keymap.c
@@ -16,6 +16,18 @@
#include QMK_KEYBOARD_H
#include "version.h"
+// define which MIDI ch to use.
+// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
+// ch1
+#define DEFAULT_SUB_CH_NUMBER 0
+// ch2
+#define ALT_SUB_CH_NUMBER 1
+static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
+
+// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
+// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
+static bool use_alt_ch_gr = false;
+
// Defines names for use in layer keycodes and the keymap
enum layer_names {
#ifndef PEDAL_NORMALLY_CLOSED
@@ -29,16 +41,134 @@ enum layer_names {
};
enum custom_keycodes {
- VERSION = SAFE_RANGE
+ VERSION = SAFE_RANGE,
+ TGLCHGR, // ToGgLe CH GRoup
+
+ // MY tone to distinguish the notes to avoid sustain effect, etc.
+ MY_TONE_MIN,
+
+ MY_C = MY_TONE_MIN,
+ MY_Cs,
+ MY_Db = MY_Cs,
+ MY_D,
+ MY_Ds,
+ MY_Eb = MY_Ds,
+ MY_E,
+ MY_F,
+ MY_Fs,
+ MY_Gb = MY_Fs,
+ MY_G,
+ MY_Gs,
+ MY_Ab = MY_Gs,
+ MY_A,
+ MY_As,
+ MY_Bb = MY_As,
+ MY_B,
+
+ MY_C1,
+ MY_Cs1,
+ MY_Db1 = MY_Cs1,
+ MY_D1,
+ MY_Ds1,
+ MY_Eb1 = MY_Ds1,
+ MY_E1,
+ MY_F1,
+ MY_Fs1,
+ MY_Gb1 = MY_Fs1,
+ MY_G1,
+ MY_Gs1,
+ MY_Ab1 = MY_Gs1,
+ MY_A1,
+ MY_As1,
+ MY_Bb1 = MY_As1,
+ MY_B1,
+
+ MY_C2,
+ MY_Cs2,
+ MY_Db2 = MY_Cs2,
+ MY_D2,
+ MY_Ds2,
+ MY_Eb2 = MY_Ds2,
+ MY_E2,
+ MY_F2,
+ MY_Fs2,
+ MY_Gb2 = MY_Fs2,
+ MY_G2,
+ MY_Gs2,
+ MY_Ab2 = MY_Gs2,
+ MY_A2,
+ M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D1, MI_B1, MI_G3, MI_A3, MI_Ds3, MI_Fs2, MI_Ds1, MI_C1,
+ MY_Gs1, MY_As1, MY_Cs2, MY_F2, MY_Gs3,
+ MY_E1, MY_A1, MY_G2, MY_Ds2, MY_F3, MY_As2, MY_F1,
+ MY_D2, MY_A2, MY_C3, MY_E3, MY_C2, MY_G1, TG_SWAP,
+ MY_E2, MY_Gs2, MY_B2, MY_D3, MY_Fs3, MY_Cs3, MY_Fs1,
+ MY_D1, MY_B1, MY_G3, MY_A3, MY_Ds3, MY_Fs2, MY_Ds1, MY_C1,
MO_SWAP, MI_B5, MI_Gs5, MI_G5, MI_F5, FN_MUTE,
MI_Cs3, MI_A5, MI_Fs5, MI_E5, MI_Ds5,
@@ -49,17 +179,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_CLOSE] = LAYOUT(
- MI_Gs1, MI_As1, MI_Ds2, MI_Ds3, MI_G3,
- MI_D1, MI_D2, MI_As2, MI_C3, MI_Cs2, MI_C2, MI_Fs1,
- MI_G1, MI_G2, MI_B2, MI_D3, MI_F3, MI_Fs2, TG_SWAP,
- MI_A1, MI_E2, MI_A2, MI_Cs3, MI_E3, MI_Gs2, MI_B1,
- MI_E1, MI_E2, MI_Fs3, MI_Gs3, MI_B3, MI_F2, MI_Cs1, MI_F1,
+ MY_Gs1, MY_As1, MY_Ds2, MY_Ds3, MY_G3,
+ MY_D1, MY_D2, MY_As2, MY_C3, MY_Cs2, MY_C2, MY_Fs1,
+ MY_G1, MY_G2, MY_B2, MY_D3, MY_F3, MY_Fs2, TG_SWAP,
+ MY_A1, MY_E2, MY_A2, MY_Cs3, MY_E3, MY_Gs2, MY_B1,
+ MY_E1, MI_E2, MY_Fs3, MY_Gs3, MY_B3, MY_F2, MY_Cs1, MY_F1,
MO_SWAP, MI_A5, MI_Gs5, MI_Fs5, MI_F5, FN_MUTE,
MI_C3, MI_G5, MI_As4, MI_C5, MI_Ds5,
MI_D3, MI_Cs3, MI_Gs3, MI_As3, MI_C4, MI_D5,
TG_SWAP, MI_B2, MI_Fs3, MI_Fs4, MI_G3, MI_B3, MI_D4, MI_G4,
- MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MI_E4, MI_A4, MI_Cs5,
+ MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MY_E4, MI_A4, MI_Cs5,
MI_Gs2, MI_As2, MI_Ds3, MI_F4, MI_E4, MI_Gs4, MI_B4, MI_E5, MI_Ds4
),
@@ -72,7 +202,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, MI_OCTD, MI_OCTU, MI_VELD, MI_VELU, _______,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
+ TGLCHGR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
@@ -88,12 +218,41 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
#endif
void keyboard_post_init_user(void) {
+ for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
+ my_tone_status[i] = MIDI_INVALID_NOTE;
+ }
// Set octave to 0
midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
// avoid using 127 since it is used as a special number in some sound sources.
midi_config.velocity = MIDI_INITIAL_VELOCITY;
-};
+}
+
+void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
+ uint8_t mytone = keycode - MY_TONE_MIN;
+ uint16_t mykeycode = mytone + MIDI_TONE_MIN;
+ // uint16_t mykeycode = keycode - MY_TONE_MIN;
+ // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
+ uint8_t velocity = midi_config.velocity;
+ // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
+ if (record->event.pressed) {
+ if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
+ uint8_t note = midi_compute_note(mykeycode);
+ midi_send_noteon(&midi_device, channel, note, velocity);
+ dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ my_tone_status[mytone] = note; // store root_note status.
+ }
+ } else {
+ uint8_t note = my_tone_status[mytone];
+ if (note != MIDI_INVALID_NOTE) {
+ midi_send_noteoff(&midi_device, channel, note, velocity);
+ dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ }
+ my_tone_status[mytone] = MIDI_INVALID_NOTE;
+ }
+}
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
@@ -102,6 +261,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
+
+ case TGLCHGR:
+ if (record->event.pressed) {
+ use_alt_ch_gr = !use_alt_ch_gr;
+ if (use_alt_ch_gr) {
+ midi_sub_ch = ALT_SUB_CH_NUMBER;
+ } else { // default
+ midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
+ }
+ }
+ break;
+
+ case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
+ // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
+ // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
+ my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
+ break;
}
return true;
}
diff --git a/keyboards/bandominedoni/keymaps/led/keymap.c b/keyboards/bandominedoni/keymaps/led/keymap.c
index 480ef06d3290..4692e508669d 100644
--- a/keyboards/bandominedoni/keymaps/led/keymap.c
+++ b/keyboards/bandominedoni/keymaps/led/keymap.c
@@ -18,6 +18,18 @@
#define DF_COLE DF(_COLEMAK)
+// define which MIDI ch to use.
+// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
+// ch1
+#define DEFAULT_SUB_CH_NUMBER 0
+// ch2
+#define ALT_SUB_CH_NUMBER 1
+static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
+
+// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
+// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
+static bool use_alt_ch_gr = false;
+
#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
@@ -49,26 +61,144 @@ enum layer_names {
#ifdef PEDAL_NORMALLY_CLOSED
_OPEN,
#endif
- _QWERTY,
- _COLEMAK,
- _MISC,
- _FN
+ _QWERTY,
+ _COLEMAK,
+ _MISC,
+ _FN
};
enum custom_keycodes {
- VERSION = SAFE_RANGE
+ VERSION = SAFE_RANGE,
+ TGLCHGR, // ToGgLe CH GRoup
+
+ // MY tone to distinguish the notes to avoid sustain effect, etc.
+ MY_TONE_MIN,
+
+ MY_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
+ MY_Bb4 = MY_As4,
+ MY_B4,
+
+ MY_C5,
+ MY_Cs5,
+ MY_Db5 = MY_Cs5,
+ MY_D5,
+ MY_Ds5,
+ MY_Eb5 = MY_Ds5,
+ MY_E5,
+ MY_F5,
+ MY_Fs5,
+ MY_Gb5 = MY_Fs5,
+ MY_G5,
+ MY_Gs5,
+ MY_Ab5 = MY_Gs5,
+ MY_A5,
+ MY_As5,
+ MY_Bb5 = MY_As5,
+ MY_B5,
+
+ MY_C6,
+ MY_TONE_MAX = MY_C6
};
+#define MY_TONE_COUNT (MY_TONE_MAX - MY_TONE_MIN + 1)
+static uint8_t my_tone_status[MY_TONE_COUNT];
+
// Alias layout macros that expand groups of keys.
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_OPEN] = LAYOUT(
- MI_Gs1, MI_As1, MI_Cs2, MI_F2, MI_Gs3,
- MI_E1, MI_A1, MI_G2, MI_Ds2, MI_F3, MI_As2, MI_F1,
- MI_D2, MI_A2, MI_C3, MI_E3, MI_C2, MI_G1, TG_SWAP,
- MI_E2, MI_Gs2, MI_B2, MI_D3, MI_Fs3, MI_Cs3, MI_Fs1,
- MI_D1, MI_B1, MI_G3, MI_A3, MI_Ds3, MI_Fs2, MI_Ds1, MI_C1,
+ MY_Gs1, MY_As1, MY_Cs2, MY_F2, MY_Gs3,
+ MY_E1, MY_A1, MY_G2, MY_Ds2, MY_F3, MY_As2, MY_F1,
+ MY_D2, MY_A2, MY_C3, MY_E3, MY_C2, MY_G1, TG_SWAP,
+ MY_E2, MY_Gs2, MY_B2, MY_D3, MY_Fs3, MY_Cs3, MY_Fs1,
+ MY_D1, MY_B1, MY_G3, MY_A3, MY_Ds3, MY_Fs2, MY_Ds1, MY_C1,
MO_SWAP, MI_B5, MI_Gs5, MI_G5, MI_F5, FN_MUTE,
MI_Cs3, MI_A5, MI_Fs5, MI_E5, MI_Ds5,
@@ -79,17 +209,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_CLOSE] = LAYOUT(
- MI_Gs1, MI_As1, MI_Ds2, MI_Ds3, MI_G3,
- MI_D1, MI_D2, MI_As2, MI_C3, MI_Cs2, MI_C2, MI_Fs1,
- MI_G1, MI_G2, MI_B2, MI_D3, MI_F3, MI_Fs2, TG_SWAP,
- MI_A1, MI_E2, MI_A2, MI_Cs3, MI_E3, MI_Gs2, MI_B1,
- MI_E1, MI_E2, MI_Fs3, MI_Gs3, MI_B3, MI_F2, MI_Cs1, MI_F1,
+ MY_Gs1, MY_As1, MY_Ds2, MY_Ds3, MY_G3,
+ MY_D1, MY_D2, MY_As2, MY_C3, MY_Cs2, MY_C2, MY_Fs1,
+ MY_G1, MY_G2, MY_B2, MY_D3, MY_F3, MY_Fs2, TG_SWAP,
+ MY_A1, MY_E2, MY_A2, MY_Cs3, MY_E3, MY_Gs2, MY_B1,
+ MY_E1, MI_E2, MY_Fs3, MY_Gs3, MY_B3, MY_F2, MY_Cs1, MY_F1,
MO_SWAP, MI_A5, MI_Gs5, MI_Fs5, MI_F5, FN_MUTE,
MI_C3, MI_G5, MI_As4, MI_C5, MI_Ds5,
MI_D3, MI_Cs3, MI_Gs3, MI_As3, MI_C4, MI_D5,
TG_SWAP, MI_B2, MI_Fs3, MI_Fs4, MI_G3, MI_B3, MI_D4, MI_G4,
- MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MI_E4, MI_A4, MI_Cs5,
+ MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MY_E4, MI_A4, MI_Cs5,
MI_Gs2, MI_As2, MI_Ds3, MI_F4, MI_E4, MI_Gs4, MI_B4, MI_E5, MI_Ds4
),
@@ -147,7 +277,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, MI_OCTD, MI_OCTU, MI_VELD, MI_VELU, _______,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
+ TGLCHGR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD, RGB_MOD, EE_CLR, RGB_TOG
@@ -166,6 +296,9 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
#endif
void my_init(void){
+ for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
+ my_tone_status[i] = MIDI_INVALID_NOTE;
+ }
// Set octave to 0
midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
@@ -193,6 +326,32 @@ void keyboard_post_init_user(void) {
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
};
+void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
+ uint8_t mytone = keycode - MY_TONE_MIN;
+ uint16_t mykeycode = mytone + MIDI_TONE_MIN;
+ // uint16_t mykeycode = keycode - MY_TONE_MIN;
+ // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
+ uint8_t velocity = midi_config.velocity;
+ // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
+ if (record->event.pressed) {
+ if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
+ uint8_t note = midi_compute_note(mykeycode);
+ midi_send_noteon(&midi_device, channel, note, velocity);
+ dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ my_tone_status[mytone] = note; // store root_note status.
+ }
+ } else {
+ uint8_t note = my_tone_status[mytone];
+ if (note != MIDI_INVALID_NOTE) {
+ midi_send_noteoff(&midi_device, channel, note, velocity);
+ dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ }
+ my_tone_status[mytone] = MIDI_INVALID_NOTE;
+ }
+}
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
@@ -200,6 +359,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
+
+ case TGLCHGR:
+ if (record->event.pressed) {
+ use_alt_ch_gr = !use_alt_ch_gr;
+ if (use_alt_ch_gr) {
+ midi_sub_ch = ALT_SUB_CH_NUMBER;
+ } else { // default
+ midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
+ }
+ }
+ break;
+
+ case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
+ // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
+ // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
+ my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
+ break;
}
return true;
}
@@ -232,6 +408,8 @@ bool rgb_matrix_indicators_user(void) {
rgb_matrix_set_color(14, RGB_DARKYELLOW); // MI_VELD
rgb_matrix_set_color(25, RGB_DARKGREEN); // MI_VELU
+ rgb_matrix_set_color( 3, RGB_DARKSPRINGGREEN); // TGLCHGR
+
rgb_matrix_set_color( 6, RGB_DARKBLUE); // RGB_SAD
rgb_matrix_set_color( 9, RGB_DARKBLUE); // RGB_SAI
rgb_matrix_set_color(18, RGB_DARKBLUE); // RGB_HUD
diff --git a/keyboards/bandominedoni/keymaps/lednotg/keymap.c b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
index 2ae51f79c50c..553dace2fede 100644
--- a/keyboards/bandominedoni/keymaps/lednotg/keymap.c
+++ b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
@@ -18,6 +18,18 @@
#define DF_COLE DF(_COLEMAK)
+// define which MIDI ch to use.
+// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
+// ch1
+#define DEFAULT_SUB_CH_NUMBER 0
+// ch2
+#define ALT_SUB_CH_NUMBER 1
+static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
+
+// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
+// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
+static bool use_alt_ch_gr = false;
+
#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
@@ -56,19 +68,137 @@ enum layer_names {
};
enum custom_keycodes {
- VERSION = SAFE_RANGE
+ VERSION = SAFE_RANGE,
+ TGLCHGR, // ToGgLe CH GRoup
+
+ // MY tone to distinguish the notes to avoid sustain effect, etc.
+ MY_TONE_MIN,
+
+ MY_C = MY_TONE_MIN,
+ MY_Cs,
+ MY_Db = MY_Cs,
+ MY_D,
+ MY_Ds,
+ MY_Eb = MY_Ds,
+ MY_E,
+ MY_F,
+ MY_Fs,
+ MY_Gb = MY_Fs,
+ MY_G,
+ MY_Gs,
+ MY_Ab = MY_Gs,
+ MY_A,
+ MY_As,
+ MY_Bb = MY_As,
+ MY_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MY_Gs5,
+ MY_A5,
+ MY_As5,
+ MY_Bb5 = MY_As5,
+ MY_B5,
+
+ MY_C6,
+ MY_TONE_MAX = MY_C6
};
+#define MY_TONE_COUNT (MY_TONE_MAX - MY_TONE_MIN + 1)
+static uint8_t my_tone_status[MY_TONE_COUNT];
+
// Alias layout macros that expand groups of keys.
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_OPEN] = LAYOUT(
- MI_Gs1, MI_As1, MI_Cs2, MI_F2, MI_Gs3,
- MI_E1, MI_A1, MI_G2, MI_Ds2, MI_F3, MI_As2, MI_F1,
- MI_D2, MI_A2, MI_C3, MI_E3, MI_C2, MI_G1, MI_B,
- MI_E2, MI_Gs2, MI_B2, MI_D3, MI_Fs3, MI_Cs3, MI_Fs1,
- MI_D1, MI_B1, MI_G3, MI_A3, MI_Ds3, MI_Fs2, MI_Ds1, MI_C1,
+ MY_Gs1, MY_As1, MY_Cs2, MY_F2, MY_Gs3,
+ MY_E1, MY_A1, MY_G2, MY_Ds2, MY_F3, MY_As2, MY_F1,
+ MY_D2, MY_A2, MY_C3, MY_E3, MY_C2, MY_G1, MY_B,
+ MY_E2, MY_Gs2, MY_B2, MY_D3, MY_Fs3, MY_Cs3, MY_Fs1,
+ MY_D1, MY_B1, MY_G3, MY_A3, MY_Ds3, MY_Fs2, MY_Ds1, MY_C1,
MO_SWAP, MI_B5, MI_Gs5, MI_G5, MI_F5, FN_MUTE,
MI_Cs3, MI_A5, MI_Fs5, MI_E5, MI_Ds5,
@@ -79,17 +209,17 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
),
[_CLOSE] = LAYOUT(
- MI_Gs1, MI_As1, MI_Ds2, MI_Ds3, MI_G3,
- MI_D1, MI_D2, MI_As2, MI_C3, MI_Cs2, MI_C2, MI_Fs1,
- MI_G1, MI_G2, MI_B2, MI_D3, MI_F3, MI_Fs2, MI_B,
- MI_A1, MI_E2, MI_A2, MI_Cs3, MI_E3, MI_Gs2, MI_B1,
- MI_E1, MI_E2, MI_Fs3, MI_Gs3, MI_B3, MI_F2, MI_Cs1, MI_F1,
+ MY_Gs1, MY_As1, MY_Ds2, MY_Ds3, MY_G3,
+ MY_D1, MY_D2, MY_As2, MY_C3, MY_Cs2, MY_C2, MY_Fs1,
+ MY_G1, MY_G2, MY_B2, MY_D3, MY_F3, MY_Fs2, MY_B,
+ MY_A1, MY_E2, MY_A2, MY_Cs3, MY_E3, MY_Gs2, MY_B1,
+ MY_E1, MI_E2, MY_Fs3, MY_Gs3, MY_B3, MY_F2, MY_Cs1, MY_F1,
MO_SWAP, MI_A5, MI_Gs5, MI_Fs5, MI_F5, FN_MUTE,
MI_C3, MI_G5, MI_As4, MI_C5, MI_Ds5,
MI_D3, MI_Cs3, MI_Gs3, MI_As3, MI_C4, MI_D5,
MI_G2, MI_B2, MI_Fs3, MI_Fs4, MI_G3, MI_B3, MI_D4, MI_G4,
- MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MI_E4, MI_A4, MI_Cs5,
+ MI_A2, MI_F3, MI_E3, MI_A3, MI_Cs4, MY_E4, MI_A4, MI_Cs5,
MI_Gs2, MI_As2, MI_Ds3, MI_F4, MI_E4, MI_Gs4, MI_B4, MI_E5, MI_Ds4
),
@@ -147,7 +277,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
_______, KC_VOLD, KC_VOLU, MI_VELD, MI_VELU, _______,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
- XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
+ TGLCHGR, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, VERSION,
_______, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
RGB_SAD, RGB_SAI, RGB_HUD, RGB_HUI, RGB_SPD, RGB_SPI, RGB_VAD, RGB_VAI,
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_RMOD, RGB_MOD, EE_CLR, RGB_TOG
@@ -166,6 +296,9 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
#endif
void my_init(void){
+ for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
+ my_tone_status[i] = MIDI_INVALID_NOTE;
+ }
// Set octave to 0
midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
@@ -193,6 +326,32 @@ void keyboard_post_init_user(void) {
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
};
+void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
+ uint8_t mytone = keycode - MY_TONE_MIN;
+ uint16_t mykeycode = mytone + MIDI_TONE_MIN;
+ // uint16_t mykeycode = keycode - MY_TONE_MIN;
+ // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
+ uint8_t velocity = midi_config.velocity;
+ // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
+ if (record->event.pressed) {
+ if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
+ uint8_t note = midi_compute_note(mykeycode);
+ midi_send_noteon(&midi_device, channel, note, velocity);
+ dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ my_tone_status[mytone] = note; // store root_note status.
+ }
+ } else {
+ uint8_t note = my_tone_status[mytone];
+ if (note != MIDI_INVALID_NOTE) {
+ midi_send_noteoff(&midi_device, channel, note, velocity);
+ dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ }
+ my_tone_status[mytone] = MIDI_INVALID_NOTE;
+ }
+}
+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
@@ -200,6 +359,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
}
break;
+
+ case TGLCHGR:
+ if (record->event.pressed) {
+ use_alt_ch_gr = !use_alt_ch_gr;
+ if (use_alt_ch_gr) {
+ midi_sub_ch = ALT_SUB_CH_NUMBER;
+ } else { // default
+ midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
+ }
+ }
+ break;
+
+ case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
+ // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
+ // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
+ my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
+ break;
}
return true;
}
@@ -207,7 +383,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
- uint8_t layer = biton32(layer_state);
+ uint8_t layer = get_highest_layer(layer_state);
switch (layer) {
case _CLOSE:
// rgb_matrix_set_color(pgm_read_byte(&convert_led_location2number[11]), RGB_RED); // RGB_TOG <- too heavy.
@@ -232,6 +408,8 @@ bool rgb_matrix_indicators_user(void) {
rgb_matrix_set_color(14, RGB_DARKYELLOW); // MI_VELD
rgb_matrix_set_color(25, RGB_DARKGREEN); // MI_VELU
+ rgb_matrix_set_color( 3, RGB_DARKSPRINGGREEN); // TGLCHGR
+
rgb_matrix_set_color( 6, RGB_DARKBLUE); // RGB_SAD
rgb_matrix_set_color( 9, RGB_DARKBLUE); // RGB_SAI
rgb_matrix_set_color(18, RGB_DARKBLUE); // RGB_HUD
From 6e5e6f5bd716e5a1992bb25a22cb4b75bfee5fd4 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Fri, 7 Apr 2023 23:33:46 +0900
Subject: [PATCH 07/10] Common codes moved to kb level. most of the info.json
modification done in develop branch has been applied.
---
keyboards/bandominedoni/bandominedoni.c | 26 +++
keyboards/bandominedoni/bandominedoni.h | 129 +++++++++++++++
keyboards/bandominedoni/info.json | 10 +-
.../bandominedoni/keymaps/default/keymap.c | 152 ------------------
keyboards/bandominedoni/keymaps/led/keymap.c | 146 -----------------
.../bandominedoni/keymaps/lednotg/keymap.c | 152 ------------------
keyboards/bandominedoni/keymaps/via/keymap.c | 4 -
7 files changed, 160 insertions(+), 459 deletions(-)
diff --git a/keyboards/bandominedoni/bandominedoni.c b/keyboards/bandominedoni/bandominedoni.c
index 47be95a62b1b..86cc67b3807c 100644
--- a/keyboards/bandominedoni/bandominedoni.c
+++ b/keyboards/bandominedoni/bandominedoni.c
@@ -16,6 +16,32 @@
#include "bandominedoni.h"
+void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
+ uint8_t mytone = keycode - MY_TONE_MIN;
+ uint16_t mykeycode = mytone + MIDI_TONE_MIN;
+ // uint16_t mykeycode = keycode - MY_TONE_MIN;
+ // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
+ uint8_t velocity = midi_config.velocity;
+ // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
+ if (record->event.pressed) {
+ if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
+ uint8_t note = midi_compute_note(mykeycode);
+ midi_send_noteon(&midi_device, channel, note, velocity);
+ dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
+ my_tone_status[mytone] = note; // store root_note status.
+ }
+ } else {
+ uint8_t note = my_tone_status[mytone];
+ if (note != MIDI_INVALID_NOTE) {
+ midi_send_noteoff(&midi_device, channel, note, velocity);
+ dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
+ }
+ my_tone_status[mytone] = MIDI_INVALID_NOTE;
+ }
+}
+
#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = {
diff --git a/keyboards/bandominedoni/bandominedoni.h b/keyboards/bandominedoni/bandominedoni.h
index b18259625847..d0b3abb5e229 100644
--- a/keyboards/bandominedoni/bandominedoni.h
+++ b/keyboards/bandominedoni/bandominedoni.h
@@ -77,6 +77,135 @@
#define MIS_EIS LT(_MISC,KC_LNG2)
#define MIS_KAN LT(_MISC,KC_LNG1)
+// define which MIDI ch to use.
+// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
+// ch1
+#define DEFAULT_SUB_CH_NUMBER 0
+// ch2
+#define ALT_SUB_CH_NUMBER 1
+
+enum custom_keycodes {
+ VERSION = QK_KB,
+ TGLCHGR, // ToGgLe CH GRoup
+
+ // MY tone to distinguish the notes to avoid sustain effect, etc.
+ MY_TONE_MIN,
+
+ MY_C = MY_TONE_MIN,
+ MY_Cs,
+ MY_Db = MY_Cs,
+ MY_D,
+ MY_Ds,
+ MY_Eb = MY_Ds,
+ MY_E,
+ MY_F,
+ MY_Fs,
+ MY_Gb = MY_Fs,
+ MY_G,
+ MY_Gs,
+ MY_Ab = MY_Gs,
+ MY_A,
+ MY_As,
+ MY_Bb = MY_As,
+ MY_B,
+
+ MY_C1,
+ MY_Cs1,
+ MY_Db1 = MY_Cs1,
+ MY_D1,
+ MY_Ds1,
+ MY_Eb1 = MY_Ds1,
+ MY_E1,
+ MY_F1,
+ MY_Fs1,
+ MY_Gb1 = MY_Fs1,
+ MY_G1,
+ MY_Gs1,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, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status);
// Overriding is_keyboard_left() in qmk_firmware/quantum/split_common/split_util.c to limit the handedness check only once.
// reason: bandoMIneDonI has no space on right hand side to use "SPLIT_HAND_MATRIX_GRID".
diff --git a/keyboards/bandominedoni/info.json b/keyboards/bandominedoni/info.json
index f0e9a62b08b2..32547863a0ee 100644
--- a/keyboards/bandominedoni/info.json
+++ b/keyboards/bandominedoni/info.json
@@ -17,16 +17,16 @@
"encoder": {
"enabled": true
},
- "diode_direction": "COL2ROW",
- "matrix_pins": {
- "cols": [ "D1", "E6", "F7", "B1", "B3", "B2", "D0" ],
- "rows": [ "B5", "B4", "D7", "F6", "C6", "D4" ]
- },
"usb": {
"vid": "0xFEED",
"pid": "0xF4B5",
"device_version": "0.0.1"
},
+ "matrix_pins": {
+ "cols": ["D1", "E6", "F7", "B1", "B3", "B2", "D0"],
+ "rows": ["B5", "B4", "D7", "F6", "C6", "D4"]
+ },
+ "diode_direction": "COL2ROW",
"split": {
"enabled": true,
"soft_serial_pin": "D2",
diff --git a/keyboards/bandominedoni/keymaps/default/keymap.c b/keyboards/bandominedoni/keymaps/default/keymap.c
index beeccdde01a9..1cffdddbd28e 100644
--- a/keyboards/bandominedoni/keymaps/default/keymap.c
+++ b/keyboards/bandominedoni/keymaps/default/keymap.c
@@ -16,12 +16,6 @@
#include QMK_KEYBOARD_H
#include "version.h"
-// define which MIDI ch to use.
-// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
-// ch1
-#define DEFAULT_SUB_CH_NUMBER 0
-// ch2
-#define ALT_SUB_CH_NUMBER 1
static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
@@ -40,126 +34,6 @@ enum layer_names {
_FN
};
-enum custom_keycodes {
- VERSION = SAFE_RANGE,
- TGLCHGR, // ToGgLe CH GRoup
-
- // MY tone to distinguish the notes to avoid sustain effect, etc.
- MY_TONE_MIN,
-
- MY_C = MY_TONE_MIN,
- MY_Cs,
- MY_Db = MY_Cs,
- MY_D,
- MY_Ds,
- MY_Eb = MY_Ds,
- MY_E,
- MY_F,
- MY_Fs,
- MY_Gb = MY_Fs,
- MY_G,
- MY_Gs,
- MY_Ab = MY_Gs,
- MY_A,
- MY_As,
- MY_Bb = MY_As,
- MY_B,
-
- MY_C1,
- MY_Cs1,
- MY_Db1 = MY_Cs1,
- MY_D1,
- MY_Ds1,
- MY_Eb1 = MY_Ds1,
- MY_E1,
- MY_F1,
- MY_Fs1,
- MY_Gb1 = MY_Fs1,
- MY_G1,
- MY_Gs1,
- MY_Ab1 = MY_Gs1,
- MY_A1,
- MY_As1,
- MY_Bb1 = MY_As1,
- MY_B1,
-
- MY_C2,
- MY_Cs2,
- MY_Db2 = MY_Cs2,
- MY_D2,
- MY_Ds2,
- MY_Eb2 = MY_Ds2,
- MY_E2,
- MY_F2,
- MY_Fs2,
- MY_Gb2 = MY_Fs2,
- MY_G2,
- MY_Gs2,
- MY_Ab2 = MY_Gs2,
- MY_A2,
- MY_As2,
- MY_Bb2 = MY_As2,
- MY_B2,
-
- MY_C3,
- MY_Cs3,
- MY_Db3 = MY_Cs3,
- MY_D3,
- MY_Ds3,
- MY_Eb3 = MY_Ds3,
- MY_E3,
- MY_F3,
- MY_Fs3,
- MY_Gb3 = MY_Fs3,
- MY_G3,
- MY_Gs3,
- MY_Ab3 = MY_Gs3,
- MY_A3,
- MY_As3,
- MY_Bb3 = MY_As3,
- MY_B3,
-
- MY_C4,
- MY_Cs4,
- MY_Db4 = MY_Cs4,
- MY_D4,
- MY_Ds4,
- MY_Eb4 = MY_Ds4,
- MY_E4,
- MY_F4,
- MY_Fs4,
- MY_Gb4 = MY_Fs4,
- MY_G4,
- MY_Gs4,
- MY_Ab4 = MY_Gs4,
- MY_A4,
- MY_As4,
- MY_Bb4 = MY_As4,
- MY_B4,
-
- MY_C5,
- MY_Cs5,
- MY_Db5 = MY_Cs5,
- MY_D5,
- MY_Ds5,
- MY_Eb5 = MY_Ds5,
- MY_E5,
- MY_F5,
- MY_Fs5,
- MY_Gb5 = MY_Fs5,
- MY_G5,
- MY_Gs5,
- MY_Ab5 = MY_Gs5,
- MY_A5,
- MY_As5,
- MY_Bb5 = MY_As5,
- MY_B5,
-
- MY_C6,
- MY_TONE_MAX = MY_C6
-};
-
-#define MY_TONE_COUNT (MY_TONE_MAX - MY_TONE_MIN + 1)
static uint8_t my_tone_status[MY_TONE_COUNT];
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
@@ -228,32 +102,6 @@ void keyboard_post_init_user(void) {
midi_config.velocity = MIDI_INITIAL_VELOCITY;
}
-void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
- uint8_t mytone = keycode - MY_TONE_MIN;
- uint16_t mykeycode = mytone + MIDI_TONE_MIN;
- // uint16_t mykeycode = keycode - MY_TONE_MIN;
- // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
- uint8_t velocity = midi_config.velocity;
- // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
- if (record->event.pressed) {
- if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
- uint8_t note = midi_compute_note(mykeycode);
- midi_send_noteon(&midi_device, channel, note, velocity);
- dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- my_tone_status[mytone] = note; // store root_note status.
- }
- } else {
- uint8_t note = my_tone_status[mytone];
- if (note != MIDI_INVALID_NOTE) {
- midi_send_noteoff(&midi_device, channel, note, velocity);
- dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- }
- my_tone_status[mytone] = MIDI_INVALID_NOTE;
- }
-}
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
diff --git a/keyboards/bandominedoni/keymaps/led/keymap.c b/keyboards/bandominedoni/keymaps/led/keymap.c
index 4692e508669d..9bc785965f6f 100644
--- a/keyboards/bandominedoni/keymaps/led/keymap.c
+++ b/keyboards/bandominedoni/keymaps/led/keymap.c
@@ -67,126 +67,6 @@ enum layer_names {
_FN
};
-enum custom_keycodes {
- VERSION = SAFE_RANGE,
- TGLCHGR, // ToGgLe CH GRoup
-
- // MY tone to distinguish the notes to avoid sustain effect, etc.
- MY_TONE_MIN,
-
- MY_C = MY_TONE_MIN,
- MY_Cs,
- MY_Db = MY_Cs,
- MY_D,
- MY_Ds,
- MY_Eb = MY_Ds,
- MY_E,
- MY_F,
- MY_Fs,
- MY_Gb = MY_Fs,
- MY_G,
- MY_Gs,
- MY_Ab = MY_Gs,
- MY_A,
- MY_As,
- MY_Bb = MY_As,
- MY_B,
-
- MY_C1,
- MY_Cs1,
- MY_Db1 = MY_Cs1,
- MY_D1,
- MY_Ds1,
- MY_Eb1 = MY_Ds1,
- MY_E1,
- MY_F1,
- MY_Fs1,
- MY_Gb1 = MY_Fs1,
- MY_G1,
- MY_Gs1,
- MY_Ab1 = MY_Gs1,
- MY_A1,
- MY_As1,
- MY_Bb1 = MY_As1,
- MY_B1,
-
- MY_C2,
- MY_Cs2,
- MY_Db2 = MY_Cs2,
- MY_D2,
- MY_Ds2,
- MY_Eb2 = MY_Ds2,
- MY_E2,
- MY_F2,
- MY_Fs2,
- MY_Gb2 = MY_Fs2,
- MY_G2,
- MY_Gs2,
- MY_Ab2 = MY_Gs2,
- MY_A2,
- MY_As2,
- MY_Bb2 = MY_As2,
- MY_B2,
-
- MY_C3,
- MY_Cs3,
- MY_Db3 = MY_Cs3,
- MY_D3,
- MY_Ds3,
- MY_Eb3 = MY_Ds3,
- MY_E3,
- MY_F3,
- MY_Fs3,
- MY_Gb3 = MY_Fs3,
- MY_G3,
- MY_Gs3,
- MY_Ab3 = MY_Gs3,
- MY_A3,
- MY_As3,
- MY_Bb3 = MY_As3,
- MY_B3,
-
- MY_C4,
- MY_Cs4,
- MY_Db4 = MY_Cs4,
- MY_D4,
- MY_Ds4,
- MY_Eb4 = MY_Ds4,
- MY_E4,
- MY_F4,
- MY_Fs4,
- MY_Gb4 = MY_Fs4,
- MY_G4,
- MY_Gs4,
- MY_Ab4 = MY_Gs4,
- MY_A4,
- MY_As4,
- MY_Bb4 = MY_As4,
- MY_B4,
-
- MY_C5,
- MY_Cs5,
- MY_Db5 = MY_Cs5,
- MY_D5,
- MY_Ds5,
- MY_Eb5 = MY_Ds5,
- MY_E5,
- MY_F5,
- MY_Fs5,
- MY_Gb5 = MY_Fs5,
- MY_G5,
- MY_Gs5,
- MY_Ab5 = MY_Gs5,
- MY_A5,
- MY_As5,
- MY_Bb5 = MY_As5,
- MY_B5,
-
- MY_C6,
- MY_TONE_MAX = MY_C6
-};
-
-#define MY_TONE_COUNT (MY_TONE_MAX - MY_TONE_MIN + 1)
static uint8_t my_tone_status[MY_TONE_COUNT];
// Alias layout macros that expand groups of keys.
@@ -326,32 +206,6 @@ void keyboard_post_init_user(void) {
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
};
-void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
- uint8_t mytone = keycode - MY_TONE_MIN;
- uint16_t mykeycode = mytone + MIDI_TONE_MIN;
- // uint16_t mykeycode = keycode - MY_TONE_MIN;
- // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
- uint8_t velocity = midi_config.velocity;
- // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
- if (record->event.pressed) {
- if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
- uint8_t note = midi_compute_note(mykeycode);
- midi_send_noteon(&midi_device, channel, note, velocity);
- dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- my_tone_status[mytone] = note; // store root_note status.
- }
- } else {
- uint8_t note = my_tone_status[mytone];
- if (note != MIDI_INVALID_NOTE) {
- midi_send_noteoff(&midi_device, channel, note, velocity);
- dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- }
- my_tone_status[mytone] = MIDI_INVALID_NOTE;
- }
-}
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
diff --git a/keyboards/bandominedoni/keymaps/lednotg/keymap.c b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
index 553dace2fede..ab364714f908 100644
--- a/keyboards/bandominedoni/keymaps/lednotg/keymap.c
+++ b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
@@ -18,12 +18,6 @@
#define DF_COLE DF(_COLEMAK)
-// define which MIDI ch to use.
-// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
-// ch1
-#define DEFAULT_SUB_CH_NUMBER 0
-// ch2
-#define ALT_SUB_CH_NUMBER 1
static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
@@ -67,126 +61,6 @@ enum layer_names {
_FN
};
-enum custom_keycodes {
- VERSION = SAFE_RANGE,
- TGLCHGR, // ToGgLe CH GRoup
-
- // MY tone to distinguish the notes to avoid sustain effect, etc.
- MY_TONE_MIN,
-
- MY_C = MY_TONE_MIN,
- MY_Cs,
-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5,
- MY_F5,
- MY_Fs5,
- MY_Gb5 = MY_Fs5,
- MY_G5,
- MY_Gs5,
- MY_Ab5 = MY_Gs5,
- MY_A5,
- MY_As5,
- MY_Bb5 = MY_As5,
- MY_B5,
-
- MY_C6,
- MY_TONE_MAX = MY_C6
-};
-
-#define MY_TONE_COUNT (MY_TONE_MAX - MY_TONE_MIN + 1)
static uint8_t my_tone_status[MY_TONE_COUNT];
// Alias layout macros that expand groups of keys.
@@ -326,32 +200,6 @@ void keyboard_post_init_user(void) {
rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
};
-void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
- uint8_t mytone = keycode - MY_TONE_MIN;
- uint16_t mykeycode = mytone + MIDI_TONE_MIN;
- // uint16_t mykeycode = keycode - MY_TONE_MIN;
- // uint8_t mytone = mykeycode - MIDI_TONE_MIN;
- uint8_t velocity = midi_config.velocity;
- // uprintf("keycode=%u,mykeycode=%u,mytone =%u,velo = %u\n", keycode, mykeycode, mytone, velocity);
- if (record->event.pressed) {
- if (my_tone_status[mytone] == MIDI_INVALID_NOTE) {
- uint8_t note = midi_compute_note(mykeycode);
- midi_send_noteon(&midi_device, channel, note, velocity);
- dprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- // uprintf("midi noteon channel:%d note:%d mytone:%d velocity:%d\n", channel, note, mytone, velocity);
- my_tone_status[mytone] = note; // store root_note status.
- }
- } else {
- uint8_t note = my_tone_status[mytone];
- if (note != MIDI_INVALID_NOTE) {
- midi_send_noteoff(&midi_device, channel, note, velocity);
- dprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- // uprintf("midi noteoff channel:%d note:%d velocity:%d\n", channel, note, velocity);
- }
- my_tone_status[mytone] = MIDI_INVALID_NOTE;
- }
-}
-
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case VERSION: // Output firmware info.
diff --git a/keyboards/bandominedoni/keymaps/via/keymap.c b/keyboards/bandominedoni/keymaps/via/keymap.c
index 84ccc1d37e0e..88e103c9b7b4 100644
--- a/keyboards/bandominedoni/keymaps/via/keymap.c
+++ b/keyboards/bandominedoni/keymaps/via/keymap.c
@@ -29,10 +29,6 @@ enum layer_names {
_FN
};
-enum custom_keycodes {
- VERSION = QK_KB_0
-};
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_OPEN] = LAYOUT(
MI_Gs1, MI_As1, MI_Cs2, MI_F2, MI_Gs3,
From f78781ec340d0bb68dddb5ee64ce674d761d3195 Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Sat, 8 Apr 2023 11:26:45 +0900
Subject: [PATCH 08/10] process_record_kb etc. is used to remove duplicate
definitions.
---
keyboards/bandominedoni/bandominedoni.c | 84 ++++++++++++++++
keyboards/bandominedoni/bandominedoni.h | 23 +++++
.../bandominedoni/keymaps/default/keymap.c | 48 ---------
keyboards/bandominedoni/keymaps/led/keymap.c | 98 -------------------
.../bandominedoni/keymaps/lednotg/keymap.c | 92 -----------------
keyboards/bandominedoni/keymaps/via/keymap.c | 37 -------
6 files changed, 107 insertions(+), 275 deletions(-)
diff --git a/keyboards/bandominedoni/bandominedoni.c b/keyboards/bandominedoni/bandominedoni.c
index 86cc67b3807c..b733a569957f 100644
--- a/keyboards/bandominedoni/bandominedoni.c
+++ b/keyboards/bandominedoni/bandominedoni.c
@@ -15,6 +15,15 @@
*/
#include "bandominedoni.h"
+#include "version.h"
+
+static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
+
+// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
+// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
+static bool use_alt_ch_gr = false;
+
+static uint8_t my_tone_status[MY_TONE_COUNT];
void my_process_midi4single_note(uint8_t channel, uint16_t keycode, keyrecord_t *record, uint8_t *my_tone_status) {
uint8_t mytone = keycode - MY_TONE_MIN;
@@ -143,3 +152,78 @@ static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN;
return (hand_side == LEFT);
}
}
+
+void my_init(void){
+#ifndef VIA_ENABLE
+ for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
+ my_tone_status[i] = MIDI_INVALID_NOTE;
+ }
+#endif
+
+ // Set octave to 0
+ midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
+
+ // avoid using 127 since it is used as a special number in some sound sources.
+ midi_config.velocity = MIDI_INITIAL_VELOCITY;
+}
+
+void eeconfig_init_kb(void) {
+ midi_init();
+ my_init();
+#ifdef RGB_MATRIX_ENABLE
+ rgb_matrix_enable();
+ rgb_matrix_set_speed(RGB_MATRIX_DEFAULT_SPD);
+ rgb_matrix_sethsv(HSV_BLUE);
+
+ rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE);
+ // rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
+#endif
+ eeconfig_init_user();
+}
+
+void keyboard_post_init_kb(void) {
+ my_init();
+
+#ifdef RGB_MATRIX_ENABLE
+# ifndef VIA_ENABLE
+ // party mode (for LED soldering test. Enable rainbow color effect, and disable led_indicator to check all LEDs)
+ rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
+# else
+ rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE);
+# endif
+#endif
+
+ keyboard_post_init_user();
+}
+
+bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
+ if (!process_record_user(keycode, record)) {
+ return false;
+ }
+
+ switch (keycode) {
+ case VERSION: // Output firmware info.
+ if (record->event.pressed) {
+ SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
+ }
+ break;
+
+ case TGLCHGR:
+ if (record->event.pressed) {
+ use_alt_ch_gr = !use_alt_ch_gr;
+ if (use_alt_ch_gr) {
+ midi_sub_ch = ALT_SUB_CH_NUMBER;
+ } else { // default
+ midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
+ }
+ }
+ break;
+
+ case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
+ // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
+ // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
+ my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
+ break;
+ }
+ return true;
+}
diff --git a/keyboards/bandominedoni/bandominedoni.h b/keyboards/bandominedoni/bandominedoni.h
index d0b3abb5e229..655432218482 100644
--- a/keyboards/bandominedoni/bandominedoni.h
+++ b/keyboards/bandominedoni/bandominedoni.h
@@ -74,9 +74,32 @@
// Long press: go to _FN layer, tap: MUTE
#define FN_MUTE LT(_FN, KC_MUTE)
#define DF_QWER DF(_QWERTY)
+#define DF_COLE DF(_COLEMAK)
#define MIS_EIS LT(_MISC,KC_LNG2)
#define MIS_KAN LT(_MISC,KC_LNG1)
+#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
+#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
+#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
+
+#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
+#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
+#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
+
+#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
+#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
+#define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B
+
+#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
+#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O
+#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
+
+#define _________________NUMBER_L__________________ KC_1, KC_2, KC_3, KC_4, KC_5
+// #define _________________NUMBER_R__________________ KC_6, KC_7, KC_8, KC_9, KC_0
+
+#define _________________FUNC__L___________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
+// #define _________________FUNC__R___________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
+
// define which MIDI ch to use.
// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
// ch1
diff --git a/keyboards/bandominedoni/keymaps/default/keymap.c b/keyboards/bandominedoni/keymaps/default/keymap.c
index 1cffdddbd28e..d116e352698f 100644
--- a/keyboards/bandominedoni/keymaps/default/keymap.c
+++ b/keyboards/bandominedoni/keymaps/default/keymap.c
@@ -14,13 +14,6 @@
* along with this program. If not, see .
*/
#include QMK_KEYBOARD_H
-#include "version.h"
-
-static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
-
-// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
-// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
-static bool use_alt_ch_gr = false;
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@@ -34,8 +27,6 @@ enum layer_names {
_FN
};
-static uint8_t my_tone_status[MY_TONE_COUNT];
-
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_OPEN] = LAYOUT(
MY_Gs1, MY_As1, MY_Cs2, MY_F2, MY_Gs3,
@@ -90,42 +81,3 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
[_FN] = { ENCODER_CCW_CW(_______, _______) },
};
#endif
-
-void keyboard_post_init_user(void) {
- for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
- my_tone_status[i] = MIDI_INVALID_NOTE;
- }
- // Set octave to 0
- midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
-
- // avoid using 127 since it is used as a special number in some sound sources.
- midi_config.velocity = MIDI_INITIAL_VELOCITY;
-}
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VERSION: // Output firmware info.
- if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
- }
- break;
-
- case TGLCHGR:
- if (record->event.pressed) {
- use_alt_ch_gr = !use_alt_ch_gr;
- if (use_alt_ch_gr) {
- midi_sub_ch = ALT_SUB_CH_NUMBER;
- } else { // default
- midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
- }
- }
- break;
-
- case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
- // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
- // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
- my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
- break;
- }
- return true;
-}
diff --git a/keyboards/bandominedoni/keymaps/led/keymap.c b/keyboards/bandominedoni/keymaps/led/keymap.c
index 9bc785965f6f..b01560f7d5ba 100644
--- a/keyboards/bandominedoni/keymaps/led/keymap.c
+++ b/keyboards/bandominedoni/keymaps/led/keymap.c
@@ -14,43 +14,6 @@
* along with this program. If not, see .
*/
#include QMK_KEYBOARD_H
-#include "version.h"
-
-#define DF_COLE DF(_COLEMAK)
-
-// define which MIDI ch to use.
-// Note that (actual MIDI ch# - 1) -> 0 .. 15 is used for coding.
-// ch1
-#define DEFAULT_SUB_CH_NUMBER 0
-// ch2
-#define ALT_SUB_CH_NUMBER 1
-static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
-
-// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
-// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
-static bool use_alt_ch_gr = false;
-
-#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
-#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
-#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
-
-#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
-#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
-#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
-
-#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
-#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
-#define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B
-
-#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
-#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O
-#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
-
-#define _________________NUMBER_L__________________ KC_1, KC_2, KC_3, KC_4, KC_5
-// #define _________________NUMBER_R__________________ KC_6, KC_7, KC_8, KC_9, KC_0
-
-#define _________________FUNC__L___________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
-// #define _________________FUNC__R___________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@@ -67,8 +30,6 @@ enum layer_names {
_FN
};
-static uint8_t my_tone_status[MY_TONE_COUNT];
-
// Alias layout macros that expand groups of keys.
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
@@ -175,65 +136,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
};
#endif
-void my_init(void){
- for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
- my_tone_status[i] = MIDI_INVALID_NOTE;
- }
- // Set octave to 0
- midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
-
- // avoid using 127 since it is used as a special number in some sound sources.
- midi_config.velocity = MIDI_INITIAL_VELOCITY;
-}
-
-void eeconfig_init_user(void) { // EEPROM is getting reset!
- midi_init();
- my_init();
-#ifdef RGB_MATRIX_ENABLE
- rgb_matrix_enable();
- rgb_matrix_set_speed(RGB_MATRIX_DEFAULT_SPD);
- rgb_matrix_sethsv(HSV_BLUE);
-
- rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE);
- // rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
-#endif
-}
-
-void keyboard_post_init_user(void) {
- my_init();
-
- // party mode (for LED soldering test. Enable rainbow color effect, and disable led_indicator to check all LEDs)
- rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VERSION: // Output firmware info.
- if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
- }
- break;
-
- case TGLCHGR:
- if (record->event.pressed) {
- use_alt_ch_gr = !use_alt_ch_gr;
- if (use_alt_ch_gr) {
- midi_sub_ch = ALT_SUB_CH_NUMBER;
- } else { // default
- midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
- }
- }
- break;
-
- case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
- // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
- // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
- my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
- break;
- }
- return true;
-}
-
#ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
diff --git a/keyboards/bandominedoni/keymaps/lednotg/keymap.c b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
index ab364714f908..045f139546c6 100644
--- a/keyboards/bandominedoni/keymaps/lednotg/keymap.c
+++ b/keyboards/bandominedoni/keymaps/lednotg/keymap.c
@@ -14,37 +14,6 @@
* along with this program. If not, see .
*/
#include QMK_KEYBOARD_H
-#include "version.h"
-
-#define DF_COLE DF(_COLEMAK)
-
-static uint8_t midi_sub_ch = DEFAULT_SUB_CH_NUMBER; // By default, DEFAULT_SUB_CH_NUMBER is used for sub ch.
-
-// By default( when use_alt_ch_gr == false), DEFAULT ch group (DEFAULT_MAIN_CH_NUMBER for entirely, or right side when separated, DEFAULT_SUB_CH_NUMBER for left side) is used.
-// When false, ALT ch group (ALT_MAIN_CH_NUMBER for entirely, or right side when separated, ALT_SUB_CH_NUMBER for left side) is used.
-static bool use_alt_ch_gr = false;
-
-#define _________________QWERTY_L1_________________ KC_Q, KC_W, KC_E, KC_R, KC_T
-#define _________________QWERTY_L2_________________ KC_A, KC_S, KC_D, KC_F, KC_G
-#define _________________QWERTY_L3_________________ KC_Z, KC_X, KC_C, KC_V, KC_B
-
-#define _________________QWERTY_R1_________________ KC_Y, KC_U, KC_I, KC_O, KC_P
-#define _________________QWERTY_R2_________________ KC_H, KC_J, KC_K, KC_L, KC_SCLN
-#define _________________QWERTY_R3_________________ KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH
-
-#define _________________COLEMAK_L1________________ KC_Q, KC_W, KC_F, KC_P, KC_G
-#define _________________COLEMAK_L2________________ KC_A, KC_R, KC_S, KC_T, KC_D
-#define _________________COLEMAK_L3________________ KC_Z, KC_X, KC_C, KC_V, KC_B
-
-#define _________________COLEMAK_R1________________ KC_J, KC_L, KC_U, KC_Y, KC_SCLN
-#define _________________COLEMAK_R2________________ KC_H, KC_N, KC_E, KC_I, KC_O
-#define _________________COLEMAK_R3________________ KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH
-
-#define _________________NUMBER_L__________________ KC_1, KC_2, KC_3, KC_4, KC_5
-// #define _________________NUMBER_R__________________ KC_6, KC_7, KC_8, KC_9, KC_0
-
-#define _________________FUNC__L___________________ KC_F1, KC_F2, KC_F3, KC_F4, KC_F5
-// #define _________________FUNC__R___________________ KC_F6, KC_F7, KC_F8, KC_F9, KC_F10
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@@ -61,8 +30,6 @@ enum layer_names {
_FN
};
-static uint8_t my_tone_status[MY_TONE_COUNT];
-
// Alias layout macros that expand groups of keys.
#define LAYOUT_wrapper(...) LAYOUT(__VA_ARGS__)
@@ -169,65 +136,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
};
#endif
-void my_init(void){
- for (uint8_t i = 0; i < MY_TONE_COUNT; i++) {
- my_tone_status[i] = MIDI_INVALID_NOTE;
- }
- // Set octave to 0
- midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
-
- // avoid using 127 since it is used as a special number in some sound sources.
- midi_config.velocity = MIDI_INITIAL_VELOCITY;
-}
-
-void eeconfig_init_user(void) { // EEPROM is getting reset!
- midi_init();
- my_init();
-#ifdef RGB_MATRIX_ENABLE
- rgb_matrix_enable();
- rgb_matrix_set_speed(RGB_MATRIX_DEFAULT_SPD);
- rgb_matrix_sethsv(HSV_BLUE);
-
- rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE);
- // rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
-#endif
-}
-
-void keyboard_post_init_user(void) {
- my_init();
-
- // party mode (for LED soldering test. Enable rainbow color effect, and disable led_indicator to check all LEDs)
- rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VERSION: // Output firmware info.
- if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
- }
- break;
-
- case TGLCHGR:
- if (record->event.pressed) {
- use_alt_ch_gr = !use_alt_ch_gr;
- if (use_alt_ch_gr) {
- midi_sub_ch = ALT_SUB_CH_NUMBER;
- } else { // default
- midi_sub_ch = DEFAULT_SUB_CH_NUMBER;
- }
- }
- break;
-
- case MY_TONE_MIN ... MY_TONE_MAX: // MY tone
- // uprintf("keycode=%u, MY_C3=%u, MY_Db2 =%u, MY_MIN = %u, MY_MAX = %u\n", keycode, MY_C3, MY_Db2, MY_TONE_MIN, MY_TONE_MAX);
- // DO NOT THROW BELOW into 'if (record->event.pressed) {}' STATEMENT SINCE IT IS USED IN THE FUNCTION BELOW.
- my_process_midi4single_note(midi_sub_ch, keycode, record, my_tone_status);
- break;
- }
- return true;
-}
-
#ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
diff --git a/keyboards/bandominedoni/keymaps/via/keymap.c b/keyboards/bandominedoni/keymaps/via/keymap.c
index 88e103c9b7b4..ba03ed69cb3a 100644
--- a/keyboards/bandominedoni/keymaps/via/keymap.c
+++ b/keyboards/bandominedoni/keymaps/via/keymap.c
@@ -14,7 +14,6 @@
* along with this program. If not, see .
*/
#include QMK_KEYBOARD_H
-#include "version.h"
// Defines names for use in layer keycodes and the keymap
enum layer_names {
@@ -100,42 +99,6 @@ const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][2] = {
};
#endif
-void my_init(void){
- // Set octave to 0
- midi_config.octave = QK_MIDI_OCTAVE_0 - MIDI_OCTAVE_MIN;
-
- // avoid using 127 since it is used as a special number in some sound sources.
- midi_config.velocity = MIDI_INITIAL_VELOCITY;
-}
-
-void eeconfig_init_user(void) { // EEPROM is getting reset!
- midi_init();
- my_init();
-#ifdef RGB_MATRIX_ENABLE
- rgb_matrix_enable();
- rgb_matrix_set_speed(RGB_MATRIX_DEFAULT_SPD);
- rgb_matrix_sethsv(HSV_BLUE);
-
- rgb_matrix_mode(RGB_MATRIX_SOLID_REACTIVE);
- // rgb_matrix_mode(RGB_MATRIX_RAINBOW_MOVING_CHEVRON);
-#endif
-}
-
-void keyboard_post_init_user(void) {
- my_init();
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
- switch (keycode) {
- case VERSION: // Output firmware info.
- if (record->event.pressed) {
- SEND_STRING(QMK_KEYBOARD ":" QMK_KEYMAP " @ " QMK_VERSION " " QMK_GIT_HASH " | " QMK_BUILDDATE);
- }
- break;
- }
- return true;
-}
-
#ifdef RGB_MATRIX_ENABLE
bool rgb_matrix_indicators_user(void) {
if (rgb_matrix_is_enabled()) { // turn the lights on when it is enabled.
From 986b5cfae4020ba1c94d8c201c2838fcac8d290d Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Mon, 10 Apr 2023 19:35:28 +0900
Subject: [PATCH 09/10] develop branch's info.json mod applied.
---
keyboards/bandominedoni/config.h | 2 --
keyboards/bandominedoni/info.json | 3 +++
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/keyboards/bandominedoni/config.h b/keyboards/bandominedoni/config.h
index df9c7cf5fc7a..91a4eb0ae800 100644
--- a/keyboards/bandominedoni/config.h
+++ b/keyboards/bandominedoni/config.h
@@ -23,8 +23,6 @@
#define SPLIT_USB_DETECT
-#define RGB_DI_PIN D3
-
#ifdef RGB_MATRIX_ENABLE
/* ws2812 RGB MATRIX */
diff --git a/keyboards/bandominedoni/info.json b/keyboards/bandominedoni/info.json
index 32547863a0ee..b4c0d1a9a506 100644
--- a/keyboards/bandominedoni/info.json
+++ b/keyboards/bandominedoni/info.json
@@ -38,6 +38,9 @@
}
}
},
+ "ws2812": {
+ "pin": "D3"
+ },
"processor": "atmega32u4",
"bootloader": "caterina",
"layouts": {
From 4c5723495eaf421a83221f41921dbb4badce84dd Mon Sep 17 00:00:00 2001
From: 3araht <3araht@gmail.com>
Date: Mon, 10 Apr 2023 20:32:46 +0900
Subject: [PATCH 10/10] QK_USER is used for MY_TONE keycodes.
---
keyboards/bandominedoni/bandominedoni.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/keyboards/bandominedoni/bandominedoni.h b/keyboards/bandominedoni/bandominedoni.h
index 655432218482..e8f7c5061a9a 100644
--- a/keyboards/bandominedoni/bandominedoni.h
+++ b/keyboards/bandominedoni/bandominedoni.h
@@ -112,7 +112,8 @@ enum custom_keycodes {
TGLCHGR, // ToGgLe CH GRoup
// MY tone to distinguish the notes to avoid sustain effect, etc.
- MY_TONE_MIN,
+ // Since the # of codes exceeds the limit of QK_KB range (=64), these are stated here.
+ MY_TONE_MIN = QK_USER,
MY_C = MY_TONE_MIN,
MY_Cs,