qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

lulu.c (1020B)


      1 // Copyright 2022 Cole Smith <cole@boadsource.xyz>
      2 // SPDX-License-Identifier: GPL-2.0-or-later
      3 #include "quantum.h"
      4 #include "lib/oled.h"
      5 
      6 #ifdef ENCODER_ENABLE
      7 bool encoder_update_kb(uint8_t index, bool clockwise) {
      8     if (!encoder_update_user(index, clockwise)) { return false; }
      9     if (index == 0) {
     10         if (clockwise) {
     11             tap_code(KC_VOLU);
     12         } else {
     13             tap_code(KC_VOLD);
     14         }
     15     } else if (index == 1) {
     16         if (clockwise) {
     17             tap_code(KC_PGDN);
     18         } else {
     19             tap_code(KC_PGUP);
     20         }
     21     }
     22     return true;
     23 }
     24 #endif
     25 
     26 #ifdef OLED_ENABLE
     27 oled_rotation_t oled_init_kb(oled_rotation_t rotation) {
     28     if (!is_keyboard_master()) {
     29         return OLED_ROTATION_180;
     30     }
     31     return rotation;
     32 }
     33 
     34 bool oled_task_kb(void) {
     35     if (!oled_task_user()) {
     36         return false;
     37     }
     38     if (is_keyboard_master()) {
     39         render_layer_state();
     40     } else {
     41         oled_write_raw_P(bs_logo_img, sizeof(bs_logo_img));
     42     }
     43     return false;
     44 }
     45 #endif