summaryrefslogtreecommitdiffstats
path: root/keyboards/cannonkeys
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/cannonkeys')
-rw-r--r--keyboards/cannonkeys/ortho75/ortho75.c73
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.c2
2 files changed, 38 insertions, 37 deletions
diff --git a/keyboards/cannonkeys/ortho75/ortho75.c b/keyboards/cannonkeys/ortho75/ortho75.c
index 7c722d7156..58b7396a1b 100644
--- a/keyboards/cannonkeys/ortho75/ortho75.c
+++ b/keyboards/cannonkeys/ortho75/ortho75.c
@@ -5,47 +5,48 @@
uint8_t layer = 0;
-uint32_t layer_state_set_kb(uint32_t state) {
- state = layer_state_set_user(state);
- layer = biton32(state);
- return state;
+layer_state_t layer_state_set_kb(layer_state_t state) {
+ state = layer_state_set_user(state);
+ layer = get_highest_layer(state);
+ return state;
}
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) return false;
- 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;
+ 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;
+ }
}
- } 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);
}
- 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);
- }
- return true;
+ return true;
}
diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
index bd7eaf1885..9435377839 100644
--- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c
+++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
@@ -240,7 +240,7 @@ void read_host_led_state(void) {
layer_state_t layer_state_set_kb(layer_state_t state) {
state = layer_state_set_user(state);
- layer = biton32(state);
+ layer = get_highest_layer(state);
oled_request_wakeup();
return state;
}