-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data disrupted when utilizing MicroPython Touch and SD Card Reader #15
Comments
I think you can do this. Please read this section for background. To read data from the SD card you need something like: async def read_data():
async with Screen.rfsh_lock:
# set up the SPI bus baudrate for the SD card
# read the data
await asyncio.sleep_ms(0) # Allow refresh and touch to proceed
# Do anything else you need The code within the context manager should be synchronous. That way both refresh and touch controller access will be locked out for the duration. Given that your display = Display(ssd, tpad, (spi, 33_000_000, 2_500_000)) the GUI will use the correct rates when the context manager exits and refresh re-commences. Please report back on whether this works. If it does, I'll document it (and credit you with the verification). |
This appears to have worked, thank you very much! A little more detail: I made my import and export functions async, and put the actual file operations inside the When it came to calling said functions, I took a page out of the micro-gui audio demo as suggested in the section you linked, calling them with Thanks again! |
Thanks for confirming. I encountered another issue with that display. I wrote a simple This doesn't happen if the SD card is instantiated after the XPT2046 and ST7789 because, by then the CS/ lines are under control. |
I've been writing an application for a Raspberry Pi Pico and connected Pico-ResTouch-LCD-2.8 which involves the use of a touchscreen GUI (using this library) and the SD card reader attached to the Pico-ResTouch-LCD-2.8 to manage files in an attached SD card. I encountered issues however where display actions would lead to the disruption of SD Card data, which I discovered was because by default the data is transferred through SPI connection, which can conflict with the pathways used by the touchscreen portion. While it is possible to switch the SD Card connection to an SDIO mode, this is a process that I'd rather avoid, if at all possible.
Is there a good/preferrable way to suspend graphics transmissions while I am running file I/O operations?
The text was updated successfully, but these errors were encountered: