Created
September 11, 2019 10:20
-
-
Save burakcan/6b5bee724824bf778f3a2698543e4abf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum custom_keycodes { | |
LAUGH = SAFE_RANGE | |
}; | |
static uint16_t random_value = 157; | |
const uint16_t random_chars[9] = { | |
KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L | |
}; | |
bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
switch(keycode) { | |
case LAUGH: | |
if (record->event.pressed) { | |
uint8_t clockbyte=0; | |
clockbyte = TCNT1 % 256; | |
uint8_t rval; | |
random_value = ((random_value + randadd) * randmul) % randmod; | |
uint8_t len = ((random_value ^ clockbyte) % 4) + 4; | |
for (uint8_t i = 0; i <= len; i++) { | |
random_value = ((random_value + randadd) * randmul) % randmod; | |
rval = (random_value ^ clockbyte) % 9; | |
register_code(random_chars[rval]); | |
unregister_code(random_chars[rval]); | |
} | |
} | |
return false; | |
} | |
return true; | |
} |
Ardakilic
commented
Nov 28, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment