diesel
Junior Member
Posts: 22
|
Post by diesel on Dec 11, 2015 21:33:54 GMT -8
I have the FT810Q running with the GD2 library, it is on an 800x480 7.0" screen. It works great after stumbling through the screen setup, still not perfect but looks good. I have an issue with drawing lines and rects. with vertex2ii, with coordinate commands up to 511, it will display. Coordinates > 512 will not. I presume the buffer is initialized at a max of 511? I looked for a place to make changes but came up empty. Any help would be greatly appreciated. P.S. I sure hope a Gameduino with 800x480 7" screen is in the works. Attachments:
|
|
|
Post by jamesbowman on Dec 12, 2015 9:20:55 GMT -8
Wow, great to see this running.
OK, yes. There is a limitation on Vertex2ii that it can only handle coordinates in the range 0 to 511. For the 800x480 display this is a problem... instead use Vertex2f. Vertex2f uses fractional coordinates so you replace:
GD.Vertex2ii(x, y); with:
GD.Vertex2f(16 * x, 16 * y); But the "16 *" makes the code a little hard to read, so I usually define a macro:
#define VX(x, y) GD.Vertex2f(16 * (x), 16 * (y))
So you can just write:
VX(x, y);
|
|
diesel
Junior Member
Posts: 22
|
Post by diesel on Dec 12, 2015 10:03:32 GMT -8
Thank you very much! Works like you said.
|
|
|
Post by tftlcdcyg on May 12, 2016 13:17:22 GMT -8
Looks great!, congratulations!.
James, diesel, big question: could you share with us your wiring, and lib-setup for the FT810?.
I have a FT813 of 5" (800x480 px) from riverdi on arduino due. I want to drive it with the GD2 library.
Is it possible?
|
|
|
Post by jamesbowman on May 12, 2016 14:10:52 GMT -8
|
|
|
Post by tftlcdcyg on May 12, 2016 15:01:32 GMT -8
THX!
Step 1: latest GD2 lib (arduino IDE 1.6.3)
Step 2: Wiring ----> ok
Step 3: Verify helloworld.ino before to load in due board:
Arduino: 1.6.3 (Windows 8), TD: 1.26, Board: "Arduino Due (Programming Port)"
In file included from C:\Users\StarX\Documents\Arduino\libraries\GD2\GD2.cpp:57:0:
C:\Users\StarX\Documents\Arduino\libraries\GD2\transports/wiring.h: In member function 'void GDTransport::wr_n(uint32_t, byte*, uint16_t)':
C:\Users\StarX\Documents\Arduino\libraries\GD2\transports/wiring.h:216:7: error: 'SPDR' was not declared in this scope SPDR = *src++; ^
C:\Users\StarX\Documents\Arduino\libraries\GD2\transports/wiring.h:228:14: error: 'SPSR' was not declared in this scope while (!(SPSR & _BV(SPIF))) ; ^ C:\Users\StarX\Documents\Arduino\libraries\GD2\transports/wiring.h:228:25: error: 'SPIF' was not declared in this scope while (!(SPSR & _BV(SPIF))) ; ^ C:\Users\StarX\Documents\Arduino\libraries\GD2\transports/wiring.h:228:29: error: '_BV' was not declared in this scope while (!(SPSR & _BV(SPIF))) ; ^ Error compiling.
|
|
|
Post by tftlcdcyg on May 12, 2016 15:42:19 GMT -8
Inside of the wiring.h
void wr_n(uint32_t addr, byte *src, uint16_t n) { __end(); // stop streaming __wstart(addr); while (n--) { SPDR = *src++; asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); asm volatile("nop"); } while (!(SPSR & _BV(SPIF))) ; stream(); }
Is it possible to change to?
void wr_n(uint32_t addr, byte *src, uint16_t n) { __end(); // stop streaming __wstart(addr); while (n--) SPI.transfer(*src++); stream(); }
|
|
|
Post by jamesbowman on May 13, 2016 9:44:29 GMT -8
|
|
|
Post by tftlcdcyg on May 13, 2016 15:38:43 GMT -8
THX. On gameduino 2 + arduino Due the new library GD2 runs ok! I'm still working on the wiring of FT813 + arduino Due. Maybe the cables are the problem.
|
|