aboutsummaryrefslogtreecommitdiffstats
path: root/keyboards/cannonkeys/ortho75/ortho75.c
diff options
context:
space:
mode:
authorAndrew Kannan <andrew.kannan@klaviyo.com>2019-06-24 03:28:38 -0400
committerDrashna Jaelre <drashna@live.com>2019-06-24 00:28:38 -0700
commitcd59fe78be54af41c9fa4e5a9474767d8b314cd6 (patch)
treeb36e96f50d47ed69f98bb030074e310e69647326 /keyboards/cannonkeys/ortho75/ortho75.c
parent1a442f9989c825cb42b41845658874f7f9e90ba7 (diff)
downloadfirmware-cd59fe78be54af41c9fa4e5a9474767d8b314cd6.tar.gz
firmware-cd59fe78be54af41c9fa4e5a9474767d8b314cd6.tar.bz2
firmware-cd59fe78be54af41c9fa4e5a9474767d8b314cd6.zip
[Keyboard] Add Ortho75 (#6177)
* Add Ortho75 * fix typo * Add dfu args to rules.mk * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/info.json Co-Authored-By: noroadsleft <18669334+noroadsleft@users.noreply.github.com> * Update keyboards/cannonkeys/ortho75/keymaps/default/keymap.c Co-Authored-By: fauxpark <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/cannonkeys/ortho75/ortho75.c')
-rw-r--r--keyboards/cannonkeys/ortho75/ortho75.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/keyboards/cannonkeys/ortho75/ortho75.c b/keyboards/cannonkeys/ortho75/ortho75.c
new file mode 100644
index 000000000..c3ceee28c
--- /dev/null
+++ b/keyboards/cannonkeys/ortho75/ortho75.c
@@ -0,0 +1,49 @@
+
+#include "ortho75.h"
+
+#define MEDIA_KEY_DELAY 10
+
+uint8_t layer = 0;
+
+uint32_t layer_state_set_kb(uint32_t state) {
+ state = layer_state_set_user(state);
+ layer = biton32(state);
+ return state;
+}
+
+void encoder_update_kb(uint8_t index, bool clockwise) {
+ uint16_t mapped_code = 0;
+ if (index == 0) {
+ if (clockwise) {
+ switch(layer){
+ case 0:
+ default:
+ mapped_code = KC_VOLU;
+ break;
+ case 1:
+ mapped_code = KC_MEDIA_NEXT_TRACK;
+ break;
+ case 2:
+ mapped_code = KC_PGDN;
+ break;
+ }
+ } else {
+ switch(layer){
+ case 0:
+ default:
+ mapped_code = KC_VOLD;
+ break;
+ case 1:
+ mapped_code = KC_MEDIA_PREV_TRACK;
+ break;
+ case 2:
+ mapped_code = KC_PGUP;
+ break;
+ }
+ }
+ uint16_t held_keycode_timer = timer_read();
+ register_code(mapped_code);
+ while (timer_elapsed(held_keycode_timer) < MEDIA_KEY_DELAY){ /* no-op */ }
+ unregister_code(mapped_code);
+ }
+}