Change the image path back after merging

pull/10/head
Ivan Belokobylskiy 2020-02-11 10:00:23 +03:00
rodzic 3eb11c5245
commit 0182cdcc3f
1 zmienionych plików z 31 dodań i 31 usunięć

Wyświetl plik

@ -4,11 +4,11 @@ ST7789 Driver for MicroPython
Overview
--------
This is a driver for MicroPython to handle cheap displays
based on ST7789 chip.
This is a driver for MicroPython to handle cheap displays
based on ST7789 chip.
<p align="center">
<img src="https://raw.githubusercontent.com/dvarrel/st7789_mpy/master/docs/ST7789.jpg" alt="ST7789 display photo"/>
<img src="https://raw.githubusercontent.com/devbis/st7789_mpy/master/docs/ST7789.jpg" alt="ST7789 display photo"/>
</p>
It supports both 240x240 and 135x240 variants of displays.
@ -22,7 +22,7 @@ Building instruction
---------------------
Prepare build tools as described in the manual.
You should follow the instruction for building MicroPython and
You should follow the instruction for building MicroPython and
ensure that you can build the firmware without this display module.
Clone this module alongside the MPY sources:
@ -33,21 +33,21 @@ Go to MicroPython ports directory and for ESP8266 run:
$ cd micropython/ports/esp8266
for ESP32:
for ESP32:
$ cd micropython/ports/esp32
And then compile the module with specified USER_C_MODULES dir
$ make USER_C_MODULES=../../../st7789_mpy/ all
If you have other user modules, copy the st7789_driver/st7789 to
If you have other user modules, copy the st7789_driver/st7789 to
the user modules directory
Upload the resulting firmware to your MCU as usual with esptool.py
(See
[MicroPython docs](http://docs.micropython.org/en/latest/esp8266/tutorial/intro.html#deploying-the-firmware)
Upload the resulting firmware to your MCU as usual with esptool.py
(See
[MicroPython docs](http://docs.micropython.org/en/latest/esp8266/tutorial/intro.html#deploying-the-firmware)
for more info)
$ make deploy
@ -57,12 +57,12 @@ Working examples
This module was tested on ESP32 and ESP8266 MCUs.
You have to provide `machine.SPI` object and at least two pins for RESET and
DC pins on the screen for the display object.
You have to provide `machine.SPI` object and at least two pins for RESET and
DC pins on the screen for the display object.
# ESP 8266
import machine
import st7789
spi = machine.SPI(1, baudrate=40000000, polarity=1)
@ -72,7 +72,7 @@ DC pins on the screen for the display object.
For ESP32 modules you have to provide specific pins for SPI.
Unfortunately, I was unable to run this display on SPI(1) interface.
For machine.SPI(2) == VSPI you have to use
For machine.SPI(2) == VSPI you have to use
- CLK: Pin(18)
- MOSI: Pin(23)
@ -104,27 +104,27 @@ This driver supports only 16bit colors in RGB565 notation.
- `ST7789.pixel(x, y, color)`
Set the specified pixel to the given color.
- `ST7789.line(x0, y0, x1, y1, color)`
Draws a single line with the provided `color` from (`x0`, `y0`) to
Draws a single line with the provided `color` from (`x0`, `y0`) to
(`x1`, `y1`).
- `ST7789.hline(x, y, length, color)`
Draws a single horizontal line with the provided `color` and `length`
in pixels. Along with `vline`, this is a fast version with reduced
Draws a single horizontal line with the provided `color` and `length`
in pixels. Along with `vline`, this is a fast version with reduced
number of SPI calls.
- `ST7789.vline(x, y, length, color)`
Draws a single horizontal line with the provided `color` and `length`
Draws a single horizontal line with the provided `color` and `length`
in pixels.
- `ST7789.rect(x, y, width, height, color)`
Draws a rectangle from (`x`, `y`) with corresponding dimensions
- `ST7789.fill_rect(x, y, width, height, color)`
Fill a rectangle starting from (`x`, `y`) coordinates
@ -144,22 +144,22 @@ Helper functions
- `color565(r, g, b)`
Pack a color into 2-bytes rgb565 format
- `map_bitarray_to_rgb565(bitarray, buffer, width, color=WHITE, bg_color=BLACK)`
Convert a bitarray to the rgb565 color buffer which is suitable for blitting.
Bit 1 in bitarray is a pixel with `color` and 0 - with `bg_color`.
This is a helper with a good performance to print text with a high
resolution font. You can use an awesome tool
This is a helper with a good performance to print text with a high
resolution font. You can use an awesome tool
https://github.com/peterhinch/micropython-font-to-py
to generate a bitmap fonts from .ttf and use them as a frozen bytecode from
to generate a bitmap fonts from .ttf and use them as a frozen bytecode from
the ROM memory.
Performance
-----------
For the comparison I used an excellent library for Arduino
For the comparison I used an excellent library for Arduino
that can handle this screen.
https://github.com/ananevilya/Arduino-ST7789-Library/
@ -186,7 +186,7 @@ Troubleshooting
#### Overflow of iram1_0_seg
When building a firmware for esp8266 you can see this failure message from
When building a firmware for esp8266 you can see this failure message from
the linker:
LINK build/firmware.elf
@ -194,7 +194,7 @@ the linker:
xtensa-lx106-elf-ld: region `iram1_0_seg' overflowed by 292 bytes
Makefile:192: recipe for target 'build/firmware.elf' failed
To fix this issue, you have to put st7789 module to irom0 section.
To fix this issue, you have to put st7789 module to irom0 section.
Edit `esp8266_common.ld` file in the `ports/esp8266` dir and add a line
*st7789/*.o(.literal* .text*)
@ -205,6 +205,6 @@ in the `.irom0.text : ALIGN(4)` section
#### Unsupported dimensions
This driver supports only 240x240 and 135x240 pixel displays.
If you have a display with an unsupported resolution, you can pass
`xstart` and `ystart` parameters to the display constructor to set the
If you have a display with an unsupported resolution, you can pass
`xstart` and `ystart` parameters to the display constructor to set the
required offsets.