Hello,
i have implemented a "setPixel" function that uses the display_controller module and the sdram to write a pixel data in an sdram column using the "sdram_col_write" function. It works well but my problem is calculating the column index which is to be passed on to the function. Just like the one that is calculated when the "CMD_WRITE_LINE" command is sent to the display_controller_server.
start_row = (s.IP[image_no].start_used_words + line * s.IP[image_no].line_width_words) / SDRAM_ROW_WORDS;
start_col = ((s.IP[image_no].start_used_words + line * s.IP[image_no].line_width_words)*2) % SDRAM_COL_COUNT;
word_count = s.IP[image_no].line_width_words;
sdram_buffer_write_p(c_sdram, bank, start_row, start_col, word_count, buffer_pointer );
That always gets the column index 0.
With my knowledge of the sdram (PINOUT_V1_IS42S16400F, 4 Banks. Each Bank has 4096 Rows and 256 Columns. With each column entry of 2Bytes. ) i thought i was suppose to calculate the start_col as follows :
start_col = ((((s.IP[image_no].start_used_words + pix_row * s.IP[image_no].line_width_words)*2) % SDRAM_COL_COUNT) + pix_col) % SDRAM_COL_COUNT; // pix_col is column index = {0,..,479},pix_row={0-271}
But with that i get some funny behaviour like a line of the LCD (480 pixels) is not stored in the sdram contineously.
i.e. From left to right and top to bottom.
Can somebody please explain it to me how the "display_controller_image_write_line" writes in the sdram please?. I used it to initialize my 2 Frame buffers [480*272] in the sdram with a background color (0xFFFF).
I think thats where i am missing something
Thanks
Derick
Implementing a lcd-drawing library based on a setPixel that
-
- New User
- Posts: 2
- Joined: Sun Jun 09, 2013 12:55 pm
-
- Member
- Posts: 14
- Joined: Thu Oct 17, 2013 12:19 pm
If you are using display_controller_image_write_line, you need not worry about the computation of start row and column of the SDRAM location where the line of the image is written. This is the convenience of using display controller when dealing with images although it takes an additional logical core.
For each image, the SDRAM space is allocated by calling display_controller_register_image which takes the number of lines and columns (in words) of the image and returns a handle. For reading and writing a particular line of the image thereafter, only the line number is passed. The display controller in turn computes the start row and column of that line in the SDRAM space and passes them to SDRAM server.
For each image, the SDRAM space is allocated by calling display_controller_register_image which takes the number of lines and columns (in words) of the image and returns a handle. For reading and writing a particular line of the image thereafter, only the line number is passed. The display controller in turn computes the start row and column of that line in the SDRAM space and passes them to SDRAM server.