cancel
Showing results for 
Search instead for 
Did you mean: 

TuchGFX - STM32F412G-DISCO Scrollist items get from qspi flash

SKara.6
Associate II

Hello everyone. I just met Touch Gfx and I am a student.

I want to display a list I saved in the first sector of qspi flash in the scrollist

but I could not reach a kind of result

I kept the first 2mb of the flash to myself

/* Memories definition */
MEMORY
{
  RAM    (xrw)    : ORIGIN = 0x20000000,   LENGTH = 256K
  FLASH    (rx)    : ORIGIN = 0x8000000,   LENGTH = 1024K
  QSPI     (r)     : ORIGIN = 0x90200000,  LENGTH = 14M
}
// *****  readTable.h ****
 
 
class readTable
{
public:
	void kategorisayisi ();  //	reading and extracting data from flash
	char * RitimIsmiGonder(int no); //for ScrollRitimUpdateItem call
 
private:
 
	char * ritimListesi[121];   // The array I want to send to the scrollist widget
}
 
 
 
};

I do reading, extracting and sending in a class called readTable.

// readTable.cpp 
 
 
 
uint16_t sizem = 1000;
volatile char  *externalFlash =( char * ) 0x90000000;
 char  data[1000];
 char delim[] = "\r\n";
 
 
	void readTable::kategorisayisi()
{
 
		
		for(uint16_t i = 0; i < sizem; i++)
		{
			data[i] = externalFlash[i];        //dump form extFlash
		}
 
		char *ptr = strtok(data, delim);   // sorting process
 
		 	for(int i=0;i<121;i++)
		 	{
		 		ritimListesi[i]=ptr;            //  transfer fragmented data to array
		 		ptr = strtok(NULL, delim);
		 	}
}
	
	char *  readTable::RitimIsmiGonder(int no)
	{
		return ritimListesi[no];       //Array element returning for ScrollRitimUpdateItem call
 
	}
// **** scrollist CustomContainer *****
 
 
#include <gui/containers/RitimIsimleriLCont.hpp>
#include "readTable.hpp"
RitimIsimleriLCont::RitimIsimleriLCont()
{
 
}
readTable rt;
 
void RitimIsimleriLCont::initialize()
{
    RitimIsimleriLContBase::initialize();
}
void RitimIsimleriLCont::setNumber(uint8_t no)
     {
	      
		Unicode::strncpy(RitimlerBuffer ,( const char *)t.RitimIsmiGonder(no) ,10 ); // Calling my list array element
      }

After all, I can't see anything in the scrollist (sometimes '?' Characters are seen)

I can follow it to a point while debugging the program.

 but after a while I lose all values.

Where am I making a mistake? An eye to see from the outside will help me a lot.

Thank you in advance...

1 ACCEPTED SOLUTION

Accepted Solutions
MM..1
Chief III

I see little complicated solution and scroll code you dont show , when you have any.

Scrollist need this method in view code

void Screen3View::scrollList1UpdateItem(MenuItem &item, int16_t itemIndex) {

and in this method you can directly read from qflash instead your class...

scrollList1.setNumberOfItems(sizeof(UI_Menu_Items_A));

In setup code for screen you only need set number of items.

View solution in original post

4 REPLIES 4
MM..1
Chief III

I see little complicated solution and scroll code you dont show , when you have any.

Scrollist need this method in view code

void Screen3View::scrollList1UpdateItem(MenuItem &item, int16_t itemIndex) {

and in this method you can directly read from qflash instead your class...

scrollList1.setNumberOfItems(sizeof(UI_Menu_Items_A));

In setup code for screen you only need set number of items.

Thank you very much for your reply.

 I have a method like.

void AnaSayfaView::ScrollRitimUpdateItem(RitimIsimleriLCont& item, int16_t itemIndex)
    {
	 	 item.setNumber(itemIndex);
    }

I will look at the subject.

scrollList1.setNumberOfItems(sizeof(UI_Menu_Items_A));

Since I don't know how to extract data directly from q flash, I used such a method =)

OK you can use class setNumber, but strncpy do nothing with your gui.

You need after this call customcontainer element text invalidate.

textArea1.setWildcard(textArea1Buffer);

textArea1.invalidate();

textArea1.resizeToCurrentTextWithAlignment();

textArea1.invalidate();

I guess my problem is that this function doesn't send any value.

where return ritimListesi [no]; there is a problem.

char *  readTable::RitimIsmiGonder(int no)
	{
		return ritimListesi[no];       
 
	}