Coder Social home page Coder Social logo

devbis / st7789_mpy Goto Github PK

View Code? Open in Web Editor NEW
186.0 14.0 42.0 119 KB

Fast pure-C driver for MicroPython that can handle display modules on ST7789 chip

License: MIT License

Makefile 0.80% C 99.20%
esp8266 st7789 micropython-driver esp32 micropython

st7789_mpy's Introduction

ST7789 Driver for MicroPython

Overview

This is a driver for MicroPython to handle cheap displays based on ST7789 chip.

ST7789 display photo

It supports both 240x240 and 135x240 variants of displays.

It is written in pure C, so you have to build firmware by yourself. ESP8266, ESP32, and STM32 ports are supported for now.

Building instruction

Prepare build tools as described in the manual. 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:

git clone https://github.com/devbis/st7789_mpy.git

Go to MicroPython ports directory and for ESP8266 run:

cd micropython/ports/esp8266

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 the user modules directory

Upload the resulting firmware to your MCU as usual with esptool.py (See MicroPython docs for more info)

make deploy

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.

# ESP 8266

import machine
import st7789
spi = machine.SPI(1, baudrate=40000000, polarity=1)
display = st7789.ST7789(spi, 240, 240, reset=machine.Pin(5, machine.Pin.OUT), dc=machine.Pin(4, machine.Pin.OUT))
display.init()

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

  • CLK: Pin(18)
  • MOSI: Pin(23)

Other SPI pins are not used.

# ESP32

import machine
import st7789
spi = machine.SPI(2, baudrate=40000000, polarity=1, sck=machine.Pin(18), mosi=machine.Pin(23))
display = st7789.ST7789(spi, 240, 240, reset=machine.Pin(4, machine.Pin.OUT), dc=machine.Pin(2, machine.Pin.OUT))
display.init()

I couldn't run the display on an SPI with baudrate higher than 40MHZ

Also, the driver was tested on STM32 board:

# STM32

import machine
import st7789
spi = machine.SPI(2, baudrate=12000000, polarity=1)
display = st7789.ST7789(spi, 135, 240, reset=machine.Pin('B3', machine.Pin.OUT), dc=machine.Pin('B6', machine.Pin.OUT))
display.init()

Methods

