commit c40c373f0cca4673543969a2e4938e786ac72cd0
parent e00dc65535c2903beb2ded720695507c7b3a4e54
Author: Lukas F. Hartmann <lukas@mntre.com>
Date: Sun, 21 Nov 2021 17:52:17 +0100
keyboard: bitmap command wip
Diffstat:
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/reform2-keyboard-fw/Keyboard.c b/reform2-keyboard-fw/Keyboard.c
@@ -42,7 +42,7 @@
#include <avr/sleep.h>
#define KBD_FW_REV "R1 20210927"
-//#define KBD_VARIANT_STANDALONE
+#define KBD_VARIANT_STANDALONE
#define KBD_VARIANT_QWERTY_US
//#define KBD_VARIANT_NEO2
@@ -1064,4 +1064,7 @@ void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDI
// RPRT: Report power stats to UART
remote_report_voltages();
}
+ else if (data[0]=='B' && data[1]=='M' && data[2]=='A' && data[3]=='P') {
+ matrix_render_direct(data+4);
+ }
}
diff --git a/reform2-keyboard-fw/ssd1306.c b/reform2-keyboard-fw/ssd1306.c
@@ -299,6 +299,21 @@ done:
i2c_master_stop();
}
+void matrix_render_direct(uint8_t* bitmap) {
+ gfx_on();
+
+ // Move to the home position
+ send_cmd3(PageAddr, 0, MatrixRows - 1);
+ send_cmd3(ColumnAddr, 0, (MatrixCols * FontWidth) - 1);
+
+ for (uint16_t i=0; i<(128/8)*32; i++) {
+ i2c_master_write(bitmap[i]);
+ }
+
+done:
+ i2c_master_stop();
+}
+
void gfx_flush(void) {
matrix_render(&display);
}