1
0
Fork 0

Sample of using build info to generate keystrokes (#412)

* More documentation

* Saving crontab for user  on host

* Restructuring in keeping with recent changes to conventions

* Simplify submitting my fave cbbrowne keystroke by using SEND_STRING()

* Local change, not apropos to have in this repo

* Simplify logic; no need to return so much

* Add in a version key

* Add docs

* Split build date into a separate DEFINE

* Ensure there is a value even if not working within a git repo

* Should not include the compiled code in the repo

* compiled.hex files should not be included in the repo; they represent generated compiled code

* Fix spelling in comment

* Remove more generated files

* Add rule to ignore contents of .build directories; their contents are generated

* Revert removals of compiled files
This commit is contained in:
Christopher Browne 2016-06-16 17:16:51 -04:00 committed by Jack Humbert
parent 91b469d88f
commit 2cf26915e3
6 changed files with 16 additions and 8 deletions

View file

@ -114,7 +114,7 @@ include $(TMK_PATH)/protocol/lufa.mk
include $(TMK_PATH)/common.mk include $(TMK_PATH)/common.mk
include $(TMK_PATH)/rules.mk include $(TMK_PATH)/rules.mk
GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d") GIT_VERSION := $(shell git describe --abbrev=6 --dirty --always --tags 2>/dev/null || date +"%Y-%m-%d-%H:%M:%S")
BUILD_DATE := $(shell date +"%Y-%m-%d-%H:%M:%S")
OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\" OPT_DEFS += -DQMK_KEYBOARD=\"$(KEYBOARD)\" -DQMK_KEYMAP=\"$(KEYMAP)\"
OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" -DQMK_BUILDDATE=\"$(BUILD_DATE)\"

1
keyboard/planck/keymaps/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.build

View file

@ -6,7 +6,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT}, {KC_TAB, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_ENT},
{KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, 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_QUOT},
{KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT} {KC_LCTL, KC_LGUI, KC_LALT, BL_STEP, FUNC(2), KC_SPC, KC_SPC, FUNC(1), KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
// Space is repeated to accommadate for both spacebar wiring positions // Space is repeated to accommodate for both spacebar wiring positions
}, },
[1] = { /* WASD + NumPad */ [1] = { /* WASD + NumPad */
{KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS}, {KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_P7, KC_P8, KC_P9, KC_PSLS, KC_PMNS, KC_TRNS},

View file

@ -74,7 +74,8 @@ enum macro_id {
M_LED = 0, M_LED = 0,
M_USERNAME, M_USERNAME,
M_RANDDIGIT, M_RANDDIGIT,
M_RANDLETTER M_RANDLETTER,
M_VERSION
}; };
/* Note that Planck has dimensions 4 rows x 12 columns */ /* Note that Planck has dimensions 4 rows x 12 columns */
@ -99,7 +100,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY} {KC_TRNS, DF(_KP), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS, KC_MNXT, KC_VOLD, KC_VOLU, KC_MPLY}
}, },
[_KP] = { /* Key Pad */ [_KP] = { /* Key Pad */
{KC_ESC, M(M_USERNAME), KC_F9, KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC}, {KC_ESC, M(M_USERNAME), M(M_VERSION), KC_F10, KC_F11, KC_F12, KC_PGUP, KC_KP_ENTER, KC_7, KC_8, KC_9, KC_BSPC},
{KC_LCTL, M(M_RANDDIGIT), KC_F5, KC_F6, KC_F7, KC_F8, KC_PGDN, KC_KP_MINUS, KC_4, KC_5, KC_6, KC_PIPE}, {KC_LCTL, M(M_RANDDIGIT), KC_F5, KC_F6, KC_F7, KC_F8, KC_PGDN, KC_KP_MINUS, KC_4, KC_5, KC_6, KC_PIPE},
{KC_LSFT, M(M_RANDLETTER), KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_KP_PLUS, KC_1, KC_2, KC_3, KC_ENTER}, {KC_LSFT, M(M_RANDLETTER), KC_F1, KC_F2, KC_F3, KC_F4, KC_DEL, KC_KP_PLUS, KC_1, KC_2, KC_3, KC_ENTER},
{BL_STEP, M(M_LED), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT} {BL_STEP, M(M_LED), KC_LALT, KC_LGUI, KC_NO, KC_SPC, KC_SPC, DF(_QW), KC_LEFT, KC_DOWN, KC_UP, KC_RIGHT}
@ -135,6 +136,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
SEND_STRING("cbbrowne"); SEND_STRING("cbbrowne");
} }
break; break;
case M_VERSION:
if (record->event.pressed) {
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@" QMK_VERSION "@" QMK_BUILDDATE);
}
break;
case M_RANDDIGIT: case M_RANDDIGIT:
/* Generate, based on random number generator, a keystroke for /* Generate, based on random number generator, a keystroke for
a numeric digit chosen at random */ a numeric digit chosen at random */

View file

@ -29,6 +29,7 @@ doing sundry experimentation:
in a more useful context. in a more useful context.
- Key [2][2] aka "a" uses a random number generator to select a digit 0-9 at random - Key [2][2] aka "a" uses a random number generator to select a digit 0-9 at random
- Key [3][2] aka "z" uses a random number generator to select a letter a-z at random - Key [3][2] aka "z" uses a random number generator to select a letter a-z at random
- Key [1][3] aka "e" spits out the keymap version number
2. Some code structure ideas 2. Some code structure ideas
--------------------------------------------------- ---------------------------------------------------