Skip to content

Commit

Permalink
[Keyboard] add bandominedoni keyboard (qmk#13116)
Browse files Browse the repository at this point in the history
  • Loading branch information
3araht authored Sep 21, 2021
1 parent c8a5869 commit cebc568
Show file tree
Hide file tree
Showing 16 changed files with 1,249 additions and 0 deletions.
151 changes: 151 additions & 0 deletions keyboards/bandominedoni/bandominedoni.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
/* Copyright 2021 3araht
*
* 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 <http://www.gnu.org/licenses/>.
*/

#include "bandominedoni.h"

#ifdef RGB_MATRIX_ENABLE

led_config_t g_led_config = {
{
{ 75, 46, 45, 44, 43, 42, NO_LED }, \
{ 47, 48, 49, 50, 51, 52, 53 }, \
{ 60, 59, 58, 57, 56, 55, 54 }, \
{ 61, 62, 63, 64, 65, 66, 67 }, \
{ 74, 73, 72, 71, 70, 69, 68 }, \
{ NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED, NO_LED }, \
{ 7, 6, 4, 3, 2, 1, 5}, \
{ 8, 9, 10, 11, 12, 13, 0 }, \
{ 19, 18, 17, 16, 15, 14, 41 }, \
{ 20, 21, 22, 23, 24, 25, 40 }, \
{ 30, 29, 28, 27, 26, 39, 38 }, \
{ 31, 32, 33, 34, 35, 36, 37 }
}, {
{ 145, 6 }, { 157, 5 }, { 153, 14 }, { 149, 22 }, { 145, 32 }, { 136, 35 }, { 139, 48 }, { 134, 61 },
{ 142, 60 }, { 148, 43 }, { 154, 29 }, { 158, 20 }, { 163, 12 }, { 168, 4 },
{ 178, 5 }, { 173, 12 }, { 168, 20 }, { 163, 28 }, { 157, 40 }, { 151, 55 },
{ 160, 52 }, { 166, 39 }, { 172, 28 }, { 177, 20 }, { 182, 13 }, { 188, 7 },
{ 192, 17 }, { 186, 23 }, { 181, 30 }, { 175, 39 }, { 169, 50 },
{ 178, 51 }, { 184, 41 }, { 190, 33 }, { 196, 27 },
{ 199, 37 }, { 193, 45 }, { 187, 53 },
{ 196, 56 }, { 202, 49 },
{ 205, 61 },
{ 202, 4 },
{ 84, 18 }, { 73, 13 }, { 62, 10 }, { 51, 8 }, { 39, 11 }, { 24, 22 },
{ 34, 19 }, { 45, 16 }, { 56, 16 }, { 66, 18 }, { 77, 22 }, { 87, 28 },
{ 92, 40 }, { 81, 32 }, { 71, 27 }, { 61, 24 }, { 51, 24 }, { 41, 24 }, { 30, 28 },
{ 24, 42 }, { 34, 37 }, { 44, 35 }, { 54, 34 }, { 64, 36 }, { 74, 38 }, { 84, 44 },
{ 87, 54 }, { 77, 49 }, { 67, 47 }, { 57, 45 }, { 47, 45 }, { 37, 48 }, { 27, 52 }, { 19, 56 },
}, {
4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4,
4, 4, 4, 4,
4, 4, 4,
4, 4,
4,
4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4
}
};
#endif

#if defined(SPLIT_HAND_MATRIX_GRID)
static uint8_t peek_matrix_intersection(pin_t out_pin, pin_t in_pin) {
setPinInputHigh(in_pin);
setPinOutput(out_pin);
writePinLow(out_pin);
// It's almost unnecessary, but wait until it's down to low, just in case.
wait_us(1);
uint8_t pin_state = readPin(in_pin);
// Set out_pin to a setting that is less susceptible to noise.
setPinInputHigh(out_pin);
matrix_io_delay(); // Wait for the pull-up to go HIGH.
return pin_state;
}
#endif

// 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".
// 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) {
static enum { UNKNOWN, LEFT, RIGHT } hand_side = UNKNOWN;

// only check once, as this is called often
if (hand_side == UNKNOWN) {
#if defined(SPLIT_HAND_PIN)
// Test pin SPLIT_HAND_PIN for High/Low, if low it's right hand
setPinInput(SPLIT_HAND_PIN);
hand_side = readPin(SPLIT_HAND_PIN) ? LEFT : RIGHT;
return (hand_side == LEFT);
#elif defined(SPLIT_HAND_MATRIX_GRID)
# ifdef SPLIT_HAND_MATRIX_GRID_LOW_IS_RIGHT
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? LEFT : RIGHT;
return (hand_side == LEFT);
# else
hand_side = peek_matrix_intersection(SPLIT_HAND_MATRIX_GRID) ? RIGHT : LEFT;
return (hand_side == LEFT);
# endif
#elif defined(EE_HANDS)
hand_side = eeconfig_read_handedness() ? LEFT : RIGHT;
return (hand_side == LEFT);
#elif defined(MASTER_RIGHT)
hand_side = !is_keyboard_master() ? LEFT : RIGHT;
return (hand_side == LEFT);
#endif
hand_side = is_keyboard_master() ? LEFT : RIGHT;
return (hand_side == LEFT);
} else {
return (hand_side == LEFT);
}
}

