Coder Social home page Coder Social logo

gd2-lib's Introduction

gd2-lib

Build Status

This is the source repository of the GD library - the software side of the Gameduino project. The installation library and instructions are at:

http://gameduino.com/code

To build the release library Gameduino2.zip run:

python publish.py

FAQ

How do I use GD with a 800x480 display?

If you're using the Gameduino 3 7" model, this is done for you by the Gameduino 3's configuration flash. If you're using another screen the setup procedure must be done explicitly. After calling GD.begin() you can set the scanout registers for 800x480 like this:

GD.wr16(REG_HCYCLE, 928);
GD.wr16(REG_HOFFSET, 88);
GD.wr16(REG_HSIZE, 800);
GD.wr16(REG_HSYNC0, 0);
GD.wr16(REG_HSYNC1, 48);
GD.wr16(REG_VCYCLE, 525);
GD.wr16(REG_VOFFSET, 32);
GD.wr16(REG_VSIZE, 480);
GD.wr16(REG_VSYNC0, 0);
GD.wr16(REG_VSYNC1, 3);
GD.wr16(REG_CSPREAD, 1);
GD.wr16(REG_DITHER, 1);
GD.wr16(REG_PCLK_POL, 0);
GD.wr16(REG_PCLK, 4);

How do I use GD with a 320x480 display?

There is a writeup here: http://excamera.com/sphinx/article-ili9488.html

How do I use GD with the Sunflower Shield?

At the start of GD2.cpp change BOARD and CALIBRATION:

#define BOARD         BOARD_SUNFLOWER   // board, from above
#define STORAGE       1                 // Want SD storage?
#define CALIBRATION   0                 // Want touchscreen calibration?

How do I change the select pin assignments?

To change the GPU select from pin 8, modify #define CS at the start of transports/wiring.h

To change microSD select from pin 9, modify #define SD_PIN at the start of GD2.cpp

How do you run in portrait mode?

After calling GD.begin() set the orientation like this::

GD.cmd_setrotate(2);

to enter portrait mode. The argument controls orientation, 0 and 1 are landscape. 2 and 3 are portrait.

I can only get coordinates in the range 0-511! What about bigger screens?

The short-form drawing opcode Vertex2ii() has a limited coordinate range. But the opcode Vertex2f() has huge range. It works in subpixel coordinates, with programmable precision. At the start of drawing do:

GD.VertexFormat(3); // means points are scaled by 8 from here on

then instead of this:

GD.Vertex2ii(x, y, handle, cell);

do:

GD.BitmapHandle(handle);
GD.Cell(cell);
GD.Vertex2f(8 * x, 8 * y);

This has enough range for displays up to 2048x2048.

If you don't need subpixel precision, then you can use a precision of zero:

GD.VertexFormat(0); // integer coordinates
GD.Vertex2f(x, y);

My JPEG does not load!

First, make sure you call GD.Begin() without arguments. This initializes the microSD code.

Second, filenames on the microSD must not be too long. They have to be in 8.3 form so that they can be recognized by the quite limited Arduino-based loader.

Second, make sure the JPEG is not progressive; the hardware supports baseline jpegs only.

If there's doubt, post your JPEG to the Gameduino Forum, and I can take a look at it.

gd2-lib's People

Contributors

anthonydigirolamo avatar derekmulcahy avatar jamesbowman avatar phoddie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gd2-lib's Issues

video playback examples

Two examples:

video1 'minimum' with a single video
video2 menu for choosing a video from microSD

Both should be included in the distribution

Does not compile on Due

Reported:

I'm testing GD3 on Arduino DUE.

The Hello World example won't compile. Here the error:

In file included from /var/folders/t5/x9_b_ncj7xlclkqshk_fq5dr0000gp/T/arduino_modified_sketch_696975/helloworld.ino:4:0:
/win/d/projects/avr/sketch/libraries/Gameduino2/GD2.h: In member function 'void Reader::fetch512(byte*)':
/win/d/projects/avr/sketch/libraries/Gameduino2/GD2.h:720:50: error: no matching function for call to 'ASPI_t::transfer(byte*&, int)'
     memset(dst, 0xff, 512); SPI.transfer(dst, 512);
                                                  ^
