Xinyuan-LilyGO / lilygo-micropython

Micropython for LILYGO boards
GNU General Public License v3.0
101 stars 30 forks source link

lcd.I8080 got TypeError: extra keyword arguments given #22

Closed loosak closed 1 year ago

loosak commented 1 year ago

Config: LILYGO_T-DisplayS3

When I try to inicialize display by given code:

import lcd
from machine import Pin
import logo
import gc
import time

gc.enable()

i8080 = lcd.I8080(
    data=(Pin(39), Pin(40), Pin(41), Pin(42), Pin(45), Pin(46), Pin(47), Pin(48)),
    command=Pin(7),
    write=Pin(8),
    read=Pin(9),
    cs=Pin(6),
    backlight=Pin(38),
    pclk=2 * 1000 * 1000,
    width=320,
    height=170,
    swap_color_bytes=False,
    cmd_bits=8,
    param_bits=8
)
st = lcd.ST7789(i8080, reset=Pin(5))

st.reset()
st.init()
st.invert_color(True)
st.swap_xy(True)
st.mirror(False, True)
st.set_gap(0, 35)
st.backlight_on()

st.bitmap(0, 0, logo.WIDTH, logo.HEIGHT, logo.BITMAP)

time.sleep(0.1)
del st
i8080.deinit()
gc.collect()

I got error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "st.py", line 15, in <module>
TypeError: extra keyword arguments given

The extra keyword arguments is backlight=Pin(38)

lbuque commented 1 year ago

please try this firmware.

loosak commented 1 year ago

Nope, same errors. My firmware was build from latest master branch of this repo with:

$ cp config_T-DisplayS3 config
$ make

btw: THIS firmware works with ST7789 display of the board: https://github.com/russhughes/st7789s3_mpy/blob/main/firmware/firmware.bin

lbuque commented 1 year ago

Try the following code:

import lcd
from machine import Pin
import logo
import gc
import time
gc.enable()
i8080 = lcd.I8080(data=(Pin(39), Pin(40), Pin(41), Pin(42), Pin(45), Pin(46), Pin(47), Pin(48)),
                     command=Pin(7),
                     write=Pin(8),
                     read=Pin(9),
                     cs=Pin(6),
                     pclk=2 * 1000 * 1000,
                     width=320,
                     height=170,
                     swap_color_bytes=False,
                     cmd_bits=8,
                     param_bits=8)
st = lcd.ST7789(i8080, reset=Pin(5), backlight=Pin(38))
st.reset()
st.init()
st.invert_color(True)
st.swap_xy(True)
st.mirror(False, True)
st.set_gap(0, 35)
st.backlight_on()
st.bitmap(0, 0, logo.WIDTH, logo.HEIGHT, logo.BITMAP)
time.sleep(0.1)
del st
i8080.deinit()
gc.collect()
notloki commented 1 year ago

I had the same issue. but moving backlight to the other constructor seems to solve it

codiak6335 commented 1 year ago

Just ran into the same issue... and the constructor fixed the issue as well

bkircher67 commented 1 year ago

Try the following code:

import lcd
from machine import Pin
import logo
import gc
import time
gc.enable()
i8080 = lcd.I8080(data=(Pin(39), Pin(40), Pin(41), Pin(42), Pin(45), Pin(46), Pin(47), Pin(48)),
                     command=Pin(7),
                     write=Pin(8),
                     read=Pin(9),
                     cs=Pin(6),
                     pclk=2 * 1000 * 1000,
                     width=320,
                     height=170,
                     swap_color_bytes=False,
                     cmd_bits=8,
                     param_bits=8)
st = lcd.ST7789(i8080, reset=Pin(5), backlight=Pin(38))
st.reset()
st.init()
st.invert_color(True)
st.swap_xy(True)
st.mirror(False, True)
st.set_gap(0, 35)
st.backlight_on()
st.bitmap(0, 0, logo.WIDTH, logo.HEIGHT, logo.BITMAP)
time.sleep(0.1)
del st
i8080.deinit()
gc.collect()

Thanks for this example! This was the first time my T-Display-S3 did show something under micropythion. Now I'm experimenting with Framebuffer to get some more experience. Any recommendation for some examples I can use?