Skip to content

Commit 85b052b

Browse files
AnanyaKirtidrashnafauxpark
authored
[Keyboard] add support for Bobpad (#13989)
Co-authored-by: Drashna Jaelre <[email protected]> Co-authored-by: Ryan <[email protected]>
1 parent 22dd685 commit 85b052b

File tree

9 files changed

+344
-0
lines changed

9 files changed

+344
-0
lines changed

keyboards/bobpad/bobpad.c

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/* Copyright 2021 Ananya Kirti
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#include "bobpad.h"
18+
19+
bool led_update_kb(led_t led_state) {
20+
if (!led_update_user(led_state)) { return false; }
21+
22+
writePin(LED_CAPS_LOCK_PIN, led_state.caps_lock);
23+
return true;
24+
};
25+
26+
bool encoder_update_kb(uint8_t index, bool clockwise) {
27+
if (!encoder_update_user(index, clockwise)) { return false; }
28+
29+
if(IS_LAYER_ON(1)) { // on Raise layer
30+
if (clockwise) {
31+
tap_code(KC_A);
32+
} else {
33+
tap_code(KC_B);
34+
}
35+
}
36+
// default layer
37+
else {
38+
if (clockwise) {
39+
tap_code(KC_C);
40+
} else {
41+
tap_code(KC_D);
42+
}
43+
}
44+
return true;
45+
}

keyboards/bobpad/bobpad.h

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright 2021 Ananya Kirti
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#pragma once
18+
19+
#include "quantum.h"
20+
21+
#define LAYOUT_ortho_2x3( \
22+
K00, K01, K02, \
23+
K10, K11, K12 \
24+
) { \
25+
{ K00, K01, K02 }, \
26+
{ K10, K11, K12 }, \
27+
}

keyboards/bobpad/config.h

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* Copyright 2021 Ananya Kirti
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#pragma once
18+
19+
#include "config_common.h"
20+
21+
/* USB Device descriptor parameter */
22+
#define VENDOR_ID 0x416B
23+
#define PRODUCT_ID 0x0002
24+
#define DEVICE_VER 0x0001
25+
#define MANUFACTURER Desiboards
26+
#define PRODUCT bobpad
27+
28+
/* key matrix size */
29+
#define MATRIX_ROWS 2
30+
#define MATRIX_COLS 3
31+
32+
/*
33+
* Keyboard Matrix Assignments
34+
*
35+
* Change this to how you wired your keyboard
36+
* COLS: AVR pins used for columns, left to right
37+
* ROWS: AVR pins used for rows, top to bottom
38+
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
39+
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
40+
*
41+
*/
42+
#define MATRIX_ROW_PINS { F7, B1 }
43+
#define MATRIX_COL_PINS { F6, F5, F4 }
44+
45+
#define DIODE_DIRECTION COL2ROW
46+
47+
48+
49+
50+
51+
// D4 D0
52+
// C6 E6 D7
53+
54+
#define LED_NUM_LOCK_PIN D4
55+
#define LED_CAPS_LOCK_PIN D0
56+
#define LED_SCROLL_LOCK_PIN C6
57+
#define LED_COMPOSE_PIN E6
58+
#define LED_KANA_PIN D7
59+
60+
61+
62+
#define ENCODERS_PAD_A { B3 }
63+
#define ENCODERS_PAD_B { B2 }

keyboards/bobpad/info.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"keyboard_name": "bobPad",
3+
"url": "",
4+
"maintainer": "Ananya Kirti",
5+
"layouts": {
6+
"LAYOUT_ortho_2x3": {
7+
"layout": [
8+
{"label":"K00 (B0,B2)", "x":0, "y":0},
9+
{"label":"K01 (B0,B3)", "x":1, "y":0},
10+
{"label":"K02 (B0,B4)", "x":2, "y":0},
11+
{"label":"K10 (B1,B2)", "x":0, "y":1},
12+
{"label":"K11 (B1,B3)", "x":1, "y":1},
13+
{"label":"K12 (B1,B4)", "x":2, "y":1}
14+
]
15+
}
16+
}
17+
}
+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/* Copyright 2021 Ananya Kirti
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
#include QMK_KEYBOARD_H
18+
19+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
20+
[0] = LAYOUT_ortho_2x3(
21+
KC_CAPSLOCK, MO(1), KC_PGUP,
22+
KC_DEL, KC_END, KC_PGDN
23+
),
24+
[1] = LAYOUT_ortho_2x3(
25+
KC_CAPSLOCK, MO(1), KC_PGUP,
26+
KC_DEL, KC_END, KC_PGDN
27+
),
28+
29+
};
30+
31+
layer_state_t layer_state_set_user(layer_state_t state) {
32+
writePin(D0, IS_LAYER_ON_STATE(state, 1));
33+
34+
return state;
35+
}

keyboards/bobpad/keymaps/via/keymap.c

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/* Copyright 2021 Ananya Kirti
2+
*
3+
* This program is free software: you can redistribute it and/or modify
4+
* it under the terms of the GNU General Public License as published by
5+
* the Free Software Foundation, either version 2 of the License, or
6+
* (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful,
9+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
* GNU General Public License for more details.
12+
*
13+
* You should have received a copy of the GNU General Public License
14+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15+
*/
16+
17+
18+
#include QMK_KEYBOARD_H
19+
20+
21+
bool is_alt_tab_active = false;
22+
uint16_t alt_tab_timer = 0;
23+
24+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
25+
[0] = LAYOUT_ortho_2x3(
26+
KC_MEDIA_STOP, KC_MEDIA_PLAY_PAUSE, KC__MUTE,
27+
KC_MEDIA_REWIND, KC_MEDIA_FAST_FORWARD, KC_PGDN
28+
),
29+
[1] = LAYOUT_ortho_2x3(
30+
_______, _______, _______,
31+
_______, _______, _______
32+
),
33+
[2] = LAYOUT_ortho_2x3(
34+
_______, _______, _______,
35+
_______, _______, _______
36+
),
37+
[3] = LAYOUT_ortho_2x3(
38+
_______, _______, _______,
39+
_______, _______, _______
40+
),
41+
};
42+
43+
44+
45+
// D4 D0
46+
// C6 E6 D7
47+
48+
void matrix_scan_user(void) {
49+
writePin(C6, layer_state_is(1));
50+
writePin(E6, layer_state_is(2));
51+
writePin(D7, layer_state_is(3));
52+
writePin(D4, layer_state_is(4));
53+
writePin(D0, layer_state_is(5));
54+
if (is_alt_tab_active) {
55+
if (timer_elapsed(alt_tab_timer) > 1000) {
56+
unregister_code(KC_LWIN);
57+
is_alt_tab_active = false;
58+
}
59+
}
60+
}
61+
62+
bool led_update_user(led_t led_state) {
63+
return false;
64+
};
65+
66+
67+
68+
bool encoder_update_user(uint8_t index, bool clockwise) {
69+
if(IS_LAYER_ON(1)) { // on 1st layer
70+
if (clockwise) {
71+
if (!is_alt_tab_active) {
72+
is_alt_tab_active = true;
73+
register_code(KC_LWIN);
74+
}
75+
alt_tab_timer = timer_read();
76+
tap_code16(KC_TAB);
77+
} else {
78+
alt_tab_timer = timer_read();
79+
tap_code16(S(KC_TAB));
80+
}
81+
}
82+
// 2nd layer
83+
else if(IS_LAYER_ON(2)) {
84+
if (clockwise) {
85+
tap_code(KC_DOWN);
86+
} else {
87+
tap_code(KC_UP);
88+
}
89+
}
90+
else if(IS_LAYER_ON(3)) {
91+
if (clockwise) {
92+
tap_code(KC_BRIU);
93+
} else {
94+
tap_code(KC_BRID);
95+
}
96+
}
97+
// default layer
98+
else if(IS_LAYER_ON(0)) {
99+
if (clockwise) {
100+
tap_code(KC_VOLU);
101+
} else {
102+
tap_code(KC_VOLD);
103+
}
104+
}
105+
return false;
106+
}

