Xinyuan-LilyGO / T-Dongle-S3

An ESP32S3 development board that can freely use WIFI, BLE, TF, LED, TFT_LCD functions.
MIT License
108 stars 37 forks source link

apa102 module not implemented in firmware - potential fix #3

Open Xendi opened 1 year ago

Xendi commented 1 year ago

apa102 module is not available in firmware.

Uploading a generic Dotstar driver (https://github.com/RobertJBabb/micropython_generic_apa102/blob/master/generic_dotstar.py) allows the LED to be accessed easily like so:

import time
from generic_dotstar import SpiDotStar as SPIDotStar
from machine import SPI, Pin

clock = Pin(39)
data = Pin(40)
num_pixels = 1

print('Testing MicroPython 1.10 SPI DotStar Compatibility Class')

spi = SPI(2, sck=clock, mosi=data, baudrate=1000000)
pixelp = SPIDotStar(spi, num_pixels)
pixelp[0] = (0, 255, 0)
pixelp.show()
r, g, b = pixelp[0]
time.sleep(2)
pixelp.deinit()
fundef1 commented 1 year ago

Best not to use the HW SPI as it is also defined in tft_config.py for use with st7735. Better to use SoftSPI instead.

mmMicky commented 1 year ago

Maybe this SPI is already occupied by the screen. Modifying the SPI index number may solve it.

fundef1 commented 1 year ago

I did try using the other SPIs. but two of them are used by the board (for flash/mem IIRC) the other one returned with an 'invalid configuration' no matter what I tried.

could you provide a working example using one of the other HW SPIs ?

mmMicky commented 1 year ago

SPI0 has been occupied by flash, you can use SPI1 or SPI2 or directly use the ready-made driver library https://github.com/Xinyuan-LilyGO/T-Dongle-S3/tree/main/lib/FastLED

fundef1 commented 1 year ago

Ah yes, FastLED, but I'm using micropython.

I can't get SPI1 to work though, it returns with invalid configuration...

zmactep commented 1 year ago

Thank you for the hint. I use SoftSPI with MISO=37 and everything works fine at the same time with a display.