This module provides read/write from and to a framebuffer in RAM.
This is needed when using a controller that does not provide a way to read back data from the LCD controller memory. In this case we need to buffer the data in a local framebuffer to allow manipulation on pixel level. It is generally not recommended to access the framebuffer directly; this is handled by the graphic driver when needed.
void gfx_mono_framebuffer_draw_pixel | ( | gfx_coord_t | x, |
gfx_coord_t | y, | ||
gfx_mono_color_t | color | ||
) |
Draw pixel to framebuffer.
[in] | x | X coordinate of the pixel |
[in] | y | Y coordinate of the pixel |
[in] | color | Pixel operation |
References gfx_mono_framebuffer_get_byte(), gfx_mono_framebuffer_put_byte(), GFX_MONO_LCD_PIXELS_PER_BYTE, GFX_MONO_LCD_WIDTH, GFX_PIXEL_CLR, GFX_PIXEL_SET, and GFX_PIXEL_XOR.
uint8_t gfx_mono_framebuffer_get_byte | ( | gfx_coord_t | page, |
gfx_coord_t | column | ||
) |
Get a byte from the framebuffer.
[in] | page | Page address |
[in] | column | Page offset (x coordinate) |
The following code will read the first byte of the framebuffer
References fbpointer, and GFX_MONO_LCD_WIDTH.
Referenced by gfx_mono_framebuffer_draw_pixel(), gfx_mono_framebuffer_get_pixel(), gfx_mono_ssd1306_get_byte(), and gfx_mono_ssd1306_put_byte().
void gfx_mono_framebuffer_get_page | ( | gfx_mono_color_t * | data, |
gfx_coord_t | page, | ||
gfx_coord_t | column, | ||
gfx_coord_t | width | ||
) |
Read a page from the framebuffer.
[in] | data | Pointer where to store the read data |
[in] | page | Page address |
[in] | column | Offset into page (x coordinate) |
[in] | width | Number of bytes to be read |
The following example will read back the first 128 bytes (first page) from the framebuffer:
References fbpointer, and GFX_MONO_LCD_WIDTH.
Referenced by gfx_mono_ssd1306_get_page().
uint8_t gfx_mono_framebuffer_get_pixel | ( | gfx_coord_t | x, |
gfx_coord_t | y | ||
) |
Get the pixel value at x,y in framebuffer.
[in] | x | X coordinate of pixel |
[in] | y | Y coordinate of pixel |
References gfx_mono_framebuffer_get_byte(), GFX_MONO_LCD_PIXELS_PER_BYTE, and GFX_MONO_LCD_WIDTH.
void gfx_mono_framebuffer_mask_byte | ( | gfx_coord_t | page, |
gfx_coord_t | column, | ||
gfx_mono_color_t | pixel_mask, | ||
gfx_mono_color_t | color | ||
) |
Read/Modify/Write a byte in the framebuffer.
This function will read the byte from the framebuffer and do a mask operation on the byte according to the pixel operation selected by the color argument and the pixel mask provided.
[in] | page | Page address |
[in] | column | Page offset (x coordinate) |
[in] | pixel_mask | Mask for pixel operation |
[in] | color | Pixel operation |
A small example that will XOR the first byte of the framebuffer with 0xAA
References gfx_mono_get_byte, gfx_mono_put_byte, GFX_PIXEL_CLR, GFX_PIXEL_SET, and GFX_PIXEL_XOR.
void gfx_mono_framebuffer_put_byte | ( | gfx_coord_t | page, |
gfx_coord_t | column, | ||
uint8_t | data | ||
) |
Put a byte to the framebuffer.
[in] | page | Page address |
[in] | column | Page offset (x coordinate) |
[in] | data | Data to be written |
This example will put the value 0xFF to the first byte in the framebuffer
References fbpointer, and GFX_MONO_LCD_WIDTH.
Referenced by gfx_mono_framebuffer_draw_pixel(), and gfx_mono_ssd1306_put_byte().
void gfx_mono_framebuffer_put_page | ( | gfx_mono_color_t * | data, |
gfx_coord_t | page, | ||
gfx_coord_t | column, | ||
gfx_coord_t | width | ||
) |
Put a page from RAM to the framebuffer.
[in] | data | Pointer to data to be written |
[in] | page | Page address |
[in] | column | Offset into page (x coordinate) |
[in] | width | Number of bytes to be written. |
The following example will write 32 bytes from data_buf to the page 0, column 10 (byte 10 to 42 in the framebuffer).
References fbpointer, and GFX_MONO_LCD_WIDTH.
Referenced by gfx_mono_ssd1306_put_page().
void gfx_mono_set_framebuffer | ( | uint8_t * | framebuffer | ) |
Set the LCD framebuffer.
[in] | framebuffer | A pointer to an allocated area of RAM that can hold the framebuffer. |
A small example:
References fbpointer, and framebuffer.
Referenced by gfx_mono_ssd1306_init().