summaryrefslogtreecommitdiffstats
path: root/keyboards/cannonkeys/satisfaction75/satisfaction75.c
diff options
context:
space:
mode:
Diffstat (limited to 'keyboards/cannonkeys/satisfaction75/satisfaction75.c')
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction75.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
index 682805f321..8b5016437c 100644
--- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c
+++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c
@@ -5,11 +5,6 @@
#include <ch.h>
#include <hal.h>
-#ifdef QWIIC_MICRO_OLED_ENABLE
-#include "micro_oled.h"
-#include "qwiic.h"
-#endif
-
#include "timer.h"
#include "raw_hid.h"
@@ -20,18 +15,17 @@
/* Artificial delay added to get media keys to work in the encoder*/
#define MEDIA_KEY_DELAY 10
-uint16_t last_flush;
-
volatile uint8_t led_numlock = false;
volatile uint8_t led_capslock = false;
volatile uint8_t led_scrolllock = false;
uint8_t layer;
-bool queue_for_send = false;
bool clock_set_mode = false;
uint8_t oled_mode = OLED_DEFAULT;
-bool oled_sleeping = false;
+bool oled_repaint_requested = false;
+bool oled_wakeup_requested = false;
+uint32_t oled_sleep_timer;
uint8_t encoder_value = 32;
uint8_t encoder_mode = ENC_MODE_VOLUME;
@@ -167,7 +161,7 @@ void raw_hid_receive_kb( uint8_t *data, uint8_t length )
case id_oled_mode:
{
oled_mode = command_data[1];
- draw_ui();
+ oled_request_wakeup();
break;
}
case id_encoder_modes:
@@ -247,18 +241,17 @@ 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);
- queue_for_send = true;
+ oled_request_wakeup();
return state;
}
bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
- queue_for_send = true;
+ oled_request_wakeup();
switch (keycode) {
case OLED_TOGG:
if(!clock_set_mode){
if (record->event.pressed) {
oled_mode = (oled_mode + 1) % _NUM_OLED_MODES;
- draw_ui();
}
}
return false;
@@ -302,8 +295,8 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) {
bool encoder_update_kb(uint8_t index, bool clockwise) {
if (!encoder_update_user(index, clockwise)) return false;
+ oled_request_wakeup();
encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64;
- queue_for_send = true;
if (index == 0) {
if (layer == 0){
uint16_t mapped_code = 0;
@@ -376,9 +369,9 @@ void matrix_init_kb(void)
#endif // VIA_ENABLE
rtcGetTime(&RTCD1, &last_timespec);
- queue_for_send = true;
backlight_init_ports();
matrix_init_user();
+ oled_request_wakeup();
}
@@ -388,22 +381,8 @@ void housekeeping_task_kb(void) {
if (minutes_since_midnight != last_minute){
last_minute = minutes_since_midnight;
- if(!oled_sleeping){
- queue_for_send = true;
- }
+ oled_request_repaint();
}
-#ifdef QWIIC_MICRO_OLED_ENABLE
- if (queue_for_send && oled_mode != OLED_OFF) {
- oled_sleeping = false;
- read_host_led_state();
- draw_ui();
- queue_for_send = false;
- }
- if (timer_elapsed(last_flush) > ScreenOffInterval && !oled_sleeping) {
- send_command(DISPLAYOFF); /* 0xAE */
- oled_sleeping = true;
- }
-#endif
}
//