qmk

QMK Firmware
git clone git://git.z3bra.org/qmk.git
Log | Files | Refs | Submodules | LICENSE

satisfaction75.h (2472B)


      1 #pragma once
      2 
      3 #include "quantum.h"
      4 
      5 #ifdef KEYBOARD_cannonkeys_satisfaction75_prototype
      6     #include "prototype.h"
      7 #else
      8     #include "rev1.h"
      9 #endif
     10 
     11 /* screen off after this many milliseconds */
     12 #define ScreenOffInterval 60000 /* milliseconds */
     13 
     14 typedef union {
     15     uint8_t raw;
     16     struct {
     17         bool    enable :1;
     18         bool    breathing : 1;
     19         uint8_t level  :6;
     20     };
     21 } backlight_config_t;
     22 
     23 // Start these at the USER code range in VIA
     24 enum my_keycodes {
     25   ENC_PRESS = 0x5F80,
     26   CLOCK_SET,
     27   OLED_TOGG
     28 };
     29 
     30 enum s75_keyboard_value_id {
     31   id_encoder_modes = 0x80,
     32   id_oled_default_mode,
     33   id_encoder_custom,
     34   id_oled_mode
     35 };
     36 
     37 enum encoder_modes {
     38   ENC_MODE_VOLUME,
     39   ENC_MODE_MEDIA,
     40   ENC_MODE_SCROLL,
     41   ENC_MODE_BRIGHTNESS,
     42   ENC_MODE_BACKLIGHT,
     43   ENC_MODE_CUSTOM0,
     44   ENC_MODE_CUSTOM1,
     45   ENC_MODE_CUSTOM2,
     46   _NUM_ENCODER_MODES,
     47   ENC_MODE_CLOCK_SET // This shouldn't be included in the default modes, so we put it after NUM_ENCODER_MODES
     48 };
     49 
     50 enum oled_modes {
     51   OLED_DEFAULT,
     52   OLED_TIME,
     53   OLED_OFF,
     54   _NUM_OLED_MODES
     55 };
     56 
     57 
     58 // Keyboard Information
     59 extern volatile uint8_t led_numlock;
     60 extern volatile uint8_t led_capslock;
     61 extern volatile uint8_t led_scrolllock;
     62 extern uint8_t layer;
     63 
     64 // OLED Behavior
     65 extern uint16_t last_flush;
     66 extern bool queue_for_send;
     67 extern uint8_t oled_mode;
     68 extern bool oled_sleeping;
     69 
     70 // Encoder Behavior
     71 extern uint8_t encoder_value;
     72 extern uint8_t encoder_mode;
     73 extern uint8_t enabled_encoder_modes;
     74 
     75 // RTC
     76 extern RTCDateTime last_timespec;
     77 extern uint16_t last_minute;
     78 
     79 // RTC Configuration
     80 extern bool clock_set_mode;
     81 extern uint8_t time_config_idx;
     82 extern int8_t hour_config;
     83 extern int16_t minute_config;
     84 extern int8_t year_config;
     85 extern int8_t month_config;
     86 extern int8_t day_config;
     87 extern uint8_t previous_encoder_mode;
     88 
     89 // Backlighting
     90 extern backlight_config_t kb_backlight_config;
     91 extern bool kb_backlight_breathing;
     92 
     93 void pre_encoder_mode_change(void);
     94 void post_encoder_mode_change(void);
     95 void change_encoder_mode(bool negative);
     96 uint16_t handle_encoder_clockwise(void);
     97 uint16_t handle_encoder_ccw(void);
     98 uint16_t handle_encoder_press(void);
     99 
    100 void update_time_config(int8_t increment);
    101 
    102 __attribute__ ((weak))
    103 void draw_ui(void);
    104 void draw_default(void);
    105 void draw_clock(void);
    106 
    107 void backlight_init_ports(void);
    108 void backlight_set(uint8_t level);
    109 bool is_breathing(void);
    110 void breathing_enable(void);
    111 void breathing_disable(void);
    112 void load_custom_config(void);
    113 void save_backlight_config_to_eeprom(void);