Hi
@pythoncoder thank you very much for your support. It works!
It took me sometime because I’m not comfortable enough with python class definition (
self and
super() are still a bit obscure, but I learn!). I had to change some minor things in this DummyDisplay class and this took me time and tries but now I can use bigger fonts.
Here is my code:
Code: Select all
import framebuf
import epaper2in13b
from machine import Pin, SPI
from writer import Writer
import freesans20
sck = Pin(13); mosi = Pin(14); cs = Pin(15); busy = Pin(25); rst = Pin(26); dc = Pin(27); miso = Pin(12)
spi = SPI(baudrate=100000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
e = epaper2in13b.EPD(spi, cs, dc, rst, busy)
e.init()
class DummyDisplay(framebuf.FrameBuffer):
def __init__(self, buffer, width, height, format):
self.height = height
self.width = width
self.buffer = buffer
self.format = format
super().__init__(buffer, width, height, format)
w=104; h=212
buf_black = bytearray(w * h // 8)
buf_red = bytearray(w * h // 8)
black_red = 0 # will be black on buf_black, red on buf_red
white = 1
d_b = DummyDisplay(buf_black, w, h, framebuf.MONO_HLSB)
d_r = DummyDisplay(buf_red, w, h, framebuf.MONO_HLSB)
d_b.fill(white)
d_r.fill(white)
wri_b = Writer(d_b, freesans20, False)
Writer.set_textpos(d_b, 0, 0) # verbose = False to suppress console output
wri_b.printstring('Sunday\n', True)
wri_b.printstring('28/04/2019\n',True)
wri_b.printstring('14:30', True)
wri_r = Writer(d_r, freesans20, False)
Writer.set_textpos(d_r, 100, 0)
wri_r.printstring('uPython\n', True)
wri_r.printstring(' :-)', True)
print('Sending to display')
e.display_frame(buf_black, buf_red)
print('Done!.......')
e.sleep() # recommended by manufacturer to avoid damage to display
print('E-paper sleeping!...')
print('END')
Next step will be to use your font-to-py to generate some fonts!
Here is a photo of the result
Thanks again I really appreciate
--
Jmp0