keyboards/bobpad/keymaps/via/rules.mk

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VIA_ENABLE = yes

keyboards/bobpad/readme.md

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# bobpad
2+
3+
![bobpad](https://i.imgur.com/93zguh1h.jpg)
4+
5+
A bentopad based macropad with incline
6+
7+
* Keyboard Maintainer: [Ananya Kirti](https://github.com/AnanyaKirti)
8+
* Hardware Supported: Custom 3D printed Case
9+
* Hardware Availability: Contact bob at IMKC Discord
10+
11+
Make example for this keyboard (after setting up your build environment):
12+
13+
make bobpad:default
14+
15+
Flashing example for this keyboard:
16+
17+
make bobpad:default:flash
18+
19+
## Bootloader
20+
21+
Enter the bootloader in 3 ways:
22+
* **Physical reset button**: Briefly short the pad connected to RESET and GND on the back
23+
* **Keycode in layout**: Press the key mapped to `RESET`, this is the recommened method
24+
25+
See the [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) and the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information. Brand new to QMK? Start with our [Complete Newbs Guide](https://docs.qmk.fm/#/newbs).

keyboards/bobpad/rules.mk

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# MCU name
2+
MCU = atmega32u4
3+
4+
# Bootloader selection
5+
BOOTLOADER = caterina
6+
7+
# Build Options
8+
# change yes to no to disable
9+
#
10+
BOOTMAGIC_ENABLE = lite # Virtual DIP switch configuration
11+
MOUSEKEY_ENABLE = yes # Mouse keys
12+
EXTRAKEY_ENABLE = yes # Audio control and System control
13+
CONSOLE_ENABLE = no # Console for debug
14+
COMMAND_ENABLE = no # Commands for debug and configuration
15+
# Do not enable SLEEP_LED_ENABLE. it uses the same timer as BACKLIGHT_ENABLE
16+
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
17+
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
18+
NKRO_ENABLE = no # USB Nkey Rollover
19+
BACKLIGHT_ENABLE = no # Enable keyboard backlight functionality
20+
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
21+
AUDIO_ENABLE = no # Audio output
22+
23+
ENCODER_ENABLE = yes
24+
25+
LAYOUTS = ortho_2x3

0 commit comments

Comments
 (0)