summaryrefslogtreecommitdiff
path: root/code_refs/sharpmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'code_refs/sharpmem.h')
-rw-r--r--code_refs/sharpmem.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/code_refs/sharpmem.h b/code_refs/sharpmem.h
new file mode 100644
index 0000000..288a18b
--- /dev/null
+++ b/code_refs/sharpmem.h
@@ -0,0 +1,36 @@
+#include <stdbool.h>
+
+#ifndef _STM32_SHARPMEM
+#define _STM32_SHARPMEM
+
+#define SHARPMEM_BIT_WRITECMD (0x01) // 0x80 in LSB format
+#define SHARPMEM_BIT_VCOM (0x02) // 0x40 in LSB format
+#define SHARPMEM_BIT_CLEAR (0x04) // 0x20 in LSB format
+
+typedef struct
+{
+ uint16_t width;
+ uint16_t height;
+ uint16_t cs_pin;
+ GPIO_TypeDef *cs_pin_bank;
+ uint16_t lcdmode_pin;
+ GPIO_TypeDef *lcdmode_pin_bank;
+ SPI_HandleTypeDef *spidev;
+
+ uint8_t *_buffer;
+ uint8_t _sharpmem_vcom;
+} SharpMemDisplay_t;
+
+void SHARPMEM_draw_pixel(SharpMemDisplay_t *display, uint16_t x, uint16_t y, bool white);
+void SHARPMEM_draw_line(SharpMemDisplay_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, bool white, uint8_t thickness)
+void SHARPMEM_draw_circle(SharpMemDisplay_t *display, uint16_t x, uint16_t y, uint8_t r, bool filled);
+void SHARPMEM_draw_rect(SharpMemDisplay_t *display, uint16_t x1, uint16_t y1, uint16_t x2, uint16_t y2, bool filled);
+uint8_t SHARPMEM_get_pixel(SharpMemDisplay_t *display, uint16_t x, uint16_t y);
+void SHARPMEM_clear_display(SharpMemDisplay_t *display);
+void SHARPMEM_refresh_display(SharpMemDisplay_t *display);
+void SHARPMEM_clear_display_buffer(SharpMemDisplay_t *display);
+uint8_t *SHARPMEM_get_buffer(SharpMemDisplay_t *display);
+
+void SHARPMEM_TOGGLEVCOM(SharpMemDisplay_t *display);
+
+#endif \ No newline at end of file