aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jack Humbert <jack.humb@gmail.com>2016-06-29 18:29:20 -0400
committerGravatar Jack Humbert <jack.humb@gmail.com>2016-06-29 18:29:20 -0400
commit197f152dee834a737cd820f2a95d1ade98be4898 (patch)
tree5b545c4c4ea27d151defa607ddae8750a3feb3f4
parent65faab3b89245f81c50b029ca178aed175d5f330 (diff)
downloadqmk_firmware-197f152dee834a737cd820f2a95d1ade98be4898.tar.gz
adds random base64 character generator
-rw-r--r--keyboards/planck/keymaps/experimental/keymap.c15
-rw-r--r--keyboards/planck/rev3/Makefile2
-rw-r--r--keyboards/planck/rev4/Makefile2
-rw-r--r--quantum/quantum.c35
-rw-r--r--quantum/quantum.h3
5 files changed, 53 insertions, 4 deletions
diff --git a/keyboards/planck/keymaps/experimental/keymap.c b/keyboards/planck/keymaps/experimental/keymap.c
index 041285684..856059289 100644
--- a/keyboards/planck/keymaps/experimental/keymap.c
+++ b/keyboards/planck/keymaps/experimental/keymap.c
@@ -54,7 +54,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_BSPC},
{KC_ESC, 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 },
- {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+ {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Colemak
@@ -90,7 +90,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
{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 },
- {M(M_BL), KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
+ {KC_LEAD, KC_LCTL, KC_LALT, KC_LGUI, LOWER, KC_SPC, KC_SPC, RAISE, KC_LEFT, KC_DOWN, KC_UP, KC_RGHT}
},
/* Lower
@@ -326,6 +326,17 @@ void matrix_scan_user(void) {
leading = false;
leader_end();
+ SEQ_ONE_KEY (KC_R) {
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ tap_random_base64();
+ }
SEQ_ONE_KEY (KC_V) {
SEND_STRING (QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
}
diff --git a/keyboards/planck/rev3/Makefile b/keyboards/planck/rev3/Makefile
index 559409682..3ed1445e4 100644
--- a/keyboards/planck/rev3/Makefile
+++ b/keyboards/planck/rev3/Makefile
@@ -1,4 +1,4 @@
-AUDIO_ENABLE = no # Audio output on port C6
+AUDIO_ENABLE ?= no # Audio output on port C6
ifndef QUANTUM_DIR
include ../../../Makefile
diff --git a/keyboards/planck/rev4/Makefile b/keyboards/planck/rev4/Makefile
index 01d848e98..ed09f85a4 100644
--- a/keyboards/planck/rev4/Makefile
+++ b/keyboards/planck/rev4/Makefile
@@ -1,4 +1,4 @@
-AUDIO_ENABLE = yes # Audio output on port C6
+AUDIO_ENABLE ?= yes # Audio output on port C6
ifndef QUANTUM_DIR
include ../../../Makefile
diff --git a/quantum/quantum.c b/quantum/quantum.c
index c0580e0aa..224bfb795 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -307,6 +307,41 @@ void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3) {
}
}
+void tap_random_base64(void) {
+ uint8_t key = (TCNT0 + TCNT1 + TCNT3 + TCNT4) % 64;
+ // uint8_t key = rand() % 64;
+ switch (key) {
+ case 0 ... 25:
+ register_code(KC_LSFT);
+ register_code(key + KC_A);
+ unregister_code(key + KC_A);
+ unregister_code(KC_LSFT);
+ break;
+ case 26 ... 51:
+ register_code(key - 26 + KC_A);
+ unregister_code(key - 26 + KC_A);
+ break;
+ case 52:
+ register_code(KC_0);
+ unregister_code(KC_0);
+ break;
+ case 53 ... 61:
+ register_code(key - 53 + KC_1);
+ unregister_code(key - 53 + KC_1);
+ break;
+ case 62:
+ register_code(KC_LSFT);
+ register_code(KC_EQL);
+ unregister_code(KC_EQL);
+ unregister_code(KC_LSFT);
+ break;
+ case 63:
+ register_code(KC_SLSH);
+ unregister_code(KC_SLSH);
+ break;
+ }
+}
+
void matrix_init_quantum() {
#ifdef BACKLIGHT_ENABLE
backlight_init_ports();
diff --git a/quantum/quantum.h b/quantum/quantum.h
index ad180c71f..dd290ac00 100644
--- a/quantum/quantum.h
+++ b/quantum/quantum.h
@@ -60,6 +60,9 @@ void send_string(const char *str);
// For tri-layer
void update_tri_layer(uint8_t layer1, uint8_t layer2, uint8_t layer3);
+
+void tap_random_base64(void);
+
#define IS_LAYER_ON(layer) (layer_state & (1UL << (layer)))
#define IS_LAYER_OFF(layer) (~layer_state & (1UL << (layer)))