Skip to content
Snippets Groups Projects
Commit 5f851420 authored by q3k's avatar q3k
Browse files

epicardium/modules/display: use struct disp_frambuffer.

parent 4012a451
No related branches found
No related tags found
No related merge requests found
Pipeline #1552 passed
......@@ -266,6 +266,37 @@ enum disp_fillstyle {
FILLSTYLE_FILLED = 1
};
/** Width of display in pixels */
#define DISP_WIDTH 160
/** Height of display in pixels */
#define DISP_HEIGHT 80
/** Raw framebuffer */
struct disp_framebuffer {
/**
* The frambuffer stores pixels as RGB565, but byte swapped.
* That is, for every (x, y) coordinate, there are two uint8_ts
* storing 16 bits of pixel data.
*
* **Example: fill framebuffer with red**:
*
* .. code-block:: cpp
*
* struct disp_framebuffer *fb = epic_disp_framebuffer();
* uint16_t red = 0b1111100000000000;
* for (int y = 0; y < DISP_HEIGHT; y++) {
* for (int x = 0; x < DISP_WIDTH; x++) {
* fb->fb[y][x][0] = red >> 8;
* fb->fb[y][x][1] = red & 0xFF;
* }
* }
* epic_disp_update();
*
*/
uint8_t fb[DISP_HEIGHT][DISP_WIDTH][2];
};
/**
* Locks the display.
*
......@@ -413,8 +444,10 @@ API(API_DISP_CIRC,
/**
* Returns the back framebuffer (the display buffer that's currently inactive
* that will be shown after the next call to ``epic_disp_update``.
*
* :returns: pointer to a framebuffer
*/
API(API_DISP_FRAMEBUFFER, uint16_t *epic_disp_framebuffer());
API(API_DISP_FRAMEBUFFER, struct disp_framebuffer *epic_disp_framebuffer());
/**
......
......@@ -125,9 +125,9 @@ int epic_disp_update()
}
}
uint16_t *epic_disp_framebuffer()
struct disp_framebuffer *epic_disp_framebuffer()
{
return (uint16_t*) LCD_Framebuffer();
return (struct disp_framebuffer*)LCD_Framebuffer();
}
int epic_disp_open()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment