summaryrefslogtreecommitdiffstats
path: root/quantum
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2016-06-29 18:29:20 -0400
committerJack Humbert <jack.humb@gmail.com>2016-06-29 18:29:20 -0400
commit197f152dee834a737cd820f2a95d1ade98be4898 (patch)
tree5b545c4c4ea27d151defa607ddae8750a3feb3f4 /quantum
parent65faab3b89245f81c50b029ca178aed175d5f330 (diff)
adds random base64 character generator
Diffstat (limited to 'quantum')
-rw-r--r--quantum/quantum.c35
-rw-r--r--quantum/quantum.h3
2 files changed, 38 insertions, 0 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index c0580e0aa5..224bfb7951 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 ad180c71f8..dd290ac00c 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)))