Skip to main content
SKara.6
Associate
December 6, 2020
Solved

TuchGFX - STM32F412G-DISCO Scrollist items get from qspi flash

  • December 6, 2020
  • 1 reply
  • 1558 views

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...

This topic has been closed for replies.
Best answer by MM..1

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.

1 reply

MM..1
MM..1Best answer
Chief III
December 6, 2020

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.

SKara.6
SKara.6Author
Associate
December 6, 2020

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 =)

MM..1
Chief III
December 6, 2020

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();