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
pull/415/head
Christopher Browne 9 years ago committed by Jack Humbert
parent 91b469d88f
commit 2cf26915e3

@ -114,7 +114,7 @@ include $(TMK_PATH)/protocol/lufa.mk
include $(TMK_PATH)/common.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_VERSION=\"$(GIT_VERSION)\"
OPT_DEFS += -DQMK_VERSION=\"$(GIT_VERSION)\" -DQMK_BUILDDATE=\"$(BUILD_DATE)\"

@ -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_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}
// Space is repeated to accommadate for both spacebar wiring positions
// Space is repeated to accommodate for both spacebar wiring positions
},
[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},

@ -74,7 +74,8 @@ enum macro_id {
M_LED = 0,
M_USERNAME,
M_RANDDIGIT,
M_RANDLETTER
M_RANDLETTER,
M_VERSION
};
/* 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}
},
[_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_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}
@ -135,6 +136,11 @@ const macro_t *action_get_macro(keyrecord_t *record, uint8_t id, uint8_t opt)
SEND_STRING("cbbrowne");
}
break;
case M_VERSION:
if (record->event.pressed) {
SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP "@" QMK_VERSION "@" QMK_BUILDDATE);
}
break;
case M_RANDDIGIT:
/* Generate, based on random number generator, a keystroke for
a numeric digit chosen at random */

@ -29,6 +29,7 @@ doing sundry experimentation:
in a more useful context.
- 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 [1][3] aka "e" spits out the keymap version number
2. Some code structure ideas
---------------------------------------------------

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save