Play video using Teensy 4.1, internal SD card and ST7789 LCD TFT

RobSparrow

New member
Hello,
I know there are a lot of posts discussing video playback using ILI9341 and Teensy, However I bought the cheap 240X240 ST7789.
I was able to show a BMP using ST7735_t3 library (it took 183ms for the BMP file to load to the screen) using T4.1 and its internal SD, but what I really need is to display videos on it. I know I need to use FFMPEG to convert to RAW format, but I couldn't find anywhere a code that deals with video playback for this LCD driver.
There's a guy on Youtube that used a "bluepill" 1$ STM32 to do just that:

https://www.youtube.com/watch?v=o3AqITHf0mo&ab_channel=cbm80amiga

Even 20 FPS will be fine.
Any help would be appreciated.

Thanks.
 
I have looked inside the skecth on which the reading sequence of the video file in RAW format is plotted. The key is this function:

Code:
drawImage (0, i * nl + j + (statMode> 0? 0: 4), lcd.width (), 1, buf + 20 + j * wd);

Inside the file Arduino_ST7735_STM.cpp, the function is designed like this:

Code:
void Arduino_ST7735 :: drawImage (int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t * img16)
{
   if (x> = _ width || y> = _ height || w <= 0 || h <= 0) return;
   setAddrWindow (x, y, x + w-1, y + h-1);

   CS_ACTIVE;
   uint32_t num = (uint32_t) w * h;
   SPI.write (img16, num);
   CS_IDLE;
}



My question is: What is the sequence of instructions equivalent to these lines in ST7735_t3?

Code:
   CS_ACTIVE;
   uint32_t num = (uint32_t) w * h;
   SPI.write (img16, num);
   CS_IDLE;

Where CS_ACTIVE is
Code:
#define CS_ACTIVE digitalWrite (csPin, LOW)
and CS_IDLE is:
Code:
#define CS_IDLE digitalWrite (csPin, HIGH)

This is my first approximation to the function:

Code:
void ST7735_t3 :: drawImage (int16_t x, int16_t y, int16_t w, int16_t h, uint16_t * img16)
{
   if (x> = _ width || y> = _ height || w <= 0 || h <= 0) return;
   setAddr (x, y, x + w-1, y + h-1);
   uint32_t num = (uint32_t) w * h;

   writecommand (ST7735_RAMWR);
   writedata16 (img16);
   //SPI.write(img16, num);
}

Locate the file in the SDIO reader on the teensy 4, but there is no response on the TFT.

Source: ST7735_SDVideoPlayback
Library: Arduino_ST7735_STM
 

Attachments

  • ST7735_PlayRAWT4_0.zip
    1.9 KB · Views: 63
You might look at writeRect: void writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);
 
Back
Top