#ifdef ENCODER_ENABLE
const uint16_t rt_matrix[2][2] = {
{5, 5}, {5, 6}
};

bool encoder_update_kb(uint8_t index, bool clockwise) {
if (index == 1) { /* An encoder on the right side */
keypos_t key;
int cw = 0;
cw = clockwise ? 1 : 0;
key.row = rt_matrix[cw][0];
key.col = rt_matrix[cw][1];
uint8_t layer = layer_switch_get_layer(key);
uint16_t keycode = keymap_key_to_keycode(layer, key);
keyrecord_t record;
record.event.key = key;

if (keycode < MI_ON){
tap_code16(keycode);
} else {
record.event.pressed = true;
process_midi(keycode, &record);
wait_ms(TAP_CODE_DELAY);
record.event.pressed = false;
process_midi(keycode, &record);
}

}
return true;
}
#endif // ENCODER_ENABLE
84 changes: 84 additions & 0 deletions keyboards/bandominedoni/bandominedoni.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/* Copyright 2021 3araht
*
* 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 <http://www.gnu.org/licenses/>.
*/

#pragma once

#include "quantum.h"

/* This is a shortcut to help you visually see your layout.
*
* The first section contains all of the arguments representing the physical
* layout of the board and position of the keys.
*
* The second converts the arguments into a two-dimensional array which
* represents the switch matrix.
*/

// oc: for Open Close selection pedal
// fn: function layer

#define LAYOUT( \
l00, l01, l02, l03, l04, \
l10, l11, l12, l13, l14, l15, l16, \
l20, l21, l22, l23, l24, l25, l26, \
l30, l31, l32, l33, l34, l35, l36, \
l40, l41, l42, l43, l44, l45, l46, l47, \
\
oc, r00, r01, r02, r03, fn, \
r10, r11, r12, r13, r14, ccw, cw,\
r20, r21, r22, r23, r24, r25, \
r30, r31, r32, r33, r34, r35, r36, r37, \
r40, r41, r42, r43, r44, r45, r46, r47, \
r50, r51, r52, r53, r54, r55, r56, r57, r58 \
) { \
{ l40, l00, l01, l02, l03, l04, KC_NO }, \
{ l10, l11, l12, l13, l14, l15, l16 }, \
{ l20, l21, l22, l23, l24, l25, l26 }, \
{ l30, l31, l32, l33, l34, l35, l36 }, \
{ l41, l42, l43, l44, l45, l46, l47 }, \
{ KC_NO, KC_NO, KC_NO, KC_NO, KC_NO, ccw, cw }, \
{ r50, r40, r31, r20, r10, r00, r30 }, \
{ r51, r41, r32, r21, r11, r01, oc }, \
{ r52, r42, r33, r22, r12, r02, fn }, \
{ r53, r43, r34, r23, r13, r03, r58 }, \
{ r54, r44, r35, r24, r14, r47, r57 }, \
{ r55, r45, r36, r25, r37, r46, r56 } \
}

// Uncomment below if a pedal used for Open/Close is normally-on type (such as Yamaha's.)
// #define PEDAL_NORMALLY_CLOSED

#ifdef PEDAL_NORMALLY_CLOSED
# define MO_SWAP MO(_OPEN)
# define DF_SWAP DF(_CLOSE)
# define TG_SWAP TG(_OPEN)
#else
# define MO_SWAP MO(_CLOSE)
# define DF_SWAP DF(_OPEN)
# define TG_SWAP TG(_CLOSE)
#endif

// Long press: go to _FN layer, tap: MUTE
#define FN_MUTE LT(_FN, KC_MUTE)
#define DF_QWER DF(_QWERTY)
#define MIS_EIS LT(_MISC,KC_LANG2)
#define MIS_KAN LT(_MISC,KC_LANG1)


// 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".
// 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);
Loading

0 comments on commit cebc568

Please sign in to comment.