Help needed with RA8875 LCD on Teensy 3.6

Status
Not open for further replies.

skpang

Well-known member
I'm using a 5" RA8875 LCD with a Teensy 3.6.

The driver I'm using is the one from Sumotoy v0.70

I'm trying to display a bitmap image but it looks like something is corrupted.

I followed the conversion tutorial from Sumotoy.
https://github.com/sumotoy/RA8875/issues/91

It generated a c file and I copied the array into the .ino file.

Orignal image:
View attachment 18076

LCD image:
View attachment 18077

Any idea of how to fix this problem ?

Code:
/*
This is a method to load 24 bit image from an array by using chunks of pixels (same as width of the picture)

1) open Lcd Image Converter
2) menu ->file->Open
It opens a dialog box to open files but by default it's xlm, you have to click an select images, them select an image
3)menu options->conversion
4)select->preset->direct24bit_plain
5)select OK, and if dialog says save changes?, click save.
6) now click menu->file->Convert, it will save a c file in your hard disk.

7) now open load24bitimages.ino example in arduino and open with a text editor the file you have saved before
8) inside the file xxx.c you have saved there's some stuff, you need to copy only the section named
static const uint24_t image_data_xxxx[xxx] = {
	......,....,etc. etc.
};
9)copy this section inside load24bitimages.ino (erase image_data_batman_ume...)
10) your new image should be named:
static const uint24_t image_data_xxxx[xxx] = {
you need to change uint24_t to uint32_t
11) copy the name image_data_xxxx into drawArray(image_data_xxxx,16384,128,0,0);

drawArray(image_data_xxxx,16384,128,0,0);
16384 = the lenght of the array, you need to copy the new lenght from the part you have pasted (image_data_xxxx[COPY THIS NUMBER])
128= the width of te image, if 128x128 leave like this.
0,0 the position on the screen
CAUTION! It uses a lot of memory, works ok with DUE, Teensy, ATMEGA but NOT with UNO, Leonardo, etc.
*/

#include <SPI.h>
#include <RA8875.h>

#define RA8875_CS 10 
#define RA8875_RESET 9//any pin or 255 to disable it!

RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);


static const uint32_t image_data_alerts[19000] = 
 {
      Array removed as it is too big to post.
  };// 


void drawArray(const uint32_t * image,uint32_t isize,uint16_t iwidth,uint16_t x,uint16_t y){
  uint16_t pixels[iwidth];//container
  uint32_t i,idx;
  for (idx=0;idx<isize/iwidth;idx++){
    for (i = (iwidth*idx); i < iwidth*(idx+1);i++){
      pixels[i - (iwidth*idx)] = tft.Color24To565(image[i]);
    }
    tft.drawPixels(pixels,iwidth,x,idx+y);
  }
}


void setup() 
{
  Serial.begin(38400);delay(1000);
  Serial.println("RA8875 start");

  tft.begin(RA8875_800x480);
  tft.setCursor(0, 0); 
  tft.print("Teensy 3.6 RA8875 bitmap test");
  drawArray(image_data_alerts,19000,142,20,30);
}

void loop() 
{

}
 
Status
Not open for further replies.
Back
Top