Meira Refactor (#14566)

* clean up keyboard header files

* use #pragma once include guard
* convert tabs to spaces
* remove redundant #include statements
* update revision references to main header (`../meira.h` -> `meira.h`)

* refactor default keymap

* use LAYOUT as layout macro reference
* use enum statement for layer indexes; make layers contiguous
* use four-space indent
* update keycode grid alignment

* update layout macro aliases

* move layout macro aliases to info.json
  * alias KEYMAP to LAYOUT_ortho_4x12 so the user keymaps don't have to be edited

* touch up meira.h

There's no Planck MIT layout reference here.

* add copyright headers

* workaround patch for grahampheath keymap

The `matrix_init_kb()` function in `meira.c` calls `backlight_set()`, but the grahampheath keymap disables Backlight to make space for Audio, causing the firmware to fail to compile.

This commit wraps the `backlight_set()` call in an ifdef statement, so the call is excluded if Backlight is disabled.

* clean up rules.mk inline comments

* re-order rules.mk settings

* clean up readme.md

* correct link to keyboard image
* change metadata section to unordered list
* spelling corrections
* update make instructions and Docs links
daktil_manuform
James Young 2021-09-23 07:49:02 +00:00 committed by GitHub
parent 0fc15f4d30
commit 62ef4a9c8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 340 additions and 292 deletions

View File

@ -1 +1,17 @@
/* Copyright 2017 Cole Markham, WoodKeys.click
*
* 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 "meira.h"

View File

@ -1,9 +1,19 @@
#ifndef FEATHERBLE_H
#define FEATHERBLE_H
/* Copyright 2017 Cole Markham, WoodKeys.click
*
* 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 "../meira.h"
#pragma once
#include "quantum.h"
#endif
#include "meira.h"

View File

@ -2,6 +2,10 @@
"keyboard_name": "Meira",
"url": "",
"maintainer": "colemarkham",
"layout_aliases": {
"KEYMAP": "LAYOUT_ortho_4x12",
"LAYOUT": "LAYOUT_ortho_4x12"
},
"layouts": {
"LAYOUT_ortho_4x12": {
"layout": [

View File

@ -17,16 +17,18 @@
#include "lighting.h"
#ifdef RGBLIGHT_ENABLE
//Following line allows macro to read current RGB settings
// Following line allows macro to read current RGB settings
extern rgblight_config_t rgblight_config;
#endif
#define _QWERTY 0
#define _COLEMAK 1
#define _DVORAK 2
#define _LOWER 3
#define _RAISE 4
#define _ADJUST 16
enum layer_names {
_QWERTY,
_COLEMAK,
_DVORAK,
_LOWER,
_RAISE,
_ADJUST
};
enum custom_keycodes {
QWERTY = SAFE_RANGE,
@ -34,7 +36,7 @@ enum custom_keycodes {
DVORAK,
LOWER,
RAISE,
ADJUST,
ADJUST
};
#ifdef AUDIO_ENABLE
@ -61,10 +63,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | Shift| Z | X | C | V | B | N | M | , | . | / |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* |Adjust| Ctrl | Ctrl | Alt |Lower | Cmd |Space |Raise | Left | Down | Up |Right |
* |Adjust| Ctrl | Alt | Alt |Lower | Cmd |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_QWERTY] = KEYMAP( \
[_QWERTY] = LAYOUT( \
KC_ESC, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC, \
KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \
@ -82,10 +84,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_COLEMAK] = KEYMAP( \
[_COLEMAK] = LAYOUT( \
KC_TAB, KC_Q, KC_W, KC_F, KC_P, KC_G, KC_J, KC_L, KC_U, KC_Y, KC_SCLN, KC_BSPC, \
KC_ESC, KC_A, KC_R, KC_S, KC_T, KC_D, KC_H, KC_N, KC_E, KC_I, KC_O, KC_QUOT, \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT , \
KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_K, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_ENT, \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
@ -100,10 +102,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |Adjust| Ctrl | Alt | GUI |Lower |Space |Space |Raise | Left | Down | Up |Right |
* `-----------------------------------------------------------------------------------'
*/
[_DVORAK] = KEYMAP( \
[_DVORAK] = LAYOUT( \
KC_TAB, KC_QUOT, KC_COMM, KC_DOT, KC_P, KC_Y, KC_F, KC_G, KC_C, KC_R, KC_L, KC_BSPC, \
KC_ESC, KC_A, KC_O, KC_E, KC_U, KC_I, KC_D, KC_H, KC_T, KC_N, KC_S, KC_SLSH, \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT , \
KC_LSFT, KC_SCLN, KC_Q, KC_J, KC_K, KC_X, KC_B, KC_M, KC_W, KC_V, KC_Z, KC_ENT, \
ADJUST, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT \
),
@ -115,13 +117,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO ~ |ISO | | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Next | Vol- | Vol+ | Play |
* | | | | | | | | | Next | Vol- | Vol+ | Play |
* `-----------------------------------------------------------------------------------'
*/
[_LOWER] = KEYMAP( \
[_LOWER] = LAYOUT( \
_______, KC_EXLM, KC_AT, KC_HASH, KC_DLR, KC_PERC, KC_CIRC, KC_AMPR, KC_ASTR, KC_LPRN, KC_RPRN, KC_DEL, \
KC_TILD, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_UNDS, KC_PLUS, KC_LCBR, KC_RCBR, KC_PIPE, \
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12,S(KC_NUHS),S(KC_NUBS),_______, _______, KC_QUOT, \
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, S(KC_NUHS), S(KC_NUBS), _______, _______, KC_QUOT, \
_______, _______, _______, _______, _______, _______, _______, _______, KC_HOME, KC_PGDN, KC_PGUP, KC_END \
),
@ -133,10 +135,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | F7 | F8 | F9 | F10 | F11 | F12 |ISO # |ISO / | | |Enter |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | Home | PgUp | PgDn | End |
* | | | | | | | | | Home | PgUp | PgDn | End |
* `-----------------------------------------------------------------------------------'
*/
[_RAISE] = KEYMAP( \
[_RAISE] = LAYOUT( \
_______, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_DEL, \
KC_GRV, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_MINS, KC_EQL, KC_LBRC, KC_RBRC, KC_BSLS, \
_______, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_NUHS, KC_NUBS, _______, _______, _______, \
@ -151,10 +153,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
* |------+------+------+------+------+------|------+------+------+------+------+------|
* | | | | | | | | | | | | |
* |------+------+------+------+------+------+------+------+------+------+------+------|
* | | | | | | | | | | | |
* | | | | | | | | | | | | |
* `-----------------------------------------------------------------------------------'
*/
[_ADJUST] = KEYMAP( \
[_ADJUST] = LAYOUT( \
BL_TOGG, RESET, _______, KC_MRWD, KC_MPLY, KC_MFFD, KC_PSCR, _______, KC_MUTE, KC_VOLD, KC_VOLU, KC_DEL, \
BL_STEP, RGB_MOD, _______, AU_ON, AU_OFF, AG_NORM, AG_SWAP, QWERTY, COLEMAK, DVORAK, _______, _______, \
_______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, _______, \
@ -178,36 +180,36 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case QWERTY:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_qwerty);
#endif
// persistent_default_layer_set(1UL<<_QWERTY);
#endif
// persistent_default_layer_set(1UL<<_QWERTY);
}
return false;
break;
case COLEMAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_colemak);
#endif
// persistent_default_layer_set(1UL<<_COLEMAK);
#endif
// persistent_default_layer_set(1UL<<_COLEMAK);
}
return false;
break;
case DVORAK:
if (record->event.pressed) {
#ifdef AUDIO_ENABLE
#ifdef AUDIO_ENABLE
PLAY_SONG(tone_dvorak);
#endif
// persistent_default_layer_set(1UL<<_DVORAK);
#endif
// persistent_default_layer_set(1UL<<_DVORAK);
}
return false;
break;
case LOWER:
if (record->event.pressed) {
//not sure how to have keyboard check mode and set it to a variable, so my work around
//uses another variable that would be set to true after the first time a reactive key is pressed.
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
// not sure how to have keyboard check mode and set it to a variable, so my work around
// uses another variable that would be set to true after the first time a reactive key is pressed.
if (TOG_STATUS) { // TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
} else {
TOG_STATUS = !TOG_STATUS;
#ifdef RGBLIGHT_ENABLE
@ -228,9 +230,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
break;
case RAISE:
if (record->event.pressed) {
//not sure how to have keyboard check mode and set it to a variable, so my work around
//uses another variable that would be set to true after the first time a reactive key is pressed.
if (TOG_STATUS) { //TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
// not sure how to have keyboard check mode and set it to a variable, so my work around
// uses another variable that would be set to true after the first time a reactive key is pressed.
if (TOG_STATUS) { // TOG_STATUS checks is another reactive key currently pressed, only changes RGB mode if returns false
} else {
TOG_STATUS = !TOG_STATUS;
#ifdef RGBLIGHT_ENABLE
@ -274,11 +276,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
print("Really stepping backlight\n");
backlight_step();
#endif
}
return false;
break;
//led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
// led operations - RGB mode change now updates the RGB_current_mode to allow the right RGB mode to be set after reactive keys are released
#ifdef RGBLIGHT_ENABLE
case RGB_MOD:
if (record->event.pressed) {
@ -289,10 +290,10 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return false;
break;
#endif
// case BL_INC:
// meira_inc_backlight_level();
// return false;
// break;
// case BL_INC:
// meira_inc_backlight_level();
// return false;
// break;
}
return true;
}

View File

@ -30,7 +30,9 @@ void matrix_init_kb(void)
#ifdef ISSI_ENABLE
issi_init();
#endif
#ifdef BACKLIGHT_ENABLE
backlight_set(5);
#endif
#ifdef WATCHDOG_ENABLE
// This is done after turning the layer LED red, if we're caught in a loop
// we should get a flashing red light

View File

@ -13,8 +13,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MEIRA_H
#define MEIRA_H
#pragma once
#include "quantum.h"
#include "issi.h"
@ -22,7 +21,6 @@
void reset_keyboard_kb(void);
// This a shortcut to help you visually see your layout.
// The following is an example using the Planck MIT layout
// The first section contains all of the arguments
// The second converts the arguments into a two-dimensional array
#define LAYOUT_ortho_4x12( \
@ -37,8 +35,3 @@ void reset_keyboard_kb(void);
{ k20, k21, k22, k23, k24, k25, k26, k27, k28, k29, k2a, k2b }, \
{ k30, k31, k32, k33, k34, k35, k36, k37, k38, k39, k3a, k3b } \
}
#define LAYOUT LAYOUT_ortho_4x12
#endif

View File

@ -1,2 +1,17 @@
#include "meira.h"
/* Copyright 2017 Cole Markham, WoodKeys.click
*
* 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 "meira.h"

View File

@ -1,8 +1,19 @@
#ifndef FEATHERBLE_H
#define FEATHERBLE_H
/* Copyright 2017 Cole Markham, WoodKeys.click
*
* 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 "../meira.h"
#pragma once
#include "quantum.h"
#endif
#include "meira.h"

View File

@ -1,26 +1,23 @@
# Meira
![Miera](https://imgur.com/kF4MFlW)
![Meira](https://i.imgur.com/kF4MFlWh.jpeg)
A 4x12 ortholinear low-profile keyboard.
Keyboard Maintainer: [Cole Markham](https://github.com/colemarkham)
Hardware Supported: Meira/ProMicro, Meira/FeatherBLE
Hardware Availability: [WoodKeys.click](https://woodkeys.click/meira)
* Keyboard Maintainer: [Cole Markham](https://github.com/colemarkham)
* Hardware Supported: Meira/ProMicro, Meira/FeatherBLE
* Hardware Availability: [WoodKeys.click](https://woodkeys.click/meira)
Two controllers are support: the Pro Micro, and the Adafruit Feather BLE 32u4. Support for each is defined as a hardware revision subfolder in QMK. Main differences include processor frequencies and matrix pinouts.
Two controllers are supported: the Pro Micro, and the Adafruit Feather BLE 32u4. Support for each is defined as a hardware revision subfolder in QMK. Main differences include processor frequencies and matrix pinouts.
Make example for this keyboard (after setting up your build environment):
Make examples for this keyboard (after setting up your build environment):
make meira/promicro:default
make meira/featherble:default # for Feather BLE 32u4 controllers
make meira/promicro:default # for Pro Micro controllers
or
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).
make meira/featherble:default
See [build environment setup](https://docs.qmk.fm/#/getting_started_build_tools) then the [make instructions](https://docs.qmk.fm/#/getting_started_make_guide) for more information on generic QMK configuration and setup.
Both the Pro Micro and the Feather BLE use the Catalina bootloader, which is typically programmed using avrdude.
Both the Pro Micro and the Feather BLE use the Caterina bootloader, which is typically programmed using avrdude.
## Matrix

View File

@ -16,19 +16,18 @@ COMMAND_ENABLE = no # Commands for debug and configuration
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
# if this doesn't work, see here: https://github.com/tmk/tmk_keyboard/wiki/FAQ#nkro-doesnt-work
NKRO_ENABLE = no # USB Nkey Rollover
UNICODE_ENABLE = no # Unicode
AUDIO_ENABLE = no # Audio output
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Meira
BACKLIGHT_DRIVER = custom
BACKLIGHT_ENABLE = yes # Enable keyboard backlight functionality, also set ISSI_ENABLE below for Miera
ISSI_ENABLE = yes # If the I2C pullup resistors aren't install this must be disabled
RGBLIGHT_ENABLE = no # Enable keyboard RGB underglow
AUDIO_ENABLE = no # Audio output
CUSTOM_MATRIX = yes
#ifeq ($(strip $(ISSI_ENABLE)), yes)
# TMK_COMMON_DEFS += -DISSI_ENABLE
#endif
#
#ifeq ($(strip $(WATCHDOG_ENABLE)), yes)
# TMK_COMMON_DEFS += -DWATCHDOG_ENABLE
#endif