samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 16, 2021 22:39:39 GMT -8
Hi,
I have converted an image to an array, which is stored in the flash memory, something like this:
static const PROGMEM uint8_t image[6676] = {.................};
How should I load and show this using GD2?
|
|
|
Post by jamesbowman on Aug 21, 2021 6:24:01 GMT -8
Assuming the image is a JPEG, then you can do:
#include <EEPROM.h> #include <SPI.h> #include <GD2.h>
static const PROGMEM uint8_t image[6676] = {.................};
void setup() { GD.begin(); GD.cmd_loadimage(0, 0); GD.copy(image, sizeof(image)); } void loop() { GD.Clear(); GD.Begin(BITMAPS); GD.Vertex2ii(0, 0); GD.swap(); } GD2 supports JPEG loading only. GD3 onwards supports both JPEG and PNG.
The asset converter is a better way of converting and loading multiple images, and supports transparency.
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 21, 2021 11:53:28 GMT -8
Thank you, I first tried the assets, however I was getting some errors in the *.h file. I had converted the image using gd2asset.exe
#define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END) static const shape_t ADS_SHAPE = {0, 89, 88, 0}; struct { Bitmap ads; } bitmaps = { /* ads */ {{ 89, 88}, { 44, 44}, 0x0UL, 6, 0} };
I get these errors:
In function 'void setup()': myassets.h:453:65: error: 'class GDClass' has no member named 'loadptr'; did you mean 'load'? #define LOAD_ASSETS() (GD.copy(__assets, sizeof(__assets)), GD.loadptr = ASSETS_END) ^ in expansion of macro 'LOAD_ASSETS' LOAD_ASSETS(); ^~~~~~~~~~~ exit status 1 'Bitmap' does not name a type; did you mean 'map'?
|
|
|
Post by jamesbowman on Aug 21, 2021 12:38:46 GMT -8
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 21, 2021 13:49:19 GMT -8
I'm using a modified version which supports Arduino UNO, 1.3.4 does not work with UNO.
|
|
|
Post by jamesbowman on Aug 21, 2021 19:58:46 GMT -8
Arduino Uno is fully supported by every version. Can you provide any more details on what didn't work?
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 22, 2021 3:25:27 GMT -8
I mean I connect the FT800 board to the Arduino as usual, however it does not show anything on the screen Pins are
SCK: 13 MISO: 12 MOSI: 11 INT: Floating PD: Pull-up to +5V EN: +5V CS: 10 I also connected the CS to Pin 9 or 8 to see if anything changes, however, no success. Is there anything else to do?
|
|
|
Post by jamesbowman on Aug 22, 2021 5:36:21 GMT -8
Gameduino2 stacks onto the Uno. There are no connections to make. You are using another FT800 board? Pin 8 is the GPU sel: excamera.com/sphinx/gameduino3/#hardwareFor non-Gameduino hardware you need to initialize the board with GD.begin(NO_STORAGE); This prevents the library from probing for the microSD card.
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 22, 2021 6:17:13 GMT -8
Thank you.
Yes, I use a custom-made FT800 board, however it has no specific difference with other modules
I wanted to test this, I receive an error on your suggested code: NO_STORAGE not declared...
GD.begin(NO_STORAGE);
How can I add the SD Card feature also?
|
|
|
Post by tftlcdcyg on Aug 22, 2021 11:03:35 GMT -8
Part of the latest version of the GD2 library, connect to the normal control pins as if it were a gameduino 2 shield. You can connect an external microSD reader in parallel to the screen, in SPI 1, so that you have this option active .
You just have to make sure that the connections are well made, considering that the screen has 3.3V logic, you should use a 5V to 3.3V converter, otherwise the screen will not work correctly. I just installed a Riverdi FT801 display on a teensy 4.1 board, you just have to make sure that the REG_SWIZZLE instruction has the correct value, inside the GD2.ccp file
For the fix I mention, it must be GDTR.wr (REG_SWIZZLE, 0);
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 22, 2021 23:39:35 GMT -8
Part of the latest version of the GD2 library, connect to the normal control pins as if it were a gameduino 2 shield. You can connect an external microSD reader in parallel to the screen, in SPI 1, so that you have this option active . You just have to make sure that the connections are well made, considering that the screen has 3.3V logic, you should use a 5V to 3.3V converter, otherwise the screen will not work correctly. I just installed a Riverdi FT801 display on a teensy 4.1 board, you just have to make sure that the REG_SWIZZLE instruction has the correct value, inside the GD2.ccp file For the fix I mention, it must be GDTR.wr (REG_SWIZZLE, 0); I'm absolutely sure about wiring, because I have tested this with a modified library for UNO and similar, and it works, however it is old, and some newer features are missing.
I tested this
GDTR.wr (REG_SWIZZLE, 0);
it was one instance of this inside the GD2.cpp, (Line 563) I modified it and relaunched the Arduino IDE, but no success
|
|
jlv
New Member
Posts: 1
|
Post by jlv on Aug 28, 2021 16:44:58 GMT -8
Hi. I know that it is not the same case, but it's the closest I found. I have successfully used the library with an ESP8266 development board but I couldn't figure out how to download a jpg image from the SPIFFS. Searching the library I found that the load commands point to download from a sd card with the only alternative of using the asset converter, but just for small files. So, my question is: is it possible to do it? Thank you in advance.
|
|
|
Post by tftlcdcyg on Aug 28, 2021 17:15:31 GMT -8
The gameduino 3 together with the original GD2 library is 100% compatible with UNO type cards with ESP32 and ESP8266 chips. Personally I would start from that compatibility.
I have been working with a modification of the GD2 library so that it works 100% with the teensy 4.x boards and your SDIO reader, with some adjustments that have taken a few months, it is already 100% functional with the SdFat library. This week I was able to get an FT801 display to work with a teensy 4.1, it was just a few tweaks, but it has worked quite well.
I suggest you start again from the GD2 library and pay attention to the calls it has to work with FT800 / FT801 screens, try to use outputs to the serial port to debug the settings, as you make adjustments
|
|
|
Post by armadafg on Aug 28, 2021 18:03:16 GMT -8
Hi, can your library work with fameduin3X dazzler and Teensy SDIO?
|
|
samavr
Junior Member

Posts: 16
|
Post by samavr on Aug 29, 2021 8:16:35 GMT -8
The gameduino 3 together with the original GD2 library is 100% compatible with UNO type cards with ESP32 and ESP8266 chips. Personally I would start from that compatibility. I have been working with a modification of the GD2 library so that it works 100% with the teensy 4.x boards and your SDIO reader, with some adjustments that have taken a few months, it is already 100% functional with the SdFat library. This week I was able to get an FT801 display to work with a teensy 4.1, it was just a few tweaks, but it has worked quite well. I suggest you start again from the GD2 library and pay attention to the calls it has to work with FT800 / FT801 screens, try to use outputs to the serial port to debug the settings, as you make adjustments It is compatible, however it looks like we need some modifications. I'm not beginner to just make mistake in wiring.
|
|