Skip to content
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

Support for SPI TFT screens #64

Open
cgreening opened this issue Jun 29, 2024 · 5 comments
Open

Support for SPI TFT screens #64

cgreening opened this issue Jun 29, 2024 · 5 comments

Comments

@cgreening
Copy link
Contributor

I'm happy to add this if someone can point me in the right direction/tell me if it's feasible.

I'd like to add support for an SPI TFT screen.

@Jason2866
Copy link

The used library fabgl https://github.com/EremusOne/ESPectrum/tree/master/components/fabgl does support LC Displays already.

@cgreening
Copy link
Contributor Author

Are there any example configs for switching the display over to an LC display?

@EremusOne
Copy link
Owner

Hi Chris,

I'm glad you're considering ESPectrum for your single-board ESP32 ZX Spectrum project. It'll be exciting to see ESPectrum running on it!

Adding TFT support to ESPectrum should not be too difficult. Although I have no experience with TFT screens and their operation, they have been widely used in many ESP32 projects. There are two main considerations: hardware and software.

Regarding hardware, since your board doesn't have a VGA output, I assume there are enough spare GPIOs and resources for a TFT screen (though I don't know the exact requirements for those screens).

For the emulator, adapting video functions to render to a different framebuffer or sending screen info directly to the TFT device should not be too difficult. However, I'm unsure if TFT screens have an internal framebuffer or need constant refreshing like VGA screens.

As @Jason2866 pointed out, the FabGL library seems to support some TFT screens, but I haven't tested it. ESPectrum doesn't use FabGL for video; it uses modified bitLuni's libraries. It does use the FabGL PS/2 component with some modifications to support two PS/2 devices simultaneously.

Currently, I'm focused on CPCESP (the next Amstrad emulation for the ESPectrum project) and have a roadmap to complete, so I don't have much free time to study it closely, or work on this matter.

However, if you can send me some technical information (schematics, pin info) and a prototype board, I can try to find some free time to work with you on getting ESPectrum running on it.

Take care!

@cgreening
Copy link
Contributor Author

Yes - no problem with the pins - my current prototype drives the screen no problem - it's just SPI + an extra couple of pins so you can get away with just 5 GPIO pins.

My current system reads the spectrum screen memory and sends out blocks of pixels using DMA. There's some simple detection of whether a block of pixels have any changes so it only updates modified portions of the screen.

The actual code for doing it is very short. So I really just need to switch off whatever VGA code is running and trigger my code at the end of each frame.

I don't plan on supporting any of the clever effects where the border is changed on different scanlines or attributes are modified on the fly.

So probably the main thing would be working out how to switch off the VGA output and also how to run drive the TFT screen - I don't know if the TFT_eSPI code works without the arduino framework, but I don't really use much of the library at all.

I should have the next prototype boards in a few weeks and can send over my current code if you want.

@jgauchia
Copy link

jgauchia commented Jul 9, 2024

Hi Chris,

I'm glad you're considering ESPectrum for your single-board ESP32 ZX Spectrum project. It'll be exciting to see ESPectrum running on it!

Adding TFT support to ESPectrum should not be too difficult. Although I have no experience with TFT screens and their operation, they have been widely used in many ESP32 projects. There are two main considerations: hardware and software.

Regarding hardware, since your board doesn't have a VGA output, I assume there are enough spare GPIOs and resources for a TFT screen (though I don't know the exact requirements for those screens).

For the emulator, adapting video functions to render to a different framebuffer or sending screen info directly to the TFT device should not be too difficult. However, I'm unsure if TFT screens have an internal framebuffer or need constant refreshing like VGA screens.

As @Jason2866 pointed out, the FabGL library seems to support some TFT screens, but I haven't tested it. ESPectrum doesn't use FabGL for video; it uses modified bitLuni's libraries. It does use the FabGL PS/2 component with some modifications to support two PS/2 devices simultaneously.

Currently, I'm focused on CPCESP (the next Amstrad emulation for the ESPectrum project) and have a roadmap to complete, so I don't have much free time to study it closely, or work on this matter.

However, if you can send me some technical information (schematics, pin info) and a prototype board, I can try to find some free time to work with you on getting ESPectrum running on it.

Take care!

Hi, If you want, I can try with TFT screens :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants