Microchip® Advanced Software Framework

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages

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.

Functions

void gfx_mono_framebuffer_draw_pixel (gfx_coord_t x, gfx_coord_t y, gfx_mono_color_t color)
 Draw pixel to framebuffer. More...
 
uint8_t gfx_mono_framebuffer_get_byte (gfx_coord_t page, gfx_coord_t column)
 Get a byte from the framebuffer. More...
 
void gfx_mono_framebuffer_get_page (gfx_mono_color_t *data, gfx_coord_t page, gfx_coord_t page_offset, gfx_coord_t width)
 Read a page from the framebuffer. More...
 
uint8_t gfx_mono_framebuffer_get_pixel (gfx_coord_t x, gfx_coord_t y)
 Get the pixel value at x,y in framebuffer. More...
 
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. More...
 
void gfx_mono_framebuffer_put_byte (gfx_coord_t page, gfx_coord_t column, uint8_t data)
 Put a byte to the framebuffer. More...
 
void gfx_mono_framebuffer_put_page (gfx_mono_color_t *data, gfx_coord_t page, gfx_coord_t page_offset, gfx_coord_t width)
 Put a page from RAM to the framebuffer. More...
 
void gfx_mono_set_framebuffer (uint8_t *framebuffer)
 

void gfx_mono_framebuffer_draw_pixel ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_mono_color_t  color 
)

Draw pixel to framebuffer.

Parameters
xX coordinate of the pixel
yY coordinate of the pixel
colorPixel operation

References gfx_mono_framebuffer_get_byte(), gfx_mono_framebuffer_put_byte(), GFX_MONO_LCD_HEIGHT, 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.

Parameters
pagePage address
columnPage offset (x coordinate)
Returns
data from LCD controller or framebuffer.

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(), gfx_mono_ssd1306_put_byte(), and gfx_mono_st7565r_get_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.

Parameters
dataPointer where to store the read data
pagePage address
columnOffset into page (x coordinate)
widthNumber of bytes to be read

The following example will read back the first 128 bytes (first page) from the framebuffer:

gfx_mono_framebuffer_get_page(read_buffer, 0, 0, 128);

References fbpointer, and GFX_MONO_LCD_WIDTH.

Referenced by gfx_mono_ssd1306_get_page(), and gfx_mono_st7565r_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.

Parameters
xX coordinate of pixel
yY coordinate of pixel
Returns
Non zero value if pixel is set.

References gfx_mono_framebuffer_get_byte(), GFX_MONO_LCD_HEIGHT, 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.

Parameters
pagePage address
columnPage offset (x coordinate)
pixel_maskMask for pixel operation
colorPixel 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, GFX_PIXEL_XOR, and temp.

void gfx_mono_framebuffer_put_byte ( gfx_coord_t  page,
gfx_coord_t  column,
uint8_t  data 
)

Put a byte to the framebuffer.

Parameters
pagePage address
columnPage offset (x coordinate)
dataData to be written

This example will put the value 0xFF to the first byte in the framebuffer

References data, fbpointer, and GFX_MONO_LCD_WIDTH.

Referenced by gfx_mono_framebuffer_draw_pixel(), gfx_mono_ssd1306_put_byte(), and gfx_mono_st7565r_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.

Parameters
dataPointer to data to be written
pagePage address
columnOffset into page (x coordinate)
widthNumber 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).

gfx_mono_framebuffer_put_page(data_buf, 0, 10, 32);

References data, fbpointer, and GFX_MONO_LCD_WIDTH.

Referenced by gfx_mono_ssd1306_put_page(), and gfx_mono_st7565r_put_page().

void gfx_mono_set_framebuffer ( uint8_t *  framebuffer)