summary refs log tree commit diff
path: root/users/yet-another-developer/yet-another-developer.c
diff options
context:
space:
mode:
authorYet Another Developer <50936645+yet-another-developer@users.noreply.github.com>2019-10-21 02:07:57 +0800
committerDrashna Jaelre <drashna@live.com>2019-10-20 11:07:56 -0700
commit3d53ea439c277e49cd4149a6caea727304f41ace (patch)
tree1d782a97be651ff911342cbec19cdb18ceeeda62 /users/yet-another-developer/yet-another-developer.c
parentf64d9b06215bb08d7f77aeba126c0804fffd0064 (diff)
[Keymap] Ergodash keymap for yet-another-developer (#7046)
* Initialize ergodash rev 1 keymap

./util/new_keymap.sh ergodash/rev1 yet-another-developer

* Add user space configurations referenced from drashna

* Start community layout for ergodash in ortho_5x14

* Remove unused layers

* Add userspace layers

* Add Userspace gitignore

Hide Secrets

* Remove userspace unused drashna features

* Scrap default keymap and follow drashna's template

* Add code referenced from kuchosauronad0

* Make sure that the author is named Developer

* Replace middle keys del and bksp with curly brace

* Reduce ONESHOT_TIMEOUT from 3sec to 2sec

* Remove adjust key AG_SWAP

* Disable UNICODEMAP_ENABLE, remove code causing build fail

* Increase TAPPING_TERM to 240

Reason:  Because Space is also LOWER, space sometimes not registering.
PS: I dont want to #define RETRO_TAPPING yet

* Update KC_MAKE to use :flash

* Remove TAP_ONCE, use tap_code

Signed-off-by: Developer <anotherdeveloper@icloud.com>

* Remove redundant code implementation of keyboard_post_init_user

https://github.com/qmk/qmk_firmware/pull/7046

users/yet-another-developer/leader.c
```
  static bool has_ran_yet;
  if (!has_ran_yet) {
    has_ran_yet = true;
    startup_user();
```
Comment for lines +11  – +14
 @drashna: Not needed anymore. You can use keyboard_post_init_user now.

Signed-off-by: Developer <anotherdeveloper@icloud.com>
Diffstat (limited to 'users/yet-another-developer/yet-another-developer.c')
-rw-r--r--users/yet-another-developer/yet-another-developer.c160
1 files changed, 160 insertions, 0 deletions
diff --git a/users/yet-another-developer/yet-another-developer.c b/users/yet-another-developer/yet-another-developer.c
new file mode 100644
index 0000000000..b729c06219
--- /dev/null
+++ b/users/yet-another-developer/yet-another-developer.c
@@ -0,0 +1,160 @@
+#include "quantum.h"
+#include "yet-another-developer.h"
+
+userspace_config_t userspace_config;
+
+#if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
+    #define YAD_UNICODE_MODE UC_WIN
+#else
+// set to 2 for UC_WIN, set to 4 for UC_WINC
+    #define YAD_UNICODE_MODE 2
+#endif
+
+
+bool mod_key_press_timer(uint16_t code, uint16_t mod_code, bool pressed) {
+    static uint16_t this_timer;
+    if (pressed) {
+        this_timer = timer_read();
+    } else {
+        if (timer_elapsed(this_timer) < TAPPING_TERM) {
+            tap_code(code);
+        } else {
+            register_code(mod_code);
+            tap_code(code);
+            unregister_code(mod_code);
+        }
+    }
+    return false;
+}
+
+bool mod_key_press(uint16_t code, uint16_t mod_code, bool pressed, uint16_t this_timer) {
+    if (pressed) {
+        this_timer = timer_read();
+    } else {
+        if (timer_elapsed(this_timer) < TAPPING_TERM) {
+            tap_code(code);
+        } else {
+            register_code(mod_code);
+            tap_code(code);
+            unregister_code(mod_code);
+        }
+    }
+    return false;
+}
+
+// Add reconfigurable functions here, for keymap customization
+// This allows for a global, userspace functions, and continued
+// customization of the keymap.  Use _keymap instead of _user
+// functions in the keymaps
+__attribute__ ((weak))
+void matrix_init_keymap(void) {}
+
+// Call user matrix init, set default RGB colors and then
+// call the keymap's init function
+void matrix_init_user(void) {
+  userspace_config.raw = eeconfig_read_user();
+
+  #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
+    set_unicode_input_mode(YAD_UNICODE_MODE);
+    get_unicode_input_mode();
+  #endif //UNICODE_ENABLE
+
+  matrix_init_keymap();
+}
+
+__attribute__((weak))
+void keyboard_post_init_keymap(void) {}
+
+void keyboard_post_init_user(void) {
+#ifdef RGBLIGHT_ENABLE
+  keyboard_post_init_rgb();
+#endif
+    keyboard_post_init_keymap();
+}
+
+__attribute__((weak))
+void suspend_power_down_keymap(void) {}
+
+void suspend_power_down_user(void) {
+    suspend_power_down_keymap();
+}
+
+__attribute__((weak))
+void suspend_wakeup_init_keymap(void) {}
+
+void suspend_wakeup_init_user(void) {
+    suspend_wakeup_init_keymap();
+}
+
+__attribute__((weak))
+void matrix_scan_keymap(void) {}
+
+__attribute__ ((weak))
+void matrix_scan_user(void){
+
+#ifdef TAP_DANCE_ENABLE  // Run Diablo 3 macro checking code.
+//  run_diablo_macro_check();
+#endif // TAP_DANCE_ENABLE
+
+#ifdef RGBLIGHT_ENABLE
+  matrix_scan_rgb();
+#endif // RGBLIGHT_ENABLE
+
+  matrix_scan_keymap();
+}
+
+__attribute__((weak))
+layer_state_t layer_state_set_keymap(layer_state_t state) {
+    return state;
+}
+
+// on layer change, no matter where the change was initiated
+// Then runs keymap's layer change check
+layer_state_t layer_state_set_user(layer_state_t state) {
+    state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST);
+#ifdef RGBLIGHT_ENABLE
+  state = layer_state_set_rgb(state);
+#endif // RGBLIGHT_ENABLE
+    return layer_state_set_keymap(state);
+}
+
+__attribute__((weak))
+layer_state_t default_layer_state_set_keymap(layer_state_t state) {
+    return state;
+}
+
+// Runs state check and changes underglow color and animation
+layer_state_t default_layer_state_set_user(layer_state_t state) {
+    state = default_layer_state_set_keymap(state);
+#if 0
+#ifdef RGBLIGHT_ENABLE
+  state = default_layer_state_set_rgb(state);
+#endif // RGBLIGHT_ENABLE
+#endif
+    return state;
+}
+
+__attribute__ ((weak))
+void led_set_keymap(uint8_t usb_led) {}
+
+// Any custom LED code goes here.
+// So far, I only have keyboard specific code,
+// So nothing goes here.
+void led_set_user(uint8_t usb_led) {
+  led_set_keymap(usb_led);
+}
+
+__attribute__ ((weak))
+void eeconfig_init_keymap(void) {}
+
+void eeconfig_init_user(void) {
+  userspace_config.raw = 0;
+  userspace_config.rgb_layer_change = true;
+  eeconfig_update_user(userspace_config.raw);
+  #if (defined(UNICODE_ENABLE) || defined(UNICODEMAP_ENABLE) || defined(UCIS_ENABLE))
+    set_unicode_input_mode(YAD_UNICODE_MODE);
+    get_unicode_input_mode();
+  #else
+    eeprom_update_byte(EECONFIG_UNICODEMODE, YAD_UNICODE_MODE);
+  #endif
+}