This driver supports only 16bit colors in RGB565 notation.

  • ST7789.fill(color)

    Fill the entire display with the specified color.

  • 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 (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 number of SPI calls.

  • ST7789.vline(x, y, length, color)

    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

  • ST7789.blit_buffer(buffer, x, y, width, height)

    Copy bytes() or bytearray() content to the screen internal memory. Note: every color requires 2 bytes in the array

Also, the module exposes predefined colors: BLACK, BLUE, RED, GREEN, CYAN, MAGENTA, YELLOW, and WHITE

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 https://github.com/peterhinch/micropython-font-to-py 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 that can handle this screen.

https://github.com/ananevilya/Arduino-ST7789-Library/

Also, I used my slow driver for this screen, written in pure python.

https://github.com/devbis/st7789py_mpy/

I used these modules to draw a line from 0,0 to 239,239 The table represents the time in milliseconds for each case

Arduino-ST7789 st7789py_mpy st7789_mpy
ESP8266 26 450 12
ESP32 23 450 47

As you can see, the ESP32 module draws a line 4 times slower than the older ESP8266 module.

Troubleshooting

Overflow of iram1_0_seg

When building a firmware for esp8266 you can see this failure message from the linker:

LINK build/firmware.elf
xtensa-lx106-elf-ld: build/firmware.elf section `.text' will not fit in region `iram1_0_seg'
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. Edit esp8266_common.ld file in the ports/esp8266 dir and add a line

*st7789/*.o(.literal* .text*)

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 required offsets.

st7789_mpy's People

Contributors

bwidawsk avatar devbis avatar zavibis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

st7789_mpy's Issues

module Timer

hello,
this driver for my ttgo esp32 led display works very well, thanks a lot.

But i can't use the Timer module, looks bizarre ?

i try the different exemples in micropython.org like :
from machine import Timer tim = Timer(-1) tim.init(period=5000, mode=Timer.ONE_SHOT, callback=lambda t:print(1)) tim.init(period=2000, mode=Timer.PERIODIC, callback=lambda t:print(2))

have you got this malfunction ?

thanks you

Driver not working correctly with display 135 x 240 pixels

I want to use the driver with this board: https://github.com/Xinyuan-LilyGO/TTGO-T-Display
The display is 1.14 inch and has 135 x 240 pixels.
I have to use software SPI and a dummy pin (25) for MISO.

from machine import Pin, SPI
import st7789
spi = SPI(-1, baudrate=40000000, polarity=1, phase=0, sck=Pin(18), mosi=Pin(19), miso=Pin(25))
display = st7789.ST7789(spi, 135, 240, reset=Pin(23, Pin.OUT), dc=Pin(16, Pin.OUT), cs=Pin(5, Pin.OUT))
display.init()
tftbl = Pin(4, Pin.OUT)
tftbl.on()
display.fill(st7789.WHITE)

The display is switched on but the white color is not written on the complete display.
The example code for the board uses an Arduino driver (https://github.com/Bodmer/TFT_eSPI) which works perfectly.
It seems the driver needs an offset in x and y direction (CGRAM_OFFSET).

st7789 not included

Bonjour ,
I try to include st7789 to ESP32 micropython 1.14.
first without st7789 the build is good.
then make with st7789 is good but 'import st7789' is KO.
no st7789 string in the report.
mistake or missing ?
Thanks for help and
Regards
Linux ubuntu 16.4

compile issue - ESP IDF does not match the supported version

Hello,
did not get the module compiled.
Hardware: TTGO ESP32 with 1.4" Display

  1. git clone https://github.com/micropython/micropython
  2. git clone https://github.com/devbis/st7789_mpy.git
  3. git clone https://github.com/espressif/esp-idf.git
  4. cd esp-idf && git submodule update --init --recursive && sudo ./install.sh && cd ..
  5. install xtensa-esp32-elf-gcc
  6. cd micropython/ports/esp32
  7. make USER_C_MODULES=../../../st7789_mpy/ all

$ make USER_C_MODULES=../../../st7789_mpy/ all
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Including User C Module from ../../../st7789_mpy//st7789
** WARNING **
The git hash of ESP IDF does not match the supported version
The build may complete and the firmware may work but it is not guaranteed
ESP IDF path: /home/developer/Downloads/esp-idf
Current git hash: 8bc19ba893e5544d571a753d82b44a84799b94b1
Supported git hash (v3.3): 9e70825d1e1cbf7988cf36981774300066580ea7
Supported git hash (v4.0) (experimental): 4c81978a3e2220674a432a588292a4c860eef27b
GEN build-GENERIC/sdkconfig.h
Traceback (most recent call last):
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/confgen.py", line 31, in
from future.utils import iteritems
ModuleNotFoundError: No module named 'future'
make: *** [Makefile:401: build-GENERIC/sdkconfig.h] Error 1

What did I wrong ?


when run install.sh in user context.... got this

$ make v=1 USER_C_MODULES=../../../st7789_mpy/ all
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Including User C Module from ../../../st7789_mpy//st7789
** WARNING **
The git hash of ESP IDF does not match the supported version
The build may complete and the firmware may work but it is not guaranteed
ESP IDF path: /home/developer/Downloads/esp-idf
Current git hash: 8bc19ba893e5544d571a753d82b44a84799b94b1
Supported git hash (v3.3): 9e70825d1e1cbf7988cf36981774300066580ea7
Supported git hash (v4.0) (experimental): 4c81978a3e2220674a432a588292a4c860eef27b
GEN build-GENERIC/sdkconfig.h
/home/developer/Downloads/esp-idf/Kconfig:14: warning: IDF_ENV_FPGA has 'option env="IDF_ENV_FPGA"', but the environment variable IDF_ENV_FPGA is not set
Traceback (most recent call last):
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/confgen.py", line 641, in
main()
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/confgen.py", line 261, in main
config = kconfiglib.Kconfig(args.kconfig)
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/kconfiglib.py", line 947, in init
self._init(filename, warn, warn_to_stderr, encoding)
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/kconfiglib.py", line 1085, in _init
self._parse_block(None, self.top_node, self.top_node).next = None
File "/home/developer/Downloads/esp-idf/tools/kconfig_new/kconfiglib.py", line 2970, in _parse_block
raise KconfigError(
kconfiglib.KconfigError: /home/developer/Downloads/esp-idf/Kconfig:173: '$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE' not found (in 'source "$COMPONENT_KCONFIGS_PROJBUILD_SOURCE_FILE"'). Check that environment variables are set correctly (e.g. $srctree, which is unset or blank). Also note that unset environment variables expand to the empty string.
make: *** [Makefile:401: build-GENERIC/sdkconfig.h] Error 1

LVGL/Squareline compatibility?

Is this display driver compatible with LVGL/Squareline GUI creation tools? If so how to integrate both in one firmware?

Can't compile in latest ESP-IDF

The 4.3 release of ESP-IDF won't compile the c modules into the micropython firmware as has some error using 'make' 'all' that it can't find the 'file' st7789_mpy, when this is actually a folder and not a file.

Can't build on ESP8266

The README contains performance measurements for the ESP8266 and also states how to build MicroPython with this module for the ESP8266. However, I can't get the current version of MicroPython to include this module when building.

I'm using the "recommended" way to build for ESP8266, which is using docker:

~/Downloads/micropython/ports/esp8266
> docker run --rm -v $HOME:$HOME -u (id -u) -w $PWD larsks/esp-open-sdk make USER_C_MODULES=../../../st7789_mpy/st7789/micropython.cmake all

This builds fine but produces exactly the same image as without the USER_C_MODULES argument. When flashing the produced image, import st7789 does not work.

When looking over the Makefile in micropython/ports/esp8266, I noticed that neither USER_C_MODULES nor cmake is referenced at all. I also couldn't find anything else on how to include external modules in an ESP8266 build.

Am I missing something here?

map_bitarray_to_rgb565 use

Hi there fantastic work on the driver, it's been really good to use, with the map_bitarray_to_rgb565 I'm not wanting to store the raw RGB565 binary in my flash it'd be good to store just the bitarray and use your helper to convert it on the fly, I can't seem to get this going though. I've tried converting a PNG file to bytearray and then used this helper but it always comes out garbled, are you able to write up an example of it's use, it'd be greatly appreciated.

invalid pin in library

Traceback (most recent call last):
File "", line 11, in
File "st7789.py", line 46, in init
ValueError: invalid pin

compilation error

Hi,
after I performed:
make USER_C_MODULES=../../../st7789_mpy/ all
The building start to work but in the middle of process I get that error:

build-GENERIC/frozen_content.c:71:5: error: redeclaration of enumerator 'MP_QSTR_color'
MP_QSTR_color,
^
In file included from ../../py/obj.h:31:0,
from ../../py/objint.h:30,
from build-GENERIC/frozen_content.c:15:
build-GENERIC/genhdr/qstrdefs.generated.h:512:6: note: previous definition of 'MP_QSTR_color' was here
QDEF(MP_QSTR_color, (const byte*)"\xd8\x06\x05" "color")
^
../../py/qstr.h:41:23: note: in definition of macro 'QDEF'
#define QDEF(id, str) id,
^
make: *** [build-GENERIC/build-GENERIC/frozen_content.o] Error 1

Thanks

after increased the module, unable to connect to WebREPL.

I don't know why, with out this module, everything seems work ok.
hardware:TTGO Camera Plus
software:with a ov2640 module.

import webrepl_setup

to set a webrepl
and I can see that the password in the webrepl_cfg.py is the same what I typed.

but it will always said that.

Welcome to MicroPython!                                                                                                                               
Password:                                                                                                                                             
Access denied                                                                                                                                         
Disconnected

Building issue: "region `iram1_0_seg' overflowed"

Hi

I have working dev toolchain for Esp8266 configured in Docker. When I add your module:

`
git clone https://github.com/devbis/st7789_mpy.git /st7789_mpy

make USER_C_MODULES=/st7789_mpy all
`

I get compilation error "region `iram1_0_seg' overflowed by 1368 bytes":

`
...
CC /st7789_mpy/st7789/st7789.c
CC ../../lib/axtls/ssl/asn1.c
CC ../../lib/axtls/ssl/loader.c
CC ../../lib/axtls/ssl/tls1.c
CC ../../lib/axtls/ssl/tls1_svr.c
CC ../../lib/axtls/ssl/tls1_clnt.c
CC ../../lib/axtls/ssl/x509.c
CC ../../lib/axtls/crypto/aes.c
CC ../../lib/axtls/crypto/bigint.c
CC ../../lib/axtls/crypto/crypto_misc.c
CC ../../lib/axtls/crypto/hmac.c
CC ../../lib/axtls/crypto/md5.c
CC ../../lib/axtls/crypto/rsa.c
CC ../../lib/axtls/crypto/sha1.c
CC ../../extmod/modbtree.c
CC ../../lib/berkeley-db-1.xx/btree/bt_close.c
CC ../../lib/berkeley-db-1.xx/btree/bt_conv.c
CC ../../lib/berkeley-db-1.xx/btree/bt_debug.c
CC ../../lib/berkeley-db-1.xx/btree/bt_delete.c
CC ../../lib/berkeley-db-1.xx/btree/bt_get.c
CC ../../lib/berkeley-db-1.xx/btree/bt_open.c
CC ../../lib/berkeley-db-1.xx/btree/bt_overflow.c
CC ../../lib/berkeley-db-1.xx/btree/bt_page.c
CC ../../lib/berkeley-db-1.xx/btree/bt_put.c
CC ../../lib/berkeley-db-1.xx/btree/bt_search.c
CC ../../lib/berkeley-db-1.xx/btree/bt_seq.c
CC ../../lib/berkeley-db-1.xx/btree/bt_split.c
CC ../../lib/berkeley-db-1.xx/btree/bt_utils.c
CC ../../lib/berkeley-db-1.xx/mpool/mpool.c
AS gchelper.s
CC ../../extmod/modlwip.c
CC ../../extmod/modonewire.c
CC ../../lib/libc/string0.c
CC ../../lib/libm/math.c
CC ../../lib/libm/fmodf.c
CC ../../lib/libm/nearbyintf.c
CC ../../lib/libm/ef_sqrt.c
CC ../../lib/libm/kf_rem_pio2.c
CC ../../lib/libm/kf_sin.c
CC ../../lib/libm/kf_cos.c
CC ../../lib/libm/kf_tan.c
CC ../../lib/libm/ef_rem_pio2.c
CC ../../lib/libm/sf_sin.c
CC ../../lib/libm/sf_cos.c
CC ../../lib/libm/sf_tan.c
CC ../../lib/libm/sf_frexp.c
CC ../../lib/libm/sf_modf.c
CC ../../lib/libm/sf_ldexp.c
CC ../../lib/libm/asinfacosf.c
CC ../../lib/libm/atanf.c
CC ../../lib/libm/atan2f.c
CC ../../lib/mp-readline/readline.c
CC ../../lib/netutils/netutils.c
CC ../../lib/timeutils/timeutils.c
CC ../../lib/utils/pyexec.c
CC ../../lib/utils/interrupt_char.c
CC ../../lib/utils/sys_stdio_mphal.c
CC ../../lib/oofatfs/ff.c
CC ../../lib/oofatfs/ffunicode.c
CC ../../drivers/bus/softspi.c
CC ../../drivers/dht/dht.c
LINK build/firmware.elf

xtensa-lx106-elf-ld: build/firmware.elf section .text' will not fit in region iram1_0_seg'

xtensa-lx106-elf-ld: region `iram1_0_seg' overflowed by 1368 bytes

make: *** [build/firmware.elf] Error 1
`

Have you ever seen similar problem before?

Including bin files in

I've tried so many times, but I still can't compile the right file(maybe something wrong with the network). Could someone
share the bin file? thanks. (esp8266 st7789)

Issues building with micropython 1.12

I'm trying to build micropython including your driver (thank you very much for the effort in developing it.), but I've stumbled across the following error while compiling, and I'm not sure how to go forward as I'm not very familiar with firmware building. I have followed the provided instructions and I currently am able to build a 'clean' micropython firmware.
When I try to include your driver, and run the
make USER_C_MODULES=../../../st7789_mpy/ all
command (my folder structure is matching the one explained in your tutorial), I am presented with the following error:

[...]
CC ../../extmod/uos_dupterm.c
CC ../../lib/embed/abort_.c
CC ../../lib/utils/printf.c
CC build-GENERIC/frozen_content.c
build-GENERIC/frozen_content.c:71:5: error: redeclaration of enumerator 'MP_QSTR_color'
     MP_QSTR_color,
     ^
In file included from ../../py/obj.h:33:0,
                 from ../../py/objint.h:30,
                 from build-GENERIC/frozen_content.c:15:
build-GENERIC/genhdr/qstrdefs.generated.h:509:6: note: previous definition of 'MP_QSTR_color' was here
 QDEF(MP_QSTR_color, (const byte*)"\xd8\x06\x05" "color")
      ^
../../py/qstr.h:41:23: note: in definition of macro 'QDEF'
 #define QDEF(id, str) id,
                       ^
../../py/mkrules.mk:63: recipe for target 'build-GENERIC/build-GENERIC/frozen_content.o' failed
make: *** [build-GENERIC/build-GENERIC/frozen_content.o] Error 1

I would appreciate any help on how to solve this.

'.text' will not fit in region iram1_0_seg

Using the instructions in README.md and using the docker container build instructions (docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk ...), I'm able to build micropython without your ST7789 module. When I include the module:

cd ports/esp8266
docker run --rm -v $HOME:$HOME -u $UID -w $PWD larsks/esp-open-sdk make V=1 USER_C_MODULES=/Users/john/p3.9.0a4/st7789_mpy/ all

I get the 'will not fit' error. Is there a way to work around this by excluding other modules?
Thanks!

error compile module

hello,
i try to compile your module with esp32, and this is the reported error:
`dam@dvarrel-pc:~/esp/micropython/ports/esp32$ make USER_C_MODULES=../../../st7789_mpy/ all
Use make V=1 or set BUILD_VERBOSE in your environment to increase build verbosity.
Including User C Module from ../../../st7789_mpy//st7789
Building with ESP IDF v3
CC ../../../st7789_mpy/st7789/st7789.c
In file included from ../../../st7789_mpy/st7789/st7789.c:27:0:
../../../st7789_mpy/st7789/st7789.c:469:19: error: 'MP_QSTR_blit_buffer' undeclared here (not in a function)

thank you
`

Rotation not supported

I'm using this library with the DSTIKE ESP32 Watch DevKit TFT here.
It works like a charm (put python into a watch was my secret dream).
Alas the screen is rotated 90° cw, I added a function to set rotation :

STATIC mp_obj_t st7789_ST7789_set_rotation(mp_obj_t self_in, mp_obj_t value) {
    st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
    mp_int_t m = mp_obj_get_int(value);
    uint8_t madctl[] = {ST7789_MADCTL_RGB};
    switch (m) {
    case 0:
      madctl[0] =  ST7789_MADCTL_MX | ST7789_MADCTL_MY | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 1:
      madctl[0] =  ST7789_MADCTL_MY | ST7789_MADCTL_MV | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 2:
      madctl[0] =  ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    case 3:
      madctl[0] =  ST7789_MADCTL_MX | ST7789_MADCTL_MV | ST7789_MADCTL_RGB ;
      write_cmd(self, ST7789_MADCTL, madctl, 1);
      break;
    default:
      break;
    }
    return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_2(st7789_ST7789_set_rotation_obj, st7789_ST7789_set_rotation);

But when setting in mode 1 there is like an offset of 80 pixels (the fill function leaves a vertical band on the right)

No clues of what next (I'm remapping everything in sw right now). Any Idea?

Compile error onSTM32 port

Hi,

I did a try on stm32 port. My arm-none-eabi-gcc version is : gcc version 8.3.1 20190703 (release) [gcc-8-branch revision 273027] (GNU Tools for Arm Embedded Processors 8-2019-q3-update)

Something wrong with syntax.
Any idea ?

Including User C Module from ../../../st7789_mpy//st7789
CC ../../../st7789_mpy/st7789/st7789.c
In file included from ../../py/mphal.h:34,
                 from ../../../st7789_mpy/st7789/st7789.c:30:
../../../st7789_mpy/st7789/st7789.c: In function 'write_cmd':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:41:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_LOW()     (mp_hal_pin_write(self->dc, 0))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:88:9: note: in expansion of macro 'DC_LOW'
         DC_LOW();
         ^~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:92:9: note: in expansion of macro 'DC_HIGH'
         DC_HIGH();
         ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'draw_pixel':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:139:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'fast_hline':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:149:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'fast_vline':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:158:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_hard_reset':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:44:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_HIGH() (mp_hal_pin_write(self->reset, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:169:5: note: in expansion of macro 'RESET_HIGH'
     RESET_HIGH();
     ^~~~~~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:43:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_LOW()  (mp_hal_pin_write(self->reset, 0))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:171:5: note: in expansion of macro 'RESET_LOW'
     RESET_LOW();
     ^~~~~~~~~
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:44:23: note: in expansion of macro 'mp_hal_pin_write'
 #define RESET_HIGH() (mp_hal_pin_write(self->reset, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:173:5: note: in expansion of macro 'RESET_HIGH'
     RESET_HIGH();
     ^~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_fill_rect':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:253:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_fill':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:268:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_blit_buffer':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:42:23: note: in expansion of macro 'mp_hal_pin_write'
 #define DC_HIGH()    (mp_hal_pin_write(self->dc, 1))
                       ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:358:5: note: in expansion of macro 'DC_HIGH'
     DC_HIGH();
     ^~~~~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_on':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:45:22: note: in expansion of macro 'mp_hal_pin_write'
 #define DISP_HIGH() (mp_hal_pin_write(self->backlight, 1))
                      ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:414:5: note: in expansion of macro 'DISP_HIGH'
     DISP_HIGH();
     ^~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:413:26: error: unused variable 'self' [-Werror=unused-variable]
     st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
                          ^~~~
In file included from ../../py/mphal.h:34,
                 from ../../../st7789_mpy/st7789/st7789.c:30:
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_off':
./mphalport.h:71:33: error: expected expression before 'do'
 #define mp_hal_pin_write(p, v)  do { if (v) { mp_hal_pin_high(p); } else { mp_hal_pin_low(p); } } while (0)
                                 ^~
../../../st7789_mpy/st7789/st7789.c:46:21: note: in expansion of macro 'mp_hal_pin_write'
 #define DISP_LOW() (mp_hal_pin_write(self->backlight, 0))
                     ^~~~~~~~~~~~~~~~
../../../st7789_mpy/st7789/st7789.c:423:5: note: in expansion of macro 'DISP_LOW'
     DISP_LOW();
     ^~~~~~~~
../../../st7789_mpy/st7789/st7789.c:422:26: error: unused variable 'self' [-Werror=unused-variable]
     st7789_ST7789_obj_t *self = MP_OBJ_TO_PTR(self_in);
                          ^~~~
../../../st7789_mpy/st7789/st7789.c: In function 'st7789_ST7789_make_new':
../../../st7789_mpy/st7789/st7789.c:552:29: error: implicit declaration of function 'MP_ERROR_TEXT'; did you mean 'MP_ROM_INT'? [-Werror=implicit-function-declaration]
         mp_raise_ValueError(MP_ERROR_TEXT("Unsupported display. Only 240x240 and 135x240 are supported without xstart and ystart provided"));
                             ^~~~~~~~~~~~~
                             MP_ROM_INT
../../../st7789_mpy/st7789/st7789.c:552:29: error: passing argument 1 of 'mp_raise_ValueError' makes pointer from integer without a cast [-Werror=int-conversion]
         mp_raise_ValueError(MP_ERROR_TEXT("Unsupported display. Only 240x240 and 135x240 are supported without xstart and ystart provided"));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../st7789_mpy/st7789/st7789.c:28:
../../py/runtime.h:154:47: note: expected 'const char *' but argument is of type 'int'
 NORETURN void mp_raise_ValueError(const char *msg);
                                   ~~~~~~~~~~~~^~~
../../../st7789_mpy/st7789/st7789.c:557:29: error: passing argument 1 of 'mp_raise_ValueError' makes pointer from integer without a cast [-Werror=int-conversion]
         mp_raise_ValueError(MP_ERROR_TEXT("must specify all of reset/dc pins"));
                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../../../st7789_mpy/st7789/st7789.c:28:
../../py/runtime.h:154:47: note: expected 'const char *' but argument is of type 'int'
 NORETURN void mp_raise_ValueError(const char *msg);
                                   ~~~~~~~~~~~~^~~
cc1: all warnings being treated as errors
../../py/mkrules.mk:47 : la recette pour la cible « build-RESA_PYBSTICK26/st7789/st7789.o » a échouée
make: *** [build-RESA_PYBSTICK26/st7789/st7789.o] Erreur 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.