Compare commits

...

28 Commits

Author SHA1 Message Date
Moses Hoyt
25f798772f
Merge 7f24d37bd0 into 9bea332a21 2024-11-20 22:22:13 -08:00
Ryan
9bea332a21
qmk via2json: Improve macro parsing (#24345) 2024-11-21 17:20:05 +11:00
Ryan
8cbcdcac62
qmk new-keymap: validate keymap name (#23420) 2024-11-21 17:18:51 +11:00
Moses Hoyt
7f24d37bd0
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-08-25 19:13:47 +02:00
Moses Hoyt
94cb0f5d52
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-08-25 19:13:39 +02:00
Moses Hoyt
9372b64053
Rename storre.json to keyboard.json 2024-08-22 21:22:07 +02:00
Moses Hoyt
1bab176d34
Rename info.json to storre.json 2024-08-22 21:19:10 +02:00
Moses Hoyt
e893ffc4e2
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-05-06 09:11:04 +02:00
Moses Hoyt
a02afe1325
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-05-06 09:10:57 +02:00
Moses Hoyt
35752bf3b9
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-05-06 09:10:47 +02:00
Moses Hoyt
f3a49bfa4e
Update keyboards/sthlmkb/storre/matrix.c
Co-authored-by: Ryan <fauxpark@gmail.com>
2024-05-06 09:10:39 +02:00
Moses Hoyt
84501d402c
Update readme.md
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-31 11:08:51 +01:00
Moses Hoyt
b02e5ef704
Update keyboards/sthlmkb/storre/rules.mk
Co-authored-by: Joel Challis <git@zvecr.com>
2024-01-31 10:35:45 +01:00
mohoyt
9c1107a9e8 rules.mk added to default keymap for encoder map 2024-01-31 10:34:56 +01:00
Moses Hoyt
1b33602a75
Update keyboards/sthlmkb/storre/readme.md
Co-authored-by: Joel Challis <git@zvecr.com>
2024-01-31 10:31:37 +01:00
Moses Hoyt
4427654f82
Update rules.mk
Co-authored-by: Joel Challis <git@zvecr.com>
2024-01-31 08:13:38 +01:00
mohoyt
64d0472b34 Encoder map added to default keymap 2024-01-26 11:11:13 +01:00
Moses Hoyt
8376687e8d
Update keyboards/sthlmkb/storre/info.json
Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com>
2024-01-26 10:57:11 +01:00
Moses Hoyt
44b44fe738
Update keyboards/sthlmkb/storre/info.json
Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com>
2024-01-26 10:57:02 +01:00
Moses Hoyt
2176bdbbc1
Update keyboards/sthlmkb/storre/info.json
Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com>
2024-01-26 10:56:52 +01:00
Moses Hoyt
6018ccbe55
Update keyboards/sthlmkb/storre/storre.c
Co-authored-by: Less/Rikki <86894501+lesshonor@users.noreply.github.com>
2024-01-26 10:56:14 +01:00
Moses Hoyt
027bfb62dc
Update keyboards/sthlmkb/storre/rules.mk
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-26 10:55:32 +01:00
Moses Hoyt
59417f834d
Update keyboards/sthlmkb/storre/readme.md
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-26 10:55:04 +01:00
Moses Hoyt
de2be95e25
Update keyboards/sthlmkb/storre/keymaps/default/keymap.c
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-25 16:51:16 +01:00
Moses Hoyt
582f97a2b4
Update keyboards/sthlmkb/storre/readme.md
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-25 16:51:09 +01:00
Moses Hoyt
6881a52206
Update keyboards/sthlmkb/storre/info.json
Co-authored-by: Duncan Sutherland <dunk2k_2000@hotmail.com>
2024-01-25 16:51:02 +01:00
mohoyt
fe6f784a18 Readme updated 2024-01-25 11:41:06 +01:00
mohoyt
0ac27d516b Add Större keyboard 2024-01-25 11:28:12 +01:00
10 changed files with 1558 additions and 9 deletions

View File

@ -0,0 +1,29 @@
/*
Copyright 2024 mohoyt
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
/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 16
#define MATRIX_MUX_COLS 4
#define MATRIX_ROW_PINS { D2, B6, B2, B3, B1, F7 }
#define MATRIX_COL_PINS { }
#define MATRIX_COL_MUX_PINS { D7, E6, B4, B5 }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,43 @@
/* Copyright 2024 mohoyt
*
* 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 QMK_KEYBOARD_H
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[0] = LAYOUT_all(
KC_MPLY, KC_MUTE,
KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_F13,
KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_DEL, KC_HOME,
KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_END,
KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_NUHS, KC_ENT, KC_PGUP,
KC_LSFT, KC_NUBS, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP, KC_PGDN,
KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_SPC, KC_SPC, KC_RALT, MO(1), KC_LEFT, KC_DOWN, KC_RGHT ),
[1] = LAYOUT_all(
_______, _______,
QK_BOOT, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______,
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______ ),
};
#if defined(ENCODER_MAP_ENABLE)
const uint16_t PROGMEM encoder_map[][NUM_ENCODERS][NUM_DIRECTIONS] = {
[0] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) },
[1] = { ENCODER_CCW_CW(KC_MPRV, KC_MNXT), ENCODER_CCW_CW(KC_VOLD, KC_VOLU) }
};
#endif

View File

@ -0,0 +1 @@
ENCODER_MAP_ENABLE = yes

View File

@ -0,0 +1,95 @@
/* Copyright 2024 mohoyt
*
* 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 "matrix.h"
#define COL_SHIFTER ((uint32_t)1)
// Column pins
static const uint8_t row_pins[MATRIX_ROWS] = MATRIX_ROW_PINS;
static const uint8_t col_pins[MATRIX_MUX_COLS] = MATRIX_COL_MUX_PINS;
// Internal functions
static void init_pins(void) {
// Set cols to outputs, low
for (uint8_t pin = 0; pin < MATRIX_MUX_COLS; pin++) {
gpio_set_pin_output(col_pins[pin]);
}
// Unselect cols
for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) {
gpio_write_pin_low(col_pins[bit]);
}
// Set rows to input, pullup
for (uint8_t pin = 0; pin < MATRIX_ROWS; pin++) {
gpio_set_pin_input_high(row_pins[pin]);
}
}
static void select_col(uint8_t col)
{
for (uint8_t bit = 0; bit < MATRIX_MUX_COLS; bit++) {
uint8_t state = (col & (0b1 << bit)) >> bit;
gpio_write_pin(col_pins[bit], state);
}
}
static bool read_rows_on_col(matrix_row_t current_matrix[], uint8_t current_col)
{
bool matrix_changed = false;
select_col(current_col);
wait_us(5);
// Read each row sequentially
for(uint8_t row_index = 0; row_index < MATRIX_ROWS; row_index++)
{
matrix_row_t last_row_value = current_matrix[row_index];
if (!gpio_read_pin(row_pins[row_index]))
{
current_matrix[row_index] |= (COL_SHIFTER << current_col);
}
else
{
current_matrix[row_index] &= ~(COL_SHIFTER << current_col);
}
if ((last_row_value != current_matrix[row_index]) && !(matrix_changed))
{
matrix_changed = true;
}
}
return matrix_changed;
}
// Matrix scan functions
void matrix_init_custom(void) {
init_pins();
}
bool matrix_scan_custom(matrix_row_t current_matrix[]) {
bool changed = false;
//Set col, read rows
for (uint8_t current_col = 0; current_col < MATRIX_COLS; current_col++) {
changed |= read_rows_on_col(current_matrix, current_col);
}
return (uint8_t)changed;
}

View File

@ -0,0 +1,26 @@
# storre
![Storre](https://i.imgur.com/xxb9p5yh.jpeg)
Större is an easy to build 75%ish keyboard using only through hole components. It utilises a Pro Micro footprint development board to enable flexible connectivity and simplify the soldering experience (no more tricksy USB ports).
* Keyboard Maintainer: [mohoyt](https://github.com/mohoyt)
* Hardware Supported: större, development board with Pro Micro footprint (e.g. Pro Micro, Elite-C, Nice!Nano, SparkFun Pro Micro RP2040)
* Hardware Availability: [sthlm kb](https://sthlmkb.com)
Make example for this keyboard (after setting up your build environment):
make sthlmkb/storre:default
Flashing example for this keyboard:
make sthlmkb/storre:default:flash
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).
## Bootloader
Enter the bootloader in 2 ways:
* **Bootmagic reset**: Hold down the key at (0,0) in the matrix (usually the top left key or Escape) and plug in the keyboard
* **Keycode in layout**: Press the key mapped to `QK_BOOT` if it is available

View File

@ -0,0 +1,2 @@
CUSTOM_MATRIX = lite
SRC += matrix.c

View File

@ -0,0 +1,50 @@
/* Copyright 2024 mohoyt
*
* 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 "quantum.h"
#ifdef ENCODER_ENABLE
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) { return false; }
if (index == 0) {
if (clockwise) {
tap_code(KC_MNXT);
} else {
tap_code(KC_MPRV);
}
} else if (index == 1) {
if (clockwise) {
tap_code_delay(KC_VOLU, 10);
} else {
tap_code_delay(KC_VOLD, 10);
}
}
return true;
}
#endif
#ifdef OLED_ENABLE
bool oled_task_kb(void) {
if (!oled_task_user()) {
return false;
}
led_t led_state = host_keyboard_led_state();
oled_write_P(led_state.num_lock ? PSTR("NUM ") : PSTR(" "), false);
oled_write_P(led_state.caps_lock ? PSTR("CAP ") : PSTR(" "), false);
oled_write_P(led_state.scroll_lock ? PSTR("SCR ") : PSTR(" "), false);
return true;
}
#endif

View File

@ -1,5 +1,6 @@
"""This script automates the copying of the default keymap into your own keymap. """This script automates the copying of the default keymap into your own keymap.
""" """
import re
import shutil import shutil
from milc import cli from milc import cli
@ -13,6 +14,13 @@ from qmk.keyboard import keyboard_completer, keyboard_folder
from qmk.userspace import UserspaceDefs from qmk.userspace import UserspaceDefs
def validate_keymap_name(name):
"""Returns True if the given keymap name contains only a-z, 0-9 and underscore characters.
"""
regex = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_]+$')
return bool(regex.match(name))
def prompt_keyboard(): def prompt_keyboard():
prompt = """{fg_yellow}Select Keyboard{style_reset_all} prompt = """{fg_yellow}Select Keyboard{style_reset_all}
If you`re unsure you can view a full list of supported keyboards with {fg_yellow}qmk list-keyboards{style_reset_all}. If you`re unsure you can view a full list of supported keyboards with {fg_yellow}qmk list-keyboards{style_reset_all}.
@ -60,6 +68,10 @@ def new_keymap(cli):
cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!') cli.log.error(f'Default keymap {{fg_cyan}}{keymap_path_default}{{fg_reset}} does not exist!')
return False return False
if not validate_keymap_name(user_name):
cli.log.error('Keymap names must contain only {fg_cyan}a-z{fg_reset}, {fg_cyan}0-9{fg_reset} and {fg_cyan}_{fg_reset}! Please choose a different name.')
return False
if keymap_path_new.exists(): if keymap_path_new.exists():
cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.') cli.log.error(f'Keymap {{fg_cyan}}{user_name}{{fg_reset}} already exists! Please choose a different name.')
return False return False

View File

@ -29,6 +29,7 @@ def _convert_macros(via_macros):
if len(via_macros) == 0: if len(via_macros) == 0:
return list() return list()
split_regex = re.compile(r'(}\,)|(\,{)') split_regex = re.compile(r'(}\,)|(\,{)')
macro_group_regex = re.compile(r'({.+?})')
macros = list() macros = list()
for via_macro in via_macros: for via_macro in via_macros:
# Split VIA macro to its elements # Split VIA macro to its elements
@ -38,13 +39,28 @@ def _convert_macros(via_macros):
macro_data = list() macro_data = list()
for m in macro: for m in macro:
if '{' in m or '}' in m: if '{' in m or '}' in m:
# Found keycode(s) # Split macro groups
keycodes = m.split(',') macro_groups = macro_group_regex.findall(m)
# Remove whitespaces and curly braces from around keycodes for macro_group in macro_groups:
keycodes = list(map(lambda s: s.strip(' {}'), keycodes)) # Remove whitespaces and curly braces from around group
# Remove the KC prefix macro_group = macro_group.strip(' {}')
keycodes = list(map(lambda s: s.replace('KC_', ''), keycodes))
macro_data.append({"action": "tap", "keycodes": keycodes}) macro_action = 'tap'
macro_keycodes = []
if macro_group[0] == '+':
macro_action = 'down'
macro_keycodes.append(macro_group[1:])
elif macro_group[0] == '-':
macro_action = 'up'
macro_keycodes.append(macro_group[1:])
else:
macro_keycodes.extend(macro_group.split(',') if ',' in macro_group else [macro_group])
# Remove the KC prefixes
macro_keycodes = list(map(lambda s: s.replace('KC_', ''), macro_keycodes))
macro_data.append({"action": macro_action, "keycodes": macro_keycodes})
else: else:
# Found text # Found text
macro_data.append(m) macro_data.append(m)
@ -54,13 +70,13 @@ def _convert_macros(via_macros):
def _fix_macro_keys(keymap_data): def _fix_macro_keys(keymap_data):
macro_no = re.compile(r'MACRO0?([0-9]{1,2})') macro_no = re.compile(r'MACRO0?\(([0-9]{1,2})\)')
for i in range(0, len(keymap_data)): for i in range(0, len(keymap_data)):
for j in range(0, len(keymap_data[i])): for j in range(0, len(keymap_data[i])):
kc = keymap_data[i][j] kc = keymap_data[i][j]
m = macro_no.match(kc) m = macro_no.match(kc)
if m: if m:
keymap_data[i][j] = f'MACRO_{m.group(1)}' keymap_data[i][j] = f'MC_{m.group(1)}'
return keymap_data return keymap_data