/win/d/projects/avr/sketch/libraries/Gameduino2/GD2.h:720:50: note: candidate is:
In file included from /var/folders/t5/x9_b_ncj7xlclkqshk_fq5dr0000gp/T/arduino_modified_sketch_696975/helloworld.ino:4:0:
/win/d/projects/avr/sketch/libraries/Gameduino2/GD2.h:61:8: note: byte ASPI_t::transfer(byte)
   byte transfer(byte x ) {
        ^
/win/d/projects/avr/sketch/libraries/Gameduino2/GD2.h:61:8: note:   candidate expects 1 argument, 2 provided
exit status 1

Looks like the SPI emulation class ASPI needs the new block transfer() method.

ESP32

Hi ive been trying to get it to work with the ESP32 board. But ive been running into a comp issue.

In file included from /Users/geraldrubalcava/Documents/Arduino/libraries/Gameduino2/1.Basics/helloworld/helloworld.ino:3:0: /Users/geraldrubalcava/Documents/Arduino/libraries/Gameduino2/GD2.h: In member function 'void sdcard::begin(byte)': /Users/geraldrubalcava/Documents/Arduino/libraries/Gameduino2/GD2.h:300:5: error: 'SPSR' was not declared in this scope SPSR = (1 << SPI2X); ^ /Users/geraldrubalcava/Documents/Arduino/libraries/Gameduino2/GD2.h:300:18: error: 'SPI2X' was not declared in this scope SPSR = (1 << SPI2X);

im using the following:
https://github.com/espressif/arduino-esp32
With their latest release.

Will not compile for ESP32

Upon compiling with the newest version of the GD2 library from the repo for ESP32, there is an SPI error:

In file included from D:\Graeme\Documents\Arduino\libraries\gd2-lib-master\GD2.cpp:40:0: D:\Graeme\Documents\Arduino\libraries\gd2-lib-master\transports/wiring.h: In member function 'void GDTransport::daz_rd(uint8_t*, size_t)': D:\Graeme\Documents\Arduino\libraries\gd2-lib-master\transports/wiring.h:432:29: error: invalid conversion from 'char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive] SPI.transfer((char*)s, n); ^ In file included from D:\Graeme\Documents\Arduino\libraries\gd2-lib-master\GD2.cpp:10:0: C:\Users\graae\.platformio\packages\framework-arduinoespressif32\libraries\SPI\src/SPI.h:70:10: note: initializing argument 1 of 'void SPIClass::transfer(uint8_t*, uint32_t)' void transfer(uint8_t * data, uint32_t size); ^ *** [.pio\build\esp32doit-devkit-v1\libb73\gd2-lib-master\GD2.cpp.o] Error 1

cannot load 2 or more images on ft810 with 800*480 7 inch display

Hey, there is a big problem and i am working to fix it but i fail.
my hardware: FT810, 7 inch 800*480 display
programming with GD3 library on arduino DUE.
the problem is that loading fist image is good but when i try to load second image it always shows as you can see on attached video (its on zip).
video_2019-04-12_13-17-52.zip

i load the first image like this:
GD.cmd_loadimage(0, 0);
GD.load("Ab1.jpg");
GD.Clear();
GD.Begin(BITMAPS);
GD.Vertex2ii(0, 0);
GD.End();
GD.swap();
and after that i load the second image like this:
GD.BitmapHandle(1);
GD.cmd_loadimage(-1, 0);
GD.load("Ab2.jpg");
then for displaying second image i use this code in a loop:
GD.Clear();
GD.Begin(BITMAPS);
GD.Vertex2ii(0,0, 1);
GD.End();
GD.swap();

Add version number, show it everywhere

Add proper x.y.z version numbering to GD.

  • The Arduino "Library Manager" should be able to see it
  • display current version on the download page, somehow
  • make available as a define in GD2.h
  • display version on the selftest screens/serial, so that it's obvious which library is in use.

Aruino Uno Compatibility

Hi,

The GD2 does not work with Arduino UNO. I have changed the CS pin also, however no effect unfortunately

Build regression script

Make a smoke script to compile every example for every supported target.

Targets:

  • Arduino
  • ESP8266
  • Due

Also check that no sample has a dumpscreen left in.

Confirm ESP8266 + Gameduino 2

Report (from Chris R on Kickstarter) that this combination does not run any samples.

Confirm and add to regressions.

spidev.h is not published in the directory transports

Hi James, I noticed in the latest version that only wiring.h is published in the zip file. How about the file spidev.h which I think is for compatibility with those Linux platforms, like RPi? Does this means in the future version, the support of Linux will be removed?

Bitmap layouts include no longer supported value

Appears that PALETTED has been removed from the FTx Developer guide.

Forum thread here

There is a difference between ft80x and ft81x:

"PALETTED8 format is supported indirectly in FT81X and it is different from PALETTED
format in FT80X. To render Alpha, Red, Green and Blue channels, multi-pass drawing action is
required."

#define ARGB1555 0 #define L1 1 #define L4 2 #define L8 3 #define RGB332 4 #define ARGB2 5 #define ARGB4 6 #define RGB565 7 #define PALETTED 8 #define TEXT8X8 9 #define TEXTVGA 10 #define BARGRAPH 11 #define PALETTED565 14 #define PALETTED4444 15 #define PALETTED8 16 #define L2 17

Screenshot 2021-07-18 at 18 01 06

SDfat example

Make an example to use SDfat instead of the built-in read-only FAT support.

Improve crash handling

Currently a GPU exception results in cryptic output on the serial port:

r=4095

This sucks.

Clean up top-level directory

The top-level directory is a mess.
Ideally there should just be directories for examples , tools and contrib.

Feature: text size

Want to be able to determine the (width, height) of a piece of text in a given font.
Something like:

void GD.textsize(int &w, int &h, int font, const char *s);

class xy conflicts

The new class xy conflicts with the example project 'logo', 'blobs' and 'kenney'. Suggest change a name.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.