From 2cf26915e3ed737ae83cf7b54f7e84fc2f0d3b40 Mon Sep 17 00:00:00 2001 From: Christopher Browne Date: Thu, 16 Jun 2016 17:16:51 -0400 Subject: 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 --- keyboard/planck/keymaps/cbbrowne/keymap.c | 10 ++++++++-- keyboard/planck/keymaps/cbbrowne/readme.md | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'keyboard/planck/keymaps/cbbrowne') diff --git a/keyboard/planck/keymaps/cbbrowne/keymap.c b/keyboard/planck/keymaps/cbbrowne/keymap.c index 482cf63e1..7fe391ec5 100644 --- a/keyboard/planck/keymaps/cbbrowne/keymap.c +++ b/keyboard/planck/keymaps/cbbrowne/keymap.c @@ -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 */ diff --git a/keyboard/planck/keymaps/cbbrowne/readme.md b/keyboard/planck/keymaps/cbbrowne/readme.md index edb33f483..c676dd2c1 100644 --- a/keyboard/planck/keymaps/cbbrowne/readme.md +++ b/keyboard/planck/keymaps/cbbrowne/readme.md @@ -28,7 +28,8 @@ doing sundry experimentation: to use it, but hey, it shows how others might use this facility 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 [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 --------------------------------------------------- -- cgit v1.2.3-24-g4f1b