Hello!
Thanks for your reply.
Yes, that's right, I just want to know how to use the coprocessor to write a single slider.
When I set to COP_SLIDER = 0, it works fine, I get a blue screen with a white rectangle.
I can also draw sliders myself, and that's what I did in the first version of my current software.
It was working well, but it's always difficult to get fancy effects, so I would like to upgrade
my software so that it now uses the coprocessor widgets (for instance in the present case,
a single slider).
CMD_DL_START // Tells co-pro to begin writing DL at RAM_DL+0
OK, I have added wr32(RAM_DL, CMD_DLSTART);, exactly as if I was writing direcly to the
non-coprocessor area.
CLEAR_COLOR_RGB // Co-processor writes this instruction to the DL
CLEAR(1,1,1) // Co-processor writes this instruction to the DL
So you mean I don't have to write anything myself? If the coprocessor writes these 2 instructions,
then I have to leave room for these instructions, and then at the end I will write the instructions at offset 8
(4 for clear_color + 4 for clerar(1,1,1)?
#co-pro commands
Color_RGB(0,0,255)
Point_Size(20)
Begin(Points)
Vertex2F(0,0)
I don't understand this part. What does it do? Do I need it to draw a slider? It looks like it will draw a point.
Is it written in RAM_CMD or RAM_DL? I can write RGB(0,0,255) directly to RAM_DL, so it doesn't look like a
coprocessor command. In my snippet below I
#end procedure
End()
Is this End() to be written to the DL memory? If yes, at which offset? Last time I wrote was at offset 8, is it 12 now?
Similarily as before:
DISPLAY // Co-processor writes this instruction to the DL
CMD_SWAP // Co-processor writes REG_DL_SWAP
Do I have to do anything here?
[update REG_CMD_WRITE to point to end of new commands]
How do I do that? I can read where the REG_CMD_WRITE is by rd16(REG_CMD_WRITE + RAM_REG);
but what should I do with the value?
I replaced the DL part with the code found at 2.5.1 in FT81X documentation. I get the FTDI logo on black background.
Same as before, it works with COP_SLIDER = 0, not yet with 1. I guess the missing part is the REG_CMD_WRITE
stuff, but I'm stuck...
Thanks for any hint!
R
#define COP_SLIDER 1
void FT813::Test(void) {
#if COP_SLIDER
// Offsets come from BridgeTek's programmers guide, version 1.2, page 204.
// Start procedure
wr32(RAM_DL, CMD_DLSTART);
wr32(RAM_DL + 4, CLEAR_COLOR_RGB(0x30, 0x60, 0x90));
wr32(RAM_DL + 8, CLEAR(1, 1, 1));
// Coprocessor commands
wr32(RAM_CMD, CMD_SLIDER); // Command offset is 0
wr16(RAM_CMD + 4, 32); // X
wr16(RAM_CMD + 6, 32); // Y
wr16(RAM_CMD + 8, 320); // W
wr16(RAM_CMD + 10, 32); // H
wr16(RAM_CMD + 12, 0); // Options (default is 0)
wr16(RAM_CMD + 14, 100); // Val
wr16(RAM_CMD + 16, 40); // Size (width of the knob??)
wr16(RAM_CMD + 18, 300); // Range
// End procedure
wr32(RAM_DL+12, END());
wr32(RAM_DL+16, DISPLAY());
wr8(REG_DLSWAP, DLSWAP_FRAME); // Display list swap
#else
wr32(RAM_DL, CLEAR_COLOR_RGB(0, 0, 0));
wr32(RAM_DL + 4, CLEAR(1, 1, 1)); // clear screen
wr32(RAM_DL + 8, BEGIN(BITMAPS)); // start drawing bitmaps
wr32(RAM_DL + 12, VERTEX2II(220, 110, 31, 'F')); // ascii F in font 31
wr32(RAM_DL + 16, VERTEX2II(244, 110, 31, 'T')); // ascii T
wr32(RAM_DL + 20, VERTEX2II(270, 110, 31, 'D')); // ascii D
wr32(RAM_DL + 24, VERTEX2II(299, 110, 31, 'I')); // ascii I
wr32(RAM_DL + 28, END());
wr32(RAM_DL + 32, COLOR_RGB(160, 22, 22)); // change colour to red
wr32(RAM_DL + 36, POINT_SIZE(320)); // set point size to 20 pixels in radius
wr32(RAM_DL + 40, BEGIN(POINTS)); // start drawing points
wr32(RAM_DL + 44, VERTEX2II(192, 133, 0, 0)); // red point
wr32(RAM_DL + 48, END());
wr32(RAM_DL + 52, DISPLAY()); // display the image
wr8(REG_DLSWAP, DLSWAP_FRAME);
#endif
}