Skip to content

Instantly share code, notes, and snippets.

@pdp7
Created September 18, 2018 23:51
Show Gist options
  • Save pdp7/61ba1e03769c0dfeb75fedc1227284d4 to your computer and use it in GitHub Desktop.
Save pdp7/61ba1e03769c0dfeb75fedc1227284d4 to your computer and use it in GitHub Desktop.
partial update by Michael Welling for micropython on OHS18 badge
change the LUT settings
Michael WellingSep-17 10:29 PM
def set_update_partial(self):
#LUTDefault_partial
self.send_command(0x32)
self.send_data(0x18)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x0F)
self.send_data(0x01)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
self.send_data(0x00)
#PowerOn
self.send_command(0x22)
self.send_data(0xc0)
self.send_command(0x20)
self.wait_until_idle()
Michael WellingSep-17 10:30 PM
>>> epd.set_update_partial()
>>> epd.display_string_at(fb, 0, 0, "Hello World!", font20, gxgde0213b1.COLORED)
>>> epd.clear_frame(fb)
>>> epd.display_string_at(fb, 0, 0, "Hello World!", font20, gxgde0213b1.COLORED)
>>> epd.display_frame(fb)
Michael WellingSep-17 10:30 PM
you can see a slight ghost of the previous frame
Michael WellingSep-17 10:30 PM
but not flashing
Michael WellingSep-17 10:34 PM
might be might something because not the updates are offset
Michael WellingSep-17 10:34 PM
*missing
oshparkSep-17 10:39 PM
@Michael Welling very nice, is there a commit I can pull in?
Michael WellingSep-17 10:44 PM
not yet
Michael WellingSep-17 10:44 PM
I can do a pull request when I do
oshpark
@pdp7
Copy link
Author

pdp7 commented Sep 19, 2018

--0000000000002db27c05761bee74
Content-Type: text/plain; charset="UTF-8"

michael@qwertyuiop:~/projects/ohs2018-badge-firmware/micropython/ports/esp32$
git diff
diff --git a/ports/esp32/modules/_boot.py b/ports/esp32/modules/_boot.py
index bf40ea3a..24a55b07 100644
--- a/ports/esp32/modules/_boot.py
+++ b/ports/esp32/modules/_boot.py
@@ -1,5 +1,10 @@
 import gc
 import uos
+from machine import Pin
+import gxgde0213b1
+import font12
+import font20
+
 from flashbdev import bdev

 try:
@@ -10,3 +15,16 @@ except OSError:
     vfs = inisetup.setup()

 gc.collect()
+
+reset = Pin(16, Pin.OUT)
+dc = Pin(25, Pin.OUT)
+busy = Pin(4, Pin.IN)
+cs = Pin(5, Pin.OUT)
+epd = gxgde0213b1.EPD(reset, dc, busy, cs)
+epd.init()
+fb_size = int(epd.width * epd.height / 8)
+fb = bytearray(fb_size)
+epd.clear_frame(fb)
+epd.set_rotate(gxgde0213b1.ROTATE_90)
+epd.display_string_at(fb, 0, 0, "Hello World! - OHS", font20,
gxgde0213b1.COLORED)
+epd.display_frame(fb)

@pdp7
Copy link
Author

pdp7 commented Sep 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment