From 22cafb9a2046b0c6c7b9df8c719cd515bec4d798 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sat, 9 Oct 2021 14:46:47 +0100 Subject: Migrate satisfaction75 away from QWIIC_DRIVERS (#14747) * stash * refactor old draw * refactor old draw - tidy * refactor old draw - tidy * refactor old draw - reorder for diffs * refactor old draw - reorder for diffs --- .../cannonkeys/satisfaction75/satisfaction75.c | 33 ++++------------------ 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'keyboards/cannonkeys/satisfaction75/satisfaction75.c') diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction75.c b/keyboards/cannonkeys/satisfaction75/satisfaction75.c index 682805f321..304df33258 100644 --- a/keyboards/cannonkeys/satisfaction75/satisfaction75.c +++ b/keyboards/cannonkeys/satisfaction75/satisfaction75.c @@ -5,11 +5,6 @@ #include #include -#ifdef QWIIC_MICRO_OLED_ENABLE -#include "micro_oled.h" -#include "qwiic.h" -#endif - #include "timer.h" #include "raw_hid.h" @@ -20,18 +15,14 @@ /* 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; uint8_t encoder_value = 32; uint8_t encoder_mode = ENC_MODE_VOLUME; @@ -167,7 +158,6 @@ void raw_hid_receive_kb( uint8_t *data, uint8_t length ) case id_oled_mode: { oled_mode = command_data[1]; - draw_ui(); break; } case id_encoder_modes: @@ -247,18 +237,15 @@ 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; return state; } bool process_record_kb(uint16_t keycode, keyrecord_t *record) { - queue_for_send = true; 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; @@ -303,7 +290,6 @@ 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; encoder_value = (encoder_value + (clockwise ? 1 : -1)) % 64; - queue_for_send = true; if (index == 0) { if (layer == 0){ uint16_t mapped_code = 0; @@ -376,7 +362,6 @@ void matrix_init_kb(void) #endif // VIA_ENABLE rtcGetTime(&RTCD1, &last_timespec); - queue_for_send = true; backlight_init_ports(); matrix_init_user(); } @@ -388,22 +373,14 @@ void housekeeping_task_kb(void) { if (minutes_since_midnight != last_minute){ last_minute = minutes_since_midnight; - if(!oled_sleeping){ - queue_for_send = true; - } } -#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((oled_mode == OLED_OFF) && is_oled_on()){ + oled_off(); } - if (timer_elapsed(last_flush) > ScreenOffInterval && !oled_sleeping) { - send_command(DISPLAYOFF); /* 0xAE */ - oled_sleeping = true; + if((oled_mode != OLED_OFF) && !is_oled_on()){ + oled_on(); } -#endif } // -- cgit v1.2.3