Skip to content

Commit ae84838

Browse files
lleoninifauxpark
authored andcommitted
[Keyboard] Add ADM42 Keyboard (qmk#17366)
Co-authored-by: Ryan <[email protected]>
1 parent 569b769 commit ae84838

File tree

10 files changed

+442
-0
lines changed

10 files changed

+442
-0
lines changed

keyboards/adm42/adm42.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/* Copyright 2020-2022 Lorenzo Leonini
2+
* SPDX-License-Identifier: GPL-2.0-only
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
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 "adm42.h"

keyboards/adm42/adm42.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/* Copyright 2020-2022 Lorenzo Leonini
2+
* SPDX-License-Identifier: GPL-2.0-only
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
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_adm42_3x12_6( \
22+
K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112, \
23+
K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212, \
24+
K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312, \
25+
K404, K405, K406, K407, K408, K409 \
26+
) { \
27+
{ K101, K102, K103, K104, K105, K106, K107, K108, K109, K110, K111, K112 }, \
28+
{ K201, K202, K203, K204, K205, K206, K207, K208, K209, K210, K211, K212 }, \
29+
{ K301, K302, K303, K304, K305, K306, K307, K308, K309, K310, K311, K312 }, \
30+
{ KC_NO, KC_NO, KC_NO, K404, K405, K407, K406, K408, K409, KC_NO, KC_NO, KC_NO } \
31+
}

keyboards/adm42/config.h

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Copyright 2020-2022 Lorenzo Leonini
2+
* SPDX-License-Identifier: GPL-2.0-only
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
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+
/* Microchip ADM42 sublicensing */
22+
#define VENDOR_ID 0x04D8
23+
#define PRODUCT_ID 0xE873
24+
25+
#define DEVICE_VER 0x0001
26+
#define MANUFACTURER Lorenzo Leonini
27+
#define PRODUCT ADM42
28+
29+
#define MATRIX_ROWS 4
30+
#define MATRIX_COLS 12
31+
32+
#define DIODE_DIRECTION ROW2COL
33+
34+
#define TAP_CODE_DELAY 1
35+
#define DEBOUNCE 10
36+
37+
#if defined(CONSOLE_ENABLE)
38+
#define DEBUG_MATRIX_SCAN_RATE
39+
#endif

keyboards/adm42/readme.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# ADM42
2+
3+
![ADM42](https://i.imgur.com/pviCQSQh.jpeg)
4+
5+
A compact ergonomic 40% ortholinear keyboard. [More info on ADM42.dev](https://adm42.dev)
6+
7+
* Keyboard Maintainer: [Lorenzo Leonini](https://github.com/lleonini)
8+
* Hardware Supported: ADM42
9+
* Hardware Availability: [Shop](https://shop.adm42.dev)
10+
11+
Make example for this keyboard (after setting up your build environment):
12+
13+
make adm42:default
14+
15+
Flashing example for this keyboard:
16+
17+
make adm42:default:flash
18+
19+
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).
20+
21+
## Bootloader
22+
23+
Enter the bootloader in 3 ways:
24+
25+
* **Keycode in layout**: Press the key mapped to `RESET` if it is available
26+
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (the top left key) and plug in the keyboard
27+
* **Physical reset button**: Briefly press the button on the back of the PCB

keyboards/adm42/rev4/config.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* Copyright 2020-2022 Lorenzo Leonini
2+
* SPDX-License-Identifier: GPL-2.0-only
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
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+
#define MATRIX_COL_PINS { C6, B6, B5, B4, D7, D6, F0, F1, F4, F5, F6, F7 }
18+
#define MATRIX_ROW_PINS { C7, D5, D3, D2 }
19+
20+
#define QMK_LED E6
21+
22+
#define RGB_DI_PIN B7
23+
24+
#define DRIVER_LED_TOTAL 42
25+
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 170
26+
#define RGB_MATRIX_CENTER { 112, 32 }
27+
#define RGB_DISABLE_WHEN_USB_SUSPENDED
28+
#define RGB_MATRIX_LED_PROCESS_LIMIT 21
29+
#define RGB_MATRIX_LED_FLUSH_LIMIT 16
30+
#define RGB_MATRIX_STARTUP_MODE RGB_MATRIX_CYCLE_LEFT_RIGHT
31+
#define RGB_MATRIX_TYPING_HEATMAP_DECREASE_DELAY_MS 20
32+
#define RGB_MATRIX_KEYPRESSES
33+
#define RGB_MATRIX_FRAMEBUFFER_EFFECTS
34+
#define RGB_MATRIX_SAT_STEP 24
35+
#define RGB_MATRIX_HUE_STEP 8
36+
#define RGB_MATRIX_VAL_STEP 16
37+
#define RGB_MATRIX_SPD_STEP 16
38+
39+
#define ENABLE_RGB_MATRIX_BREATHING
40+
#define ENABLE_RGB_MATRIX_CYCLE_LEFT_RIGHT
41+
#define ENABLE_RGBLIGHT_MODE_STATIC_LIGHT
42+
#define ENABLE_RGB_MATRIX_CYCLE_UP_DOWN
43+
#define ENABLE_RGB_MATRIX_PIXEL_FRACTAL
44+
#define ENABLE_RGB_MATRIX_TYPING_HEATMAP
45+
#define ENABLE_RGB_MATRIX_SOLID_REACTIVE_SIMPLE
46+
#define ENABLE_RGB_MATRIX_JELLYBEAN_RAINDROPS
47+
#define ENABLE_RGB_MATRIX_CYCLE_OUT_IN
48+
#define ENABLE_RGB_MATRIX_CYCLE_PINWHEEL
49+
#define ENABLE_RGB_MATRIX_PIXEL_RAIN
50+
#define ENABLE_RGB_MATRIX_DIGITAL_RAIN
51+
#define ENABLE_RGB_MATRIX_BAND_VAL
52+
#define ENABLE_RGB_MATRIX_SPLASH
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#define HOLD_ON_OTHER_KEY_PRESS_PER_KEY
2+
#define TAPPING_FORCE_HOLD_PER_KEY
3+
#define IGNORE_MOD_TAP_INTERRUPT_PER_KEY
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
/* Copyright 2020-2022 Lorenzo Leonini
2+
* SPDX-License-Identifier: GPL-2.0-only
3+
*
4+
* This program is free software: you can redistribute it and/or modify
5+
* it under the terms of the GNU General Public License version 2 as
6+
* published by the Free Software Foundation.
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+
enum custom_layers {
20+
_QWERTY,
21+
_COLEMAKDH,
22+
_SPECIAL,
23+
_EXTRA,
24+
_ADM,
25+
_SETUP,
26+
};
27+
28+
#define LW_GRV LWIN_T(KC_GRV)
29+
#define RW_EQU RWIN_T(KC_EQUAL)
30+
#define RW_BS RWIN_T(KC_BSLS)
31+
#define LC_TAB LCTL_T(KC_TAB)
32+
#define RC_QUT RCTL_T(KC_QUOT)
33+
#define LS_BPC LSFT_T(KC_BSPC)
34+
#define RS_SPC RSFT_T(KC_SPC)
35+
#define LA_BS LALT_T(KC_BSLS)
36+
#define LW_F11 LWIN_T(KC_F11)
37+
#define LC_APP LCTL_T(KC_APP)
38+
#define LA_TOG LALT_T(RGB_TOG)
39+
#define RW_F12 RWIN_T(KC_F12)
40+
41+
#define LLS_ESC LT(_SPECIAL, KC_ESC)
42+
#define LLS_RALT LT(_SPECIAL, KC_RALT)
43+
#define LLE_ENT LT(_EXTRA, KC_ENT)
44+
#define LLA_DEL LT(_ADM, KC_DEL)
45+
#define SETUP MO(_SETUP)
46+
47+
enum custom_keycodes {
48+
REFLASH = SAFE_RANGE,
49+
LC_CIRC,
50+
RC_DLR,
51+
DF_QWER,
52+
DF_COLE,
53+
};
54+
55+
// Not a mistake to have KC_LALT (also) on the right, RALT is kept for compose (LLS_RALT)
56+
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
57+
[_QWERTY] = LAYOUT_adm42_3x12_6(
58+
LW_GRV, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, RW_EQU,
59+
LC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, RC_QUT,
60+
KC_LALT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_LALT,
61+
LLS_ESC, LS_BPC, LLA_DEL, LLE_ENT, RS_SPC, LLS_RALT
62+
),
63+
[_COLEMAKDH] = LAYOUT_adm42_3x12_6(
64+
LW_GRV, KC_Q, KC_W, KC_F, KC_P, KC_B, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, RW_EQU,
65+
LC_TAB, KC_A, KC_R, KC_S, KC_T, KC_G, KC_M, KC_N, KC_E, KC_I, KC_O, RC_QUT,
66+
KC_LALT, KC_Z, KC_X, KC_C, KC_D, KC_V, KC_K, KC_H, KC_COMM, KC_DOT, KC_SLSH, KC_LALT,
67+
LLS_ESC, LS_BPC, LLA_DEL, LLE_ENT, RS_SPC, LLS_RALT
68+
),
69+
70+
[_SPECIAL] = LAYOUT_adm42_3x12_6(
71+
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, RW_BS,
72+
LC_CIRC, KC_LBRC, KC_RBRC, KC_LPRN, KC_RPRN, KC_EXLM, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT, KC_MINS, RC_DLR,
73+
_______, KC_AMPR, KC_AT, KC_LCBR, KC_RCBR, KC_PIPE, KC_UNDS, KC_ASTR, KC_HASH, KC_PERC, KC_TILD, _______,
74+
KC_ESC, _______, KC_DEL, KC_ENT, _______, KC_RALT
75+
),
76+
[_EXTRA] = LAYOUT_adm42_3x12_6(
77+
LW_F11, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, RW_F12,
78+
KC_LCTL, KC_PAUS, KC_INS, KC_VOLD, KC_VOLU, KC_MUTE, KC_HOME, KC_PGDN, KC_PGUP, KC_END, KC_APP, KC_RCTL,
79+
_______, KC_SLEP, KC_PWR, KC_MSTP, KC_MNXT, KC_MPLY, _______, KC_BRID, KC_BRIU, KC_PSCR, KC_WAKE, _______,
80+
KC_CAPS, _______, _______, _______, _______, KC_CAPS
81+
),
82+
[_ADM] = LAYOUT_adm42_3x12_6(
83+
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_M_B, RGB_VAD, RGB_VAI, RGB_SAD, RGB_SAI, XXXXXXX,
84+
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_TOG, RGB_MOD, RGB_RMOD,RGB_HUD, RGB_HUI, XXXXXXX,
85+
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, RGB_M_P, RGB_SPD, RGB_SPI, XXXXXXX, XXXXXXX, XXXXXXX,
86+
XXXXXXX, XXXXXXX, XXXXXXX, SETUP, XXXXXXX, XXXXXXX
87+
),
88+
[_SETUP] = LAYOUT_adm42_3x12_6(
89+
REFLASH, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
90+
XXXXXXX, DF_QWER, DF_COLE, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX,
91+
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, EEP_RST,
92+
XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX, XXXXXXX
93+
),
94+
};
95+
96+
bool get_ignore_mod_tap_interrupt(uint16_t keycode, keyrecord_t *record) {
97+
switch (keycode) {
98+
case RC_QUT:
99+
return true;
100+
default:
101+
return false;
102+
}
103+
}
104+
105+
bool get_hold_on_other_key_press(uint16_t keycode, keyrecord_t *record) {
106+
switch (keycode) {
107+
case LLS_ESC:
108+
case LLS_RALT:
109+
case LLE_ENT:
110+
case LLA_DEL:
111+
return true;
112+
default:
113+
return false;
114+
}
115+
}
116+
117+
bool get_tapping_force_hold(uint16_t keycode, keyrecord_t *record) {
118+
switch (keycode) {
119+
case LLS_ESC:
120+
case LLS_RALT:
121+
return true;
122+
default:
123+
return false;
124+
}
125+
}
126+
127+
static uint16_t last_timer = 0;
128+
static int last_key = 0;
129+
bool cleanup_return(uint16_t keycode, keyrecord_t *record, bool value) {
130+
if (record->event.pressed) {
131+
last_key = keycode;
132+
last_timer = timer_read();
133+
}
134+
return value;
135+
}
136+
137+
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
138+
139+
#ifdef CONSOLE_ENABLE
140+
uprintf("KL: kc: 0x%04X, col: %u, row: %u, pressed: %b, time: %u, interrupt: %b, count: %u\n", keycode, record->event.key.col, record->event.key.row, record->event.pressed, record->event.time, record->tap.interrupted, record->tap.count);
141+
#endif
142+
143+
switch (keycode) {
144+
145+
case RC_DLR:
146+
if (record->event.pressed) {
147+
register_code(KC_RCTL);
148+
} else {
149+
unregister_code(KC_RCTL);
150+
if (last_key == keycode && timer_elapsed(last_timer) <= TAPPING_TERM) {
151+
send_string("$");
152+
}
153+
}
154+
return cleanup_return(keycode, record, false);
155+
156+
case LC_CIRC:
157+
if (record->event.pressed) {
158+
register_code(KC_LCTL);
159+
} else {
160+
unregister_code(KC_LCTL);
161+
if (last_key == keycode && timer_elapsed(last_timer) <= TAPPING_TERM) {
162+
send_string("^");
163+
}
164+
}
165+
return cleanup_return(keycode, record, false);
166+
167+
case DF_QWER:
168+
if (record->event.pressed) {
169+
set_single_persistent_default_layer(_QWERTY);
170+
send_string("QWERTY layout");
171+
}
172+
return false;
173+
case DF_COLE:
174+
if (record->event.pressed) {
175+
set_single_persistent_default_layer(_COLEMAKDH);
176+
send_string("COLEMAKDH layout");
177+
}
178+
return false;
179+
180+
case REFLASH:
181+
eeconfig_init();
182+
eeconfig_update_rgb_matrix_default();
183+
writePinLow(QMK_LED);
184+
reset_keyboard();
185+
return false;
186+
187+
default:
188+
return cleanup_return(keycode, record, true);
189+
}
190+
}
191+
192+
void keyboard_pre_init_kb(void) {
193+
setPinOutput(QMK_LED);
194+
writePinHigh(QMK_LED);
195+
}
196+
197+
void keyboard_post_init_kb(void) {
198+
debug_enable = true;
199+
debug_matrix = false;
200+
debug_keyboard = false;
201+
writePinHigh(QMK_LED);
202+
}
203+
204+
void suspend_power_down_kb(void) {
205+
writePinLow(QMK_LED);
206+
}
207+
208+
void suspend_wakeup_init_kb(void) {
209+
writePinHigh(QMK_LED);
210+
}

0 commit comments

Comments
 (0)