summaryrefslogtreecommitdiff
path: root/keyboards/crkbd/ssd1306.c
diff options
context:
space:
mode:
authorAlex Ong <the.onga@gmail.com>2019-01-04 19:39:14 +1100
committerAlex Ong <the.onga@gmail.com>2019-01-04 19:39:14 +1100
commit47c91fc7f75ae0a477e55b687aa0fc30da0a283c (patch)
tree65ad39452748ff2e6d4a83ce54ede6ca22c9ada9 /keyboards/crkbd/ssd1306.c
parentac9b88e8ccbbf38762871504cd827ff0d941c426 (diff)
parent563ce3f225d981ce460c12ca5130dfe47af41df0 (diff)
downloadqmk_firmware-47c91fc7f75ae0a477e55b687aa0fc30da0a283c.tar.gz
qmk_firmware-47c91fc7f75ae0a477e55b687aa0fc30da0a283c.zip
Merge branch 'master' of https://github.com/qmk/qmk_firmware
Diffstat (limited to 'keyboards/crkbd/ssd1306.c')
-rw-r--r--keyboards/crkbd/ssd1306.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/keyboards/crkbd/ssd1306.c b/keyboards/crkbd/ssd1306.c
index d079001199..4330c8497d 100644
--- a/keyboards/crkbd/ssd1306.c
+++ b/keyboards/crkbd/ssd1306.c
@@ -4,7 +4,6 @@
#include "i2c.h"
#include <string.h>
#include "print.h"
-#include "glcdfont.c"
#ifdef ADAFRUIT_BLE_ENABLE
#include "adafruit_ble.h"
#endif
@@ -14,6 +13,8 @@
#include "sendchar.h"
#include "timer.h"
+static const unsigned char font[] PROGMEM;
+
// Set this to 1 to help diagnose early startup problems
// when testing power-on with ble. Turn it off otherwise,
// as the latency of printing most of the debug info messes
@@ -23,12 +24,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) {
@@ -123,6 +129,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);
@@ -319,12 +326,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