Visual TFT what should I put in these 2 functions?

General discussion on Visual TFT Software.
Post Reply
Author
Message
Anoniem
Posts: 6
Joined: 28 Feb 2016 20:54

Visual TFT what should I put in these 2 functions?

#1 Post by Anoniem » 10 Feb 2023 09:41

Hi

I wanted to test out the ConnectEVE (using FT800) using an SD card for the images (FAT32), but I don't know what to put in these 2 functions:

char* TFT_Get_Data(unsigned long offset, unsigned int count, unsigned int *num) {
// Place your code here
}

void Init_Ext_Mem() {
// Place your code here
}


Can someone help me on my way?


Kind regards,
Boyd.

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Visual TFT what should I put in these 2 functions?

#2 Post by filip » 03 Mar 2023 14:26

Hi,

You can have a look at our code examples to see how we implemented these functions.

Regards,
Filip.

sanfordlesch
Posts: 1
Joined: 23 Jan 2024 10:08

Re: Visual TFT what should I put in these 2 functions?

#3 Post by sanfordlesch » 23 Jan 2024 10:18

Here is a possible code snippet for the TFT_Get_Data function, based on the examples from the TFT library and the Arduino SD library:

Code: Select all

char TFT_Get_Data(unsigned long offset, unsigned int count, unsigned int num) {
// Place your code here
// Declare a variable to store the data
char data;
// Select the SD card by setting the chip select pin low
digitalWrite(SD_CS, LOW);
// Initialize the SPI communication
SPI.begin();
// Set the SPI clock speed to 4 MHz
SPI.setClockDivider(SPI_CLOCK_DIV4);
// Seek to the offset position in the file
file.seek(offset);
// Read one byte of data from the file
data = file.read();
// Send the data to the FT800 chip
SPI.transfer(data);
// Deselect the SD card by setting the chip select pin high
digitalWrite(SD_CS, HIGH);
// Return the data
return data;
}
Here is a possible code snippet for the Init_Ext_Mem function, based on the examples from the TFT library and the Arduino SD library:

Code: Select all

void Init_Ext_Mem() {
// Place your code here
// Define the chip select pin for the SD card
#define SD_CS 4
// Set the chip select pin as output
pinMode(SD_CS, OUTPUT);
// Initialize the SD card
if (!SD.begin(SD_CS)) {
// If the initialization fails, print an error message
Serial.println("SD card initialization failed");
return;
}
// Open the file that contains the image data
file = SD.open("image.bin");
// If the file does not exist, print an error message
if (!file) {
Serial.println("File not found");
return;
}
// Set the external memory parameters for the FT800 chip
// Use the SDHC (Secure Digital High Capacity) mode
TFT_EXTERN_SDCARD;
// Set the image data address to 0
TFT_EXTERN_DATA_ADDR(0);
// Set the image data size to the file size
TFT_EXTERN_DATA_SIZE(file.size());
}

Post Reply

Return to “Visual TFT General”