display = st7789.ST7789( SPI(1, baudrate=40000000, phase=0, polarity=1), 240, 240, reset=machine.Pin(5, machine.Pin.OUT), dc=machine.Pin(2, machine.Pin.OUT), )
(self, spi, width, height, reset, dc, cs=None)
| 52 | |
| 53 | class ST7789_base: |
| 54 | def __init__(self, spi, width, height, reset, dc, cs=None): |
| 55 | """ |
| 56 | display = st7789.ST7789( |
| 57 | SPI(1, baudrate=40000000, phase=0, polarity=1), |
| 58 | 240, 240, |
| 59 | reset=machine.Pin(5, machine.Pin.OUT), |
| 60 | dc=machine.Pin(2, machine.Pin.OUT), |
| 61 | ) |
| 62 | |
| 63 | """ |
| 64 | self.width = width |
| 65 | self.height = height |
| 66 | self.spi = spi |
| 67 | self.reset = reset |
| 68 | self.dc = dc |
| 69 | self.cs = cs |
| 70 | |
| 71 | # Always allocate a tiny 8x8 framebuffer in RGB565 for fast |
| 72 | # single chars plotting. This is useful in order to draw text |
| 73 | # using the framebuffer 8x8 font inside micropython and using |
| 74 | # a single SPI write for each whole character. |
| 75 | self.charfb_data = bytearray(8*8*2) |
| 76 | self.charfb = framebuf.FrameBuffer(self.charfb_data,8,8,framebuf.RGB565) |
| 77 | |
| 78 | # That's the color format our API takes. We take r, g, b, translate |
| 79 | # to 16 bit value and pack it as as two bytes. |
nothing calls this directly
no outgoing calls
no test coverage detected