X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=keyboards%2Fhelix%2Fssd1306.c;h=dd3290ba0cc813ebb7b65208191877cb5a5f59ee;hb=05990c9bda0ddbc0e622f12e88bec271958c864e;hp=b13060ef733b90ea2315e2f74d59b43725be2bac;hpb=1ff7473ce4fa53f1ea28edfa16ae68ea5cc74d47;p=qmk_firmware.git diff --git a/keyboards/helix/ssd1306.c b/keyboards/helix/ssd1306.c index b13060ef7..dd3290ba0 100644 --- a/keyboards/helix/ssd1306.c +++ b/keyboards/helix/ssd1306.c @@ -1,3 +1,4 @@ + #ifdef SSD1306OLED #include "ssd1306.h" @@ -27,12 +28,17 @@ //static uint16_t last_battery_update; //static uint32_t vbat; //#define BatteryUpdateInterval 10000 /* milliseconds */ -#define ScreenOffInterval 300000 /* milliseconds */ + +// 'last_flush' is declared as uint16_t, +// so this must be less than 65535 +#define ScreenOffInterval 60000 /* milliseconds */ #if DEBUG_TO_SCREEN static uint8_t displaying; #endif static uint16_t last_flush; +static bool force_dirty = true; + // Write command sequence. // Returns true on success. static inline bool _send_cmd1(uint8_t cmd) { @@ -127,6 +133,7 @@ static int8_t capture_sendchar(uint8_t c) { bool iota_gfx_init(bool rotate) { bool success = false; + i2c_master_init(); send_cmd1(DisplayOff); send_cmd2(SetDisplayClockDiv, 0x80); send_cmd2(SetMultiPlex, DisplayHeight - 1); @@ -317,12 +324,19 @@ void iota_gfx_task_user(void) { void iota_gfx_task(void) { iota_gfx_task_user(); - if (display.dirty) { + if (display.dirty|| force_dirty) { iota_gfx_flush(); + force_dirty = false; } if (timer_elapsed(last_flush) > ScreenOffInterval) { iota_gfx_off(); } } + +bool process_record_gfx(uint16_t keycode, keyrecord_t *record) { + force_dirty = true; + return true; +} + #endif