messing about with layouts :)

- changed how things are organized
- LEDs now indicate layers!  layers 1 and 2 have a corresponding LED,
  along with capslock (which also kinda needs one)
- this organization of things is not final.  but i hope (and think) it's
  a little better :)
partial-rewrite
Ben Blazak 2014-01-21 18:08:33 -08:00
parent fdc5d836c3
commit e83f2a3325
16 changed files with 328 additions and 405 deletions

View File

@ -11,6 +11,7 @@
*/
// left hand letter key block
#define T_q q
#define T_w w
#define T_e f
@ -27,6 +28,7 @@
#define T_v v
#define T_b b
// right hand letter key block
#define T_y j
#define T_u l
#define T_i u
@ -37,13 +39,16 @@
#define T_k e
#define T_l i
#define T_semicol o
#define T_quote quote
#define T_n k
#define T_m m
#define T_comma comma
#define T_period period
#define T_slash slash
// right hand outer key block
#define T_bkslash bkslash
#define T_quote quote
#include "./templates/kinesis-mod.c.h"

View File

@ -1,133 +0,0 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* A central place for all `#include`s and common definitions relevant to the
* layout files
*/
#ifndef ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__DEFINITIONS__H
#define ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__DEFINITIONS__H
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <avr/pgmspace.h>
#include "../../../../../firmware/lib/timer.h"
#include "../../../../../firmware/lib/usb.h"
#include "../../../../../firmware/lib/usb/usage-page/keyboard.h"
#include "../../../../../firmware/lib/layout/key-functions.h"
#include "../../../../../firmware/lib/layout/layer-stack.h"
#include "../../../../../firmware/keyboard.h"
// ----------------------------------------------------------------------------
/** macros/P/description
* Expand `name` into the corresponding "press" function name
*/
#define P(name) keys__press__##name
/** macros/R/description
* Expand `name` into the corresponding "release" function name
*/
#define R(name) keys__release__##name
/** macros/K/description
* Expand into a "key" suitable for putting into the layout matrix
*/
#define K(name) { &keys__press__##name, &keys__release__##name }
/** macros/KF/description
* Expand `name` into the corresponding "key_functions" function name
*/
#define KF(name) key_functions__##name
// ----------------------------------------------------------------------------
// special meaning keys (may be used by `exec_key()`)
/** keys/transp/description
* transparent
*
* This key signals to the firmware (specifically the
* `kb__layout__exec_key_location()` function) that it should look for what key
* to "press" or "release" by going down the layer-stack until it finds a
* non-transparent key at the same position.
*
* Notes:
* - With this scheme, keys may be half transparent; that is, the "press" part
* of a key may be transparent while the "release" part isn't, or vice versa.
* I expect this to be fairly uncommon though.
*/
void KF(transp) (void) {}
#define keys__press__transp KF(transp)
#define keys__release__transp KF(transp)
/** keys/nop/description
* no operation
*
* This key does nothing (and is not transparent).
*/
void KF(nop) (void) {}
#define keys__press__nop KF(nop)
#define keys__release__nop KF(nop)
// ----------------------------------------------------------------------------
/** types/_key_t/description
* The type we will use for our "key"s
*
* Notes:
* - Keys will be of the form
* `_key_t key = { &press_function, &release_function };`
*
* - The fact that keys are of this type (composed of two
* `void (*function)(void)` pointers) is assumed throughout most of these
* layout files
*/
typedef void (*_key_t[2])(void);
/** types/_layout_t/description
* The type we will use for our layout matrix
*
* Notes:
* - The first dimension of the matrix (left blank in the typedef since it
* varies between layouts) is "layers"
*/
typedef const _key_t _layout_t[][OPT__KB__ROWS][OPT__KB__COLUMNS];
// ----------------------------------------------------------------------------
/** variables/_layout/description
* The variable containing our layout matrix
*/
static _layout_t _layout PROGMEM;
/** variables/_flags/description
* A collection of flags pertaining to the operation of `...exec_key()`
*
* Struct members:
* - `tick_keypresses`: A predicate indicating whether or not to "tick"
* keypresses on this run of the function (see the documentation in
* ".../firmware/lib/timer.h" for more precisely what this means)
* - This is useful for defining things like sticky keys, if, e.g., you
* want to make it so that you can press more than one and have none of
* them release until the press of the next normal key.
*/
static struct {
bool tick_keypresses : 1;
} _flags = {
.tick_keypresses = true,
};
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__DEFINITIONS__H

