diff options
Diffstat (limited to 'keyboards/cannonkeys/satisfaction75/satisfaction75.c')
-rw-r--r-- | keyboards/cannonkeys/satisfaction75/satisfaction75.c | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c index 682805f32..304df3325 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c | |||
@@ -5,11 +5,6 @@ | |||
5 | #include <ch.h> | 5 | #include <ch.h> |
6 | #include <hal.h> | 6 | #include <hal.h> |
7 | 7 | ||
8 | #ifdef QWIIC_MICRO_OLED_ENABLE | ||
9 | #include "micro_oled.h" | ||
10 | #include "qwiic.h" | ||
11 | #endif | ||
12 | |||
13 | #include "timer.h" | 8 | #include "timer.h" |
14 | 9 | ||
15 | #include "raw_hid.h" | 10 | #include "raw_hid.h" |
@@ -20,18 +15,14 @@ | |||
20 | /* Artificial delay added to get media keys to work in the encoder*/ | 15 | /* Artificial delay added to get media keys to work in the encoder*/ |
21 | #define MEDIA_KEY_DELAY 10 | 16 | #define MEDIA_KEY_DELAY 10 |
22 | 17 | ||
23 | uint16_t last_flush; | ||
24 | |||
25 | volatile uint8_t led_numlock = false; | 18 | volatile uint8_t led_numlock = false; |
26 | volatile uint8_t led_capslock = false; | 19 | volatile uint8_t led_capslock = false; |
27 | volatile uint8_t led_scrolllock = false; | 20 | volatile uint8_t led_scrolllock = false; |
28 | 21 | ||
29 | uint8_t layer; | 22 | uint8_t layer; |
30 | 23 | ||
31 | bool queue_for_send = false; | ||
32 | bool clock_set_mode = false; | 24 | bool clock_set_mode = false; |
33 | uint8_t oled_mode = OLED_DEFAULT; | 25 | uint8_t oled_mode = OLED_DEFAULT; |
34 | bool oled_sleeping = false; | ||
35 | 26 | ||
36 | uint8_t encoder_value = 32; | 27 | uint8_t encoder_value = 32; |
37 | uint8_t encoder_mode = ENC_MODE_VOLUME; | 28 | uint8_t encoder_mode = ENC_MODE_VOLUME; |
@@ -167,7 +158,6 @@ void raw_hid_receive_kb( uint8_t *data, uint8_t length ) | |||
167 | case id_oled_mode: | 158 | case id_oled_mode: |
168 | { | 159 | { |
169 | oled_mode = command_data[1]; | 160 | oled_mode = command_data[1]; |
170 | draw_ui(); | ||
171 | break; | 161 | break; |
172 | } | 162 | } |
173 | case id_encoder_modes: | 163 | case id_encoder_modes: |
@@ -247,18 +237,15 @@ void read_host_led_state(void) { | |||
247 | layer_state_t layer_state_set_kb(layer_state_t state) { | 237 | layer_state_t layer_state_set_kb(layer_state_t state) { |
248 | state = layer_state_set_user(state); | 238 | state = layer_state_set_user(state); |
249 | layer = biton32(state); | 239 | layer = biton32(state); |
250 | queue_for_send = true; | ||
251 | return state; | 240 | return state; |
252 | } | 241 | } |
253 | 242 | ||
254 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | 243 | bool process_record_kb(uint16_t keycode, keyrecord_t *record) { |
255 | queue_for_send = true; | ||
256 | switch (keycode) { | 244 | switch (keycode) { |
257 | case OLED_TOGG: | 245 | case OLED_TOGG: |
258 | if(!clock_set_mode){ | 246 | if(!clock_set_mode){ |
259 | if (record->event.pressed) { | 247 | if (record->event.pressed) { |
260 | oled_mode = (oled_mode + 1) % _NUM_OLED_MODES; | 248 | oled_mode = (oled_mode + 1) % _NUM_OLED_MODES; |
261 | draw_ui(); | ||
262 | } | 249 | } |
263 | } | 250 | } |
264 | return false; | 251 | return false; |
@@ -303,7 +290,6 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) { | |||
303 | bool encoder_update_kb(uint8_t index, bool clockwise) { | 290 | bool encoder_update_kb(uint8_t index, bool clockwise) { |
304 | if (!encoder_update_user(index, clockwise)) return false; | 291 | if (!encoder_update_user(index, clockwise)) return false; |
305 | encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; | 292 | encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; |
306 | queue_for_send = true; | ||
307 | if (index == 0) { | 293 | if (index == 0) { |
308 | if (layer == 0){ | 294 | if (layer == 0){ |
309 | uint16_t mapped_code = 0; | 295 | uint16_t mapped_code = 0; |
@@ -376,7 +362,6 @@ void matrix_init_kb(void) | |||
376 | #endif // VIA_ENABLE | 362 | #endif // VIA_ENABLE |
377 | 363 | ||
378 | rtcGetTime(&RTCD1, &last_timespec); | 364 | rtcGetTime(&RTCD1, &last_timespec); |
379 | queue_for_send = true; | ||
380 | backlight_init_ports(); | 365 | backlight_init_ports(); |
381 | matrix_init_user(); | 366 | matrix_init_user(); |
382 | } | 367 | } |
@@ -388,22 +373,14 @@ void housekeeping_task_kb(void) { | |||
388 | 373 | ||
389 | if (minutes_since_midnight != last_minute){ | 374 | if (minutes_since_midnight != last_minute){ |
390 | last_minute = minutes_since_midnight; | 375 | last_minute = minutes_since_midnight; |
391 | if(!oled_sleeping){ | ||
392 | queue_for_send = true; | ||
393 | } | ||
394 | } | 376 | } |
395 | #ifdef QWIIC_MICRO_OLED_ENABLE | 377 | |
396 | if (queue_for_send && oled_mode != OLED_OFF) { | 378 | if((oled_mode == OLED_OFF) && is_oled_on()){ |
397 | oled_sleeping = false; | 379 | oled_off(); |
398 | read_host_led_state(); | ||
399 | draw_ui(); | ||
400 | queue_for_send = false; | ||
401 | } | 380 | } |
402 | if (timer_elapsed(last_flush) > ScreenOffInterval && !oled_sleeping) { | 381 | if((oled_mode != OLED_OFF) && !is_oled_on()){ |
403 | send_command(DISPLAYOFF); /* 0xAE */ | 382 | oled_on(); |
404 | oled_sleeping = true; | ||
405 | } | 383 | } |
406 | #endif | ||
407 | } | 384 | } |
408 | 385 | ||
409 | // | 386 | // |