Post by lightcalamar on Jan 4, 2018 14:32:24 GMT -8
Hello James.
First of all congratulations on the new GD2 library running on Gameduino 2/3 shields.
Your new code to play videos, you use particular "library" of SD reader. This SD reader is linked to the SPI bus of the same screen ie FT8xx. I think a few years back a few MCUs just having an SPI bus. For example in Teensy 3.5 or 3.6 have EX_SDIO reader and of course not have possibility to play playback videos on these MCUs, s, be the same problem with MCU's type STM32F4 with this "particular" library of reading SD reader.
Your code for example to play videos is;
I have one questions.
Can it be adapted according to the SD reader of your library GD2/3 to library SDFat?
Thanks for your kind attention
First of all congratulations on the new GD2 library running on Gameduino 2/3 shields.
Your new code to play videos, you use particular "library" of SD reader. This SD reader is linked to the SPI bus of the same screen ie FT8xx. I think a few years back a few MCUs just having an SPI bus. For example in Teensy 3.5 or 3.6 have EX_SDIO reader and of course not have possibility to play playback videos on these MCUs, s, be the same problem with MCU's type STM32F4 with this "particular" library of reading SD reader.
Your code for example to play videos is;
class MoviePlayer
{
uint32_t mf_size, mf_base, wp;
Reader r;
void loadsector() {
byte buf[512];
GD.__end();
r.readsector(buf);
GD.resume();
GD.wr_n(mf_base + wp, buf, 512);
wp = (wp + 512) & (mf_size - 1);
}
public:
int begin(const char *filename) {
mf_size = 0x40000UL;
mf_base = 0x100000UL - mf_size;
GD.__end();
if (!r.openfile(filename)) {
// Serial.println("Open failed");
return 0;
}
GD.resume();
wp = 0;
while (wp < (mf_size - 512)) {
loadsector();
}
GD.cmd_mediafifo(mf_base, mf_size);
GD.cmd_regwrite(REG_MEDIAFIFO_WRITE, wp);
GD.finish();
return 1;
}
int service() {
if (r.eof()) {
return 0;
} else {
byte buf[512];
uint32_t fullness = (wp - GD.rd32(REG_MEDIAFIFO_READ)) & (mf_size - 1);
while (fullness < (mf_size - 512)) {
loadsector();
fullness += 512;
GD.wr32(REG_MEDIAFIFO_WRITE, wp);
}
return 1;
}
}
void play() {
GD.cmd_playvideo(OPT_MEDIAFIFO | OPT_FULLSCREEN | OPT_SOUND);
GD.flush();
while (service())
;
GD.cmd_memcpy(0, 0, 4);
GD.finish();
}
};
class Dirsearch {
struct dirent de;
int index;
public:
char name[13];
void begin() {
index = 0;
}
int get(const char *ext) {
byte i;
GD.__end();
char e3[3];
do {
GD.SD.rdn((byte*)&de, GD.SD.o_root + index++ * 32, sizeof(de));
for (i = 0; i < 3; i++)
e3[i] = tolower(de.ext[i]);
} while (de.name[0] &&
((de.name[0] & 0x80) || (memcmp(ext, e3, 3) != 0)));
GD.resume();
char *pc = name;
for (i = 0; i < 8 && de.name[i] != ' '; i++)
*pc++ = tolower(de.name[i]);
*pc++ = '.';
for (i = 0; i < 3 && de.ext[i] != ' '; i++)
*pc++ = tolower(de.ext[i]);
*pc++ = 0;
return de.name[0];
}
};
After doing many tests it will be impossible to export for the moment and compatible with your example library in SDFat. Last summer make a companion functions and be able to see images and ASSET with his library in development, and work very well. You can see code in link libray GD2UBI have one questions.
Can it be adapted according to the SD reader of your library GD2/3 to library SDFat?
Thanks for your kind attention