View File

@ -11,6 +11,7 @@
*/
// left hand letter key block
#define T_q quote
#define T_w comma
#define T_e period
@ -27,6 +28,7 @@
#define T_v k
#define T_b x
// right hand letter key block
#define T_y f
#define T_u g
#define T_i c
@ -37,13 +39,16 @@
#define T_k t
#define T_l n
#define T_semicol s
#define T_quote slash
#define T_n b
#define T_m m
#define T_comma w
#define T_period v
#define T_slash z
// right hand outer key block
#define T_bkslash slash
#define T_quote bkslash
#include "./templates/kinesis-mod.c.h"

View File

@ -0,0 +1,26 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* A central place for all `#include`s relevant to the fragments of layout
* code in this directory
*
* These includes, or at least most of them, will very likely be needed if any
* of the other files in this directory are used.
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <avr/pgmspace.h>
#include "../../../../../firmware/lib/timer.h"
#include "../../../../../firmware/lib/usb.h"
#include "../../../../../firmware/lib/usb/usage-page/keyboard.h"
#include "../../../../../firmware/lib/layout/key-functions.h"
#include "../../../../../firmware/lib/layout/layer-stack.h"
#include "../../../../../firmware/keyboard.h"

View File

@ -1,44 +1,15 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* This file implements and extends the definitions in ".../lib/layout/keys.h"
* and extends the definitions in ".../lib/layout/key-functions.h"
*
* Meant to be included *only* by the layout using it.
* This code fragment implements and extends the definitions in
* ".../lib/layout/keys.h" and extends the definitions in
* ".../lib/layout/key-functions.h"
*/
// TODO: write a chordmak (or asetniop) layout, on top of a standard colemak
// layout, using chained sticky keys for the modifiers
// TODO: write tutorials
// - about
// - basic key functions
// - mention where people should look for more information; probably, the
// usb, key_functions, and keys headers; and others?
// - sticky keys
// - macros
// - chorded keys
// - timed keys
// - automatic repetition of utf-8 sequence keys
// - layers
// - making layouts
// - changing the meaning of the LEDs
// - put the tutorials in the readme.md of
// ".../firmware/keyboard/ergodox/layout"
#ifndef ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__KEYS__C__H
#define ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__KEYS__C__H
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "./definitions.h"
// ----------------------------------------------------------------------------
/** macros/KEYS__DEFAULT/description
* Define the functions for a default key (i.e. a normal key that presses and
@ -96,63 +67,8 @@
* #define keys__release__lpo1l1 KF(nop)
*/
#define KEYS__LAYER__PUSH_POP(ID, LAYER) \
void P(lpupo##ID##l##LAYER) (void) { layer_stack__push(0, ID, LAYER); \
_flags.tick_keypresses = false; } \
void R(lpupo##ID##l##LAYER) (void) { layer_stack__pop_id(ID); \
_flags.tick_keypresses = false; }
/** macros/(group) layer : number pad/description
* Define functions for pushing and popping the number pad (namely `numPush`,
* `numPop`, and `numPuPo`)
*
* Members:
* - `KEYS__LAYER__NUM_PU_PO`
* - `KEYS__LAYER__NUM_PUSH`
* - `KEYS__LAYER__NUM_POP`
*
* These macros are meant to be used (if necessary) in the layout file, since
* they need to know the layer on which the number pad has been placed.
*
* Notes:
* - `KEYBOARD__LockingNumLock` appears to be the correct keycode for OS X.
* For Linux, the correct keycode is reportedly `KEYPAD__NumLock_Clear`. For
* Windows, I haven't heard, but one of them has to work :) .
*/
#define KEYS__LAYER__NUM_PU_PO(ID, LAYER) \
void P(numPuPo) (void) { layer_stack__push(0, ID, LAYER); \
KF(press)(KEYBOARD__LockingNumLock); \
KF(press)(KEYPAD__NumLock_Clear); \
usb__kb__send_report(); \
KF(release)(KEYBOARD__LockingNumLock); \
KF(release)(KEYPAD__NumLock_Clear); \
usb__kb__send_report(); \
_flags.tick_keypresses = false; } \
void R(numPuPo) (void) { layer_stack__pop_id(ID); \
KF(press)(KEYBOARD__LockingNumLock); \
KF(press)(KEYPAD__NumLock_Clear); \
usb__kb__send_report(); \
KF(release)(KEYBOARD__LockingNumLock); \
KF(release)(KEYPAD__NumLock_Clear); \
usb__kb__send_report(); \
_flags.tick_keypresses = false; }
#define KEYS__LAYER__NUM_PUSH(ID, LAYER) \
void P(numPush) (void) { layer_stack__push(0, ID, LAYER); \
KF(press)(KEYBOARD__LockingNumLock); \
KF(press)(KEYPAD__NumLock_Clear); \
_flags.tick_keypresses = false; } \
void R(numPush) (void) { KF(release)(KEYBOARD__LockingNumLock); \
KF(release)(KEYPAD__NumLock_Clear); \
_flags.tick_keypresses = false; }
#define KEYS__LAYER__NUM_POP(ID) \
void P(numPop) (void) { layer_stack__pop_id(ID); \
KF(press)(KEYBOARD__LockingNumLock); \
KF(press)(KEYPAD__NumLock_Clear); \
_flags.tick_keypresses = false; } \
void R(numPop) (void) { KF(release)(KEYBOARD__LockingNumLock); \
KF(release)(KEYPAD__NumLock_Clear); \
_flags.tick_keypresses = false; }
void P(lpupo##ID##l##LAYER) (void) { layer_stack__push(0, ID, LAYER); } \
void R(lpupo##ID##l##LAYER) (void) { layer_stack__pop_id(ID); }
// ----------------------------------------------------------------------------
@ -184,6 +100,35 @@ void KF(2_keys_capslock)(bool pressed, uint8_t keycode) {
#include "../../../../../firmware/lib/layout/keys.h"
// --- special meaning --------------------------------------------------------
/** keys/transp/description
* transparent
*
* This key signals to the firmware (specifically the
* `kb__layout__exec_key_location()` function) that it should look for what key
* to "press" or "release" by going down the layer-stack until it finds a
* non-transparent key at the same position.
*
* Notes:
* - With this scheme, keys may be half transparent; that is, the "press" part
* of a key may be transparent while the "release" part isn't, or vice versa.
* I expect this to be fairly uncommon though.
*/
void KF(transp) (void) {}
#define keys__press__transp KF(transp)
#define keys__release__transp KF(transp)
/** keys/nop/description
* no operation
*
* This key does nothing (and is not transparent).
*/
void KF(nop) (void) {}
#define keys__press__nop KF(nop)
#define keys__release__nop KF(nop)
// --- special keycode --------------------------------------------------------
KEYS__DEFAULT( power, KEYBOARD__Power );
@ -253,8 +198,10 @@ void R(dmp_eepr) (void) {}
// ----------------------------------------------------------------------------
// --- layer ------------------------------------------------------------------
// note: these are just some default layer key definitions; no need to stick to
// them if they're inconvenient
// - these are just some default layer key definitions; no need to stick to
// them if they're inconvenient
// - the functions for layers 1 and 2 are special here in that they turn on and
// off the corresponding LED (the third LED is reserved for capslock)
KEYS__LAYER__PUSH_POP(0, 0);
#define keys__press__lpu0l0 P(lpupo0l0)
@ -262,13 +209,15 @@ KEYS__LAYER__PUSH_POP(0, 0);
#define keys__press__lpo0l0 R(lpupo0l0)
#define keys__release__lpo0l0 KF(nop)
KEYS__LAYER__PUSH_POP(1, 1);
void P(lpupo1l1) (void) { layer_stack__push(0, 1, 1); kb__led__on(1); }
void R(lpupo1l1) (void) { layer_stack__pop_id(1); kb__led__off(1); }
#define keys__press__lpu1l1 P(lpupo1l1)
#define keys__release__lpu1l1 KF(nop)
#define keys__press__lpo1l1 R(lpupo1l1)
#define keys__release__lpo1l1 KF(nop)
KEYS__LAYER__PUSH_POP(2, 2);
void P(lpupo2l2) (void) { layer_stack__push(0, 2, 2); kb__led__on(2); }
void R(lpupo2l2) (void) { layer_stack__pop_id(2); kb__led__off(2); }
#define keys__press__lpu2l2 P(lpupo2l2)
#define keys__release__lpu2l2 KF(nop)
#define keys__press__lpo2l2 R(lpupo2l2)
@ -316,8 +265,3 @@ KEYS__LAYER__PUSH_POP(9, 9);
#define keys__press__lpo9l9 R(lpupo9l9)
#define keys__release__lpo9l9 KF(nop)
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__KEYS__C__H

View File

@ -0,0 +1,34 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* Default actions for changes in logical (host controlled) LED states
*
* Notes:
* - LEDs 1 and 2 are controlled by the corresponding layer keys.
*/
void kb__led__logical_on(char led) {
switch(led) {
case 'N': break; // numlock
case 'C': kb__led__on(3); break; // capslock
case 'S': break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch(led) {
case 'N': ; break; // numlock
case 'C': kb__led__off(3); break; // capslock
case 'S': ; break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}

View File

@ -1,18 +1,33 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2012, 2013 Ben Blazak <benblazak.dev@gmail.com>
* Copyright (c) 2012, 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* Information about the matrix
* Default macro definitions
*/
#ifndef ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__MATRIX__H
#define ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__MATRIX__H
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
/** macros/P/description
* Expand `name` into the corresponding "press" function name
*/
#define P(name) keys__press__##name
/** macros/R/description
* Expand `name` into the corresponding "release" function name
*/
#define R(name) keys__release__##name
/** macros/K/description
* Expand into a "key" suitable for putting into the layout matrix
*/
#define K(name) { &keys__press__##name, &keys__release__##name }
/** macros/KF/description
* Expand `name` into the corresponding "key_functions" function name
*/
#define KF(name) key_functions__##name
/** macros/MATRIX_LAYER/description
@ -81,8 +96,3 @@
{ M(k40),M(k41),M(k42),M(k43),M(k44),M(k45),M(k46), M(k47),M(k48),M(k49),M(k4A),M(k4B),M(k4C),M(k4D) }, \
{ M(k50),M(k51),M(k52),M(k53),M(k54),M(k55),M(k56), M(k57),M(k58),M(k59),M(k5A),M(k5B),M(k5C),M(k5D) }}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // ERGODOX_FIRMWARE__FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__MATRIX__H

View File

@ -1,34 +1,17 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* A default way to execute keys.
* A default way to execute keys
*
* Meant to be included *only* by the layout using it.
*
* TODO:
* - should *.c.h functions have macros to guard against multiple includes?
* - perhaps think about whether this organization of *.c.h files in
* .../layout/common is the best. maybe it could be more modular. maybe
* layers could be included, for use as parts of layouts. maybe the default
* led functions could as well; or there could be a couple different sets of
* led function, in files with appropriate names. dunno.
* Usage notes:
* - Depends on (must be included after) "variables.part.h" and "keys.part.h"
*/
#ifndef ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__EXEC_KEY__C__H
#define ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__EXEC_KEY__C__H
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "./definitions.h"
// ----------------------------------------------------------------------------
void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
// if we press a key, we need to keep track of the layer it was pressed on,
@ -55,10 +38,10 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
layer = layer_stack__peek(i-1);
function = (void (*)(void))
pgm_read_word( &( _layout[ layer ]
[ row ]
[ column ]
[ (pressed) ? 0 : 1 ] ) );
pgm_read_word( &( layout[ layer ]
[ row ]
[ column ]
[ (pressed) ? 0 : 1 ] ) );
if (function == &KF(transp))
function = NULL;
@ -67,7 +50,7 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
if (pressed)
pressed_layer[row][column] = layer;
_flags.tick_keypresses = (pressed) ? true : false; // set default
flags.tick_keypresses = (pressed) ? true : false; // set default
(*function)();
@ -75,7 +58,7 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
// TODO: instead of this, set a flag for the type of key pressed,
// and any functions that execute can check it, and conditionally
// reschedule themselves to run later, if they so desire
if (_flags.tick_keypresses)
if (flags.tick_keypresses)
timer___tick_keypresses();
return;
@ -85,8 +68,3 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
// if we get here, there was a transparent key in layer 0; do nothing
}
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__COMMON__EXEC_KEY__C__H

View File

@ -0,0 +1,11 @@
Pieces of code meant to be (optionally) included in different layouts.
Please think of these files as code fragments, rather than actual C or header
files.
-------------------------------------------------------------------------------
Copyright &copy; 2014 Ben Blazak <benblazak.dev@gmail.com>
Released under The MIT License (see "doc/licenses/MIT.md")
Project located at <https://github.com/benblazak/ergodox-firmware>

View File

@ -0,0 +1,33 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* Types used throughout the fragments of layout code in this directory
*/
/** types/_key_t/description
* The type we will use for our "key"s
*
* Notes:
* - Keys will be of the form
* `_key_t key = { &press_function, &release_function };`
*
* - The fact that keys are of this type (composed of two
* `void (*function)(void)` pointers) is assumed throughout most of these
* layout files
*/
typedef void (*key_t[2])(void);
/** types/_layout_t/description
* The type we will use for our layout matrix
*
* Notes:
* - The first dimension of the matrix (left blank in the typedef since it
* varies between layouts) is "layers"
*/
typedef const key_t layout_t[][OPT__KB__ROWS][OPT__KB__COLUMNS];

View File

@ -0,0 +1,36 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* Variables global to the fragments of layout code in this directory
*/
/** variables/layout/description
* The variable containing our layout matrix
*
* Included here so that the matrix control code can come before the actual
* definition of the layout.
*/
static layout_t layout PROGMEM;
/** variables/flags/description
* A collection of flags pertaining to the operation of `...exec_key()`
*
* Struct members:
* - `tick_keypresses`: A predicate indicating whether or not to "tick"
* keypresses on this run of the function (see the documentation in
* ".../firmware/lib/timer.h" for more precisely what this means)
* - This is useful for defining things like sticky keys, if, e.g., you
* want to make it so that you can press more than one and have none of
* them release until the press of the next normal key.
*/
static struct {
bool tick_keypresses : 1;
} flags = {
.tick_keypresses = true,
};

View File

@ -11,6 +11,7 @@
*/
// left hand letter key block
#define T_q q
#define T_w w
#define T_e e
@ -27,6 +28,7 @@
#define T_v v
#define T_b b
// right hand letter key block
#define T_y y
#define T_u u
#define T_i i
@ -37,13 +39,16 @@
#define T_k k
#define T_l l
#define T_semicol semicol
#define T_quote quote
#define T_n n
#define T_m m
#define T_comma comma
#define T_period period
#define T_slash slash
// right hand outer key block
#define T_bkslash bkslash
#define T_quote quote
#include "./templates/kinesis-mod.c.h"

View File

@ -0,0 +1,20 @@
## TODO: tutorials
- basic key functions
- mention where people should look for more information; probably, the usb, key_functions, and keys headers; and others?
- sticky keys
- maybe write a chordmak (or asetniop) layaout, on top of a standard
colemak layout, using chained sticky keys for the modifiers
- macros
- chorded keys
- timed keys
- automatic repetition of utf-8 sequence keys
- layers
- making layouts
- changing the meaning of the LEDs
-------------------------------------------------------------------------------
Copyright &copy; 2014 Ben Blazak <benblazak.dev@gmail.com>
Released under The MIT License (see "doc/licenses/MIT.md")
Project located at <https://github.com/benblazak/ergodox-firmware>

View File

@ -1,85 +1,53 @@
/* ----------------------------------------------------------------------------
* Copyright (c) 2013 Ben Blazak <benblazak.dev@gmail.com>
* Copyright (c) 2013, 2014 Ben Blazak <benblazak.dev@gmail.com>
* Released under The MIT License (see "doc/licenses/MIT.md")
* Project located at <https://github.com/benblazak/ergodox-firmware>
* ------------------------------------------------------------------------- */
/** description
* A layout with the home layer adapted from the default Kinesis layout. The
* position of the symbol keys on the function layer was (roughly) taken from
* the Arensito layout.
* A layout with the home layer adapted from the default Kinesis layout
* (staying as close the original as possible). The position of the symbol
* keys on the function layer was (roughly) taken from the Arensito layout.
*
* Implements the "layout" section of '.../firmware/keyboard.h'
*
* The template key prefix is `T_`, with the rest of the name indicating the
* key's position in the QWERTY layout.
*
* TODO:
* - do i have the arrow keys in the wrong place? grr. need to check. the
* goal here is to emulate the kinesis, lol.
*/
#ifndef ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__TEMPLATES__KINESIS_MOD__C__H
#define ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__TEMPLATES__KINESIS_MOD__C__H
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#include "../common/definitions.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
#include "../common/exec_key.c.h"
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
void kb__led__logical_on(char led) {
switch(led) {
case 'N': kb__led__on(1); break; // numlock
case 'C': kb__led__on(2); break; // capslock
case 'S': kb__led__on(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch(led) {
case 'N': kb__led__off(1); break; // numlock
case 'C': kb__led__off(2); break; // capslock
case 'S': kb__led__off(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
#include "../fragments/includes.part.h"
#include "../fragments/macros.part.h"
#include "../fragments/types.part.h"
#include "../fragments/variables.part.h"
// ----------------------------------------------------------------------------
// keys
// ----------------------------------------------------------------------------
#include "../common/keys.c.h"
#include "../fragments/keys.part.h"
KEYS__LAYER__NUM_PUSH(10, 3);
KEYS__LAYER__NUM_POP(10);
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
#include "../fragments/led-control.part.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
#include "../fragments/matrix-control.part.h"
// ----------------------------------------------------------------------------
// layout
// ----------------------------------------------------------------------------
#include "../common/matrix.h"
static _layout_t _layout = {
static layout_t layout PROGMEM = {
// ............................................................................
MATRIX_LAYER( // layer 0 : default
@ -87,42 +55,66 @@ static _layout_t _layout = {
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
equal, 1, 2, 3, 4, 5, esc,
tab, T_q, T_w, T_e, T_r, T_t, lpu1l1,
bkslash, T_a, T_s, T_d, T_f, T_g,
shL2kcap, T_z, T_x, T_c, T_v, T_b, lpupo1l1,
tab, T_q, T_w, T_e, T_r, T_t, lpu2l2,
caps, T_a, T_s, T_d, T_f, T_g,
shL2kcap, T_z, T_x, T_c, T_v, T_b, lpupo2l2,
guiL, grave, bkslash, arrowL, arrowR,
ctrlL, altL,
nop, nop, home,
bs, del, end,
// right hand ..... ......... ......... ......... ......... ......... .........
numPush, 6, 7, 8, 9, 0, dash,
brktL, T_y, T_u, T_i, T_o, T_p, brktR,
lpu1l1, 6, 7, 8, 9, 0, dash,
lpu2l2, T_y, T_u, T_i, T_o, T_p,T_bkslash,
T_h, T_j, T_k, T_l,T_semicol, T_quote,
lpupo1l1, T_n, T_m, T_comma, T_period, T_slash, shR2kcap,
arrowL, arrowD, arrowU, arrowR, guiR,
lpupo2l2, T_n, T_m, T_comma, T_period, T_slash, shR2kcap,
arrowU, arrowD, brktL, brktR, guiR,
altR, ctrlR,
pageU, nop, nop,
pageD, enter, space ),
// ............................................................................
MATRIX_LAYER( // layer 1 : function and symbol keys
MATRIX_LAYER( // layer 1 : number pad
// macro, unused,
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
nop, F1, F2, F3, F4, F5, F11,
transp, braceL, braceR, brktL, brktR, nop, lpo1l1,
transp, semicol, slash, dash, kp0, colon,
transp, kp6, kp7, kp8, kp9, plus, lpupo2l2,
transp, transp, transp, transp, transp, transp, transp,
transp, transp, transp, transp, transp, transp, transp,
nop, transp, transp, transp, transp, transp,
transp, transp, transp, transp, transp, transp, transp,
transp, ins, transp, transp, transp,
transp, transp,
transp, transp, transp,
transp, transp, transp,
// right hand ..... ......... ......... ......... ......... ......... .........
lpo1l1, transp, lpo1l1, equal, slash, asterisk, transp,
transp, transp, 7, 8, 9, dash, transp,
transp, 4, 5, 6, plus, transp,
transp, transp, 1, 2, 3, enter, transp,
transp, transp, period, enter, transp,
transp, transp,
transp, transp, transp,
transp, transp, 0 ),
// ............................................................................
MATRIX_LAYER( // layer 2 : symbols and function keys
// macro, unused,
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
transp, F1, F2, F3, F4, F5, F11,
transp, braceL, braceR, brktL, brktR, nop, lpo2l2,
transp, semicol, slash, dash, 0, colon,
transp, 6, 7, 8, 9, plus, lpupo3l3,
transp, transp, transp, transp, transp,
transp, transp,
transp, transp, transp,
transp, transp, transp,
// right hand ..... ......... ......... ......... ......... ......... .........
F12, F6, F7, F8, F9, F10, power,
transp, nop, undersc, lessThan, grtrThan, dollar, volumeU,
bkslash, kp1, parenL, parenR, equal, volumeD,
lpupo2l2, asterisk, kp2, kp3, kp4, kp5, mute,
lpo2l2, nop, undersc, lessThan, grtrThan, dollar, volumeU,
bkslash, 1, parenL, parenR, equal, volumeD,
lpupo3l3, asterisk, 2, 3, 4, 5, mute,
transp, transp, transp, transp, transp,
transp, transp,
transp, transp, transp,
@ -130,7 +122,7 @@ shL2kcap, T_z, T_x, T_c, T_v, T_b, lpupo1l1,
// ............................................................................
MATRIX_LAYER( // layer 2 : keyboard functions
MATRIX_LAYER( // layer 3 : keyboard functions
// macro, unused,
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
@ -152,35 +144,6 @@ shL2kcap, T_z, T_x, T_c, T_v, T_b, lpupo1l1,
nop, nop, nop,
nop, nop, nop ),
// ............................................................................
MATRIX_LAYER( // layer 3 : numpad
// macro, unused,
K, nop,
// left hand ...... ......... ......... ......... ......... ......... .........
transp, transp, transp, transp, transp, transp, transp,
transp, transp, transp, transp, transp, transp, transp,
transp, transp, transp, transp, transp, transp,
transp, transp, transp, transp, transp, transp, transp,
transp, ins, transp, transp, transp,
transp, transp,
transp, transp, transp,
transp, transp, transp,
// right hand ..... ......... ......... ......... ......... ......... .........
numPop, transp, numPop, equal, kpDiv, kpMul, transp,
transp, transp, kp7, kp8, kp9, kpSub, transp,
transp, kp4, kp5, kp6, kpAdd, transp,
transp, transp, kp1, kp2, kp3, kpEnter, transp,
transp, transp, period, kpEnter, transp,
transp, transp,
transp, transp, transp,
transp, transp, kp0 ),
// ............................................................................
};
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
#endif // ERGODOX_FIRMWARE__KEYBOARD__ERGODOX__LAYOUT__TEMPLATES__KINESIS_MOD__C__H

View File

@ -19,6 +19,13 @@
#include "../../../../firmware/lib/layout/key-functions.h"
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
#include "./fragments/led-control.part.h"
// ----------------------------------------------------------------------------
// matrix control
// ----------------------------------------------------------------------------
@ -61,28 +68,3 @@ void kb__layout__exec_key(bool pressed, uint8_t row, uint8_t column) {
}
}
// ----------------------------------------------------------------------------
// LED control
// ----------------------------------------------------------------------------
void kb__led__logical_on(char led) {
switch(led) {
case 'N': kb__led__on(1); break; // numlock
case 'C': kb__led__on(2); break; // capslock
case 'S': kb__led__on(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}
void kb__led__logical_off(char led) {
switch(led) {
case 'N': kb__led__off(1); break; // numlock
case 'C': kb__led__off(2); break; // capslock
case 'S': kb__led__off(3); break; // scroll lock
case 'O': break; // compose
case 'K': break; // kana
};
}

View File

@ -147,11 +147,15 @@ cleanall:
-@rm -vf $(KEYBOARD_LAYOUTS:%=firmware--%.hex)
all-layouts:
for layout in $(KEYBOARD_LAYOUTS); do \
@for layout in $(KEYBOARD_LAYOUTS); do \
echo; \
echo '--- cleaning ---'; \
make clean-target-files all KEYBOARD_LAYOUT=$$layout; \
mv $(TARGET).hex $(TARGET)--$$layout.hex; \
done
make clean-target-files
@echo
@echo '--- cleaning ---'
@make clean-target-files
# -----------------------------------------------------------------------------