I'm working on a display driver, and I got something working (I didn't work on it
for a while, but I posted images earlier).
The driver is basically working and I have tried all the existing widgets.
But I have some problems with setting colors. It somewhat works, but not always
and I'm trying to check what's wrong, so I'm back to a closer look at the documentation.
I have the following questions:
1. Page 14, there is a sample code which works fine. So I suppose it shows that
my implementation of the basic function wr8, wr16, wr32 and same for rd, work fine.
Now the next snippet, page 21 uses a "dl" function, without defining it anywhere
in the document. At least I didn't find it.
Is it right to assume that dl(val) means wr32(RAM_DL + offset, val);
2. I found some code on github, which is reported to work on many targets. And I had a look at
it to compare. As for changing colors, what I was doing is basically send the command
CMD_FGCOLOR, then send the color itself, so indeed there is something missing.
Looking at the code, it's like this:
Code: Select all
void EVE_cmd_bgcolor(uint32_t color)
{
if(!cmd_burst)
{
EVE_start_command(CMD_BGCOLOR);
spi_transmit((uint8_t)(color));
spi_transmit((uint8_t)(color >> 8));
spi_transmit((uint8_t)(color >> 16));
spi_transmit(0x00);
EVE_cs_clear();
}
}
Code: Select all
void EVE_start_command(uint32_t command)
{
uint32_t ftAddress;
ftAddress = REG_CMDB_WRITE;
EVE_cs_set();
spi_transmit((uint8_t)(ftAddress >> 16) | MEM_WRITE); /* send Memory Write plus high address byte */
spi_transmit((uint8_t)(ftAddress >> 8)); /* send middle address byte */
spi_transmit((uint8_t)(ftAddress)); /* send low address byte */
spi_transmit_32(command);
}
In summary, it will send:
// The second function
1. REG_CMDB_WRITE // 3 bytes
2. CMD_BBGCOLOR // 4 bytes
// The first function, upon return of the second one.
3. The color itself // 4 bytes (color itself followed by a 0)
So all together 11 bytes.
I checked on the scope, and the byte sequence is like this: (bit sequence represented in hexa)
chip_select falling edge
302578 FFFFFF0A 00FF00 00
chip_select rising edge
The 2 first numbers are the REG_CMDB_WRITE and CMD_BGCOLOR. The third one is green, and
there is a trailing 0.
Then after that, I have a line of buttons.
The buttons are drawn with the CMD_BUTTON command, and it works fine.
Their size, position are fine, only the foreground color (for the text) doesn't work,
I get white characters.
Does anybody know what happens? Is the above sequence wrong?
Thanks
R