841
Discussion - Software / Re: FT813 how to update a portion of a display
« on: April 27, 2018, 01:08:47 pm »
Hi,
Each part is saved in a similar way. For example, as shown below we create 2 static sections.
Your code should keep a note of StaticLocation1, Static1Length, StaticLocation2, Static2Length, as these are required when recalling the sections with Append.
Ensure that the saved sections don't overlap. You can assure this by taking account the size of each static section (e.g. end of static section1 would be StaticLocation1 + Static1Length)
We have an example in the application note below (see 4.3.2 onwards) where we make a chart using 2 static sections (a background and a scale) and then add the line. This is in Arduino format but uses the same techniques.
http://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/Modules/EVE/AN_356-FT800-Interfacing-I2C-Sensor-to-VM800P.pdf
Regards, FTDI Community
Each part is saved in a similar way. For example, as shown below we create 2 static sections.
Code: [Select]
void initMainStaticBackground1(void)
{
//########### Await FIFO Empty ###########
WaitCmdFifoEmpty(); //wait for FIFO read/write
//########### Create the static list in CMD FIFO ###########
ft813memWrite32(RAM_CMD + cmdOffset, (CMD_DLSTART)); // Start the display list
cmdOffset = incCMDOffset(cmdOffset, 4);
[Your other commands here]
[Not including CLEAR(1,1,1) or DISPLAY or SWAP]
//########### Execute the commands to make the display list in RAM_DL ###########
ft813memWrite16(REG_CMD_WRITE, (cmdOffset)); // Update the ring buffer pointer so the graphics processor starts executing
//########### Await completion ###########
WaitCmdFifoEmpty();
//########### Find the end of the new DL ###########
Static1Length = ft813memRead16(REG_CMD_DL);
//########### Copy the created DL into RAM_G @ address 4000 in this case ###########
// Could use your command
// ft813memWrite32(RAM_CMD + cmdOffset, CMD_MEMCPY(4000L, RAM_DL, dloffset));
// instead of this code below
ft813memWrite32(RAM_CMD + cmdOffset, CMD_MEMCPY);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, StaticLocation1);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, RAM_DL);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, Static1Length);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite16(REG_CMD_WRITE, (cmdOffset));
WaitCmdFifoEmpty();
//########### Your static part of the list will now be available ###########
}
void initMainStaticBackground2(void)
{
//########### Await FIFO Empty ###########
WaitCmdFifoEmpty(); //wait for FIFO read/write
//########### Create the static list in CMD FIFO ###########
ft813memWrite32(RAM_CMD + cmdOffset, (CMD_DLSTART)); // Start the display list
cmdOffset = incCMDOffset(cmdOffset, 4);
[Your other commands here]
[Not including CLEAR(1,1,1) or DISPLAY or SWAP]
//########### Execute the commands to make the display list in RAM_DL ###########
ft813memWrite16(REG_CMD_WRITE, (cmdOffset)); // Update the ring buffer pointer so the graphics processor starts executing
//########### Await completion ###########
WaitCmdFifoEmpty();
//########### Find the end of the new DL ###########
Static2Length= ft813memRead16(REG_CMD_DL);
//########### Copy the created DL into RAM_G @ address 4000 in this case ###########
// Could use your command
// ft813memWrite32(RAM_CMD + cmdOffset, CMD_MEMCPY(4000L, RAM_DL, dloffset));
// instead of this code below
ft813memWrite32(RAM_CMD + cmdOffset, CMD_MEMCPY);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, StaticLocation2);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, RAM_DL);
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite32(RAM_CMD + cmdOffset, Static2Length)
cmdOffset = incCMDOffset(cmdOffset, 4);
ft813memWrite16(REG_CMD_WRITE, (cmdOffset));
WaitCmdFifoEmpty();
//########### Your static part of the list will now be available ###########
}
Your code should keep a note of StaticLocation1, Static1Length, StaticLocation2, Static2Length, as these are required when recalling the sections with Append.
Ensure that the saved sections don't overlap. You can assure this by taking account the size of each static section (e.g. end of static section1 would be StaticLocation1 + Static1Length)
We have an example in the application note below (see 4.3.2 onwards) where we make a chart using 2 static sections (a background and a scale) and then add the line. This is in Arduino format but uses the same techniques.
http://brtchip.com/wp-content/uploads/Support/Documentation/Application_Notes/Modules/EVE/AN_356-FT800-Interfacing-I2C-Sensor-to-VM800P.pdf
Regards, FTDI Community