Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 4 of 4

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

  1. #1
    Junior Member
    Join Date
    Sep 2020
    Posts
    3

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

    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=o3Aq...nel=cbm80amiga

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

    Thanks.

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    23,077
    Any ideas on that ffmpeg command?

  3. #3
    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
    Attached Files Attached Files

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    7,935
    You might look at writeRect: void writeRect(int16_t x, int16_t y, int16_t w, int16_t h, const uint16_t *pcolors);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •