Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
C12832_A1Z graphic library abstraction

This module is an abstraction layer between the graphic library and the C12832_A1Z monochrome LCD display connected to a ST7565R LCD controller.

As the controller does not provide any hardware accelerated graphic, all the graphic primitives are provided by the Generic monochrome graphic primitives service.

Note
Do not call the gfx_mono_st7565r_ functions directly. use the gfx_mono names that are defined in this header and documented in Monochrome graphical display system . Ie. gfx_mono_draw_pixel() should be used, not gfx_mono_st7565r_draw_pixel()

Macros

#define gfx_mono_draw_pixel(x, y, color)   gfx_mono_st7565r_draw_pixel(x, y, color)
 
#define gfx_mono_get_byte(page, column)   gfx_mono_st7565r_get_byte(page, column)
 
#define gfx_mono_get_page(data, page, column, width)   gfx_mono_st7565r_get_page(data, page, column, width)
 
#define gfx_mono_get_pixel(x, y)   gfx_mono_st7565r_get_pixel(x, y)
 
#define gfx_mono_init()   gfx_mono_st7565r_init()
 
#define GFX_MONO_LCD_FRAMEBUFFER_SIZE
 
#define GFX_MONO_LCD_HEIGHT   32
 
#define GFX_MONO_LCD_PAGES
 
#define GFX_MONO_LCD_PIXELS_PER_BYTE   8
 
#define GFX_MONO_LCD_WIDTH   128
 
#define gfx_mono_mask_byte(page, column, pixel_mask, color)   gfx_mono_st7565r_mask_byte(page, column, pixel_mask, color)
 
#define gfx_mono_put_bitmap(bitmap, x, y)   gfx_mono_generic_put_bitmap(bitmap, x, y)
 
#define gfx_mono_put_byte(page, column, data)   gfx_mono_st7565r_put_byte(page, column, data)
 
#define gfx_mono_put_framebuffer()   gfx_mono_st7565r_put_framebuffer()
 
#define gfx_mono_put_page(data, page, column, width)   gfx_mono_st7565r_put_page(data, page, column, width)
 

Functions

void gfx_mono_st7565r_draw_pixel (gfx_coord_t x, gfx_coord_t y, gfx_mono_color_t color)
 Draw pixel to screen. More...
 
uint8_t gfx_mono_st7565r_get_byte (gfx_coord_t page, gfx_coord_t column)
 Get a byte from the display controller RAM. More...
 
void gfx_mono_st7565r_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 LCD controller. More...
 
uint8_t gfx_mono_st7565r_get_pixel (gfx_coord_t x, gfx_coord_t y)
 Get the pixel value at x,y. More...
 
void gfx_mono_st7565r_init (void)
 Initialize ST7565R controller and LCD display. More...
 
void gfx_mono_st7565r_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 on the display controller. More...
 
void gfx_mono_st7565r_put_byte (gfx_coord_t page, gfx_coord_t column, uint8_t data)
 Put a byte to the display controller RAM. More...
 
void gfx_mono_st7565r_put_framebuffer (void)
 Put framebuffer to LCD controller. More...
 
void gfx_mono_st7565r_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 display controller. More...
 

#define gfx_mono_get_page (   data,
  page,
  column,
  width 
)    gfx_mono_st7565r_get_page(data, page, column, width)

Referenced by gfx_mono_screen_dump().

#define gfx_mono_get_pixel (   x,
 
)    gfx_mono_st7565r_get_pixel(x, y)
#define gfx_mono_init ( )    gfx_mono_st7565r_init()

Referenced by main().

#define GFX_MONO_LCD_FRAMEBUFFER_SIZE
Value:
#define GFX_MONO_LCD_PIXELS_PER_BYTE
Definition: gfx_mono_c12832_a1z.h:63
#define GFX_MONO_LCD_WIDTH
Definition: gfx_mono_c12832_a1z.h:61
#define GFX_MONO_LCD_HEIGHT
Definition: gfx_mono_c12832_a1z.h:62
#define GFX_MONO_LCD_PAGES
Value:
#define GFX_MONO_LCD_PIXELS_PER_BYTE
Definition: gfx_mono_c12832_a1z.h:63
#define GFX_MONO_LCD_HEIGHT
Definition: gfx_mono_c12832_a1z.h:62

Referenced by gfx_mono_st7565r_init(), and gfx_mono_st7565r_put_framebuffer().

#define gfx_mono_mask_byte (   page,
  column,
  pixel_mask,
  color 
)    gfx_mono_st7565r_mask_byte(page, column, pixel_mask, color)
#define gfx_mono_put_bitmap (   bitmap,
  x,
 
)    gfx_mono_generic_put_bitmap(bitmap, x, y)
#define gfx_mono_put_framebuffer ( )    gfx_mono_st7565r_put_framebuffer()
#define gfx_mono_put_page (   data,
  page,
  column,
  width 
)    gfx_mono_st7565r_put_page(data, page, column, width)

void gfx_mono_st7565r_draw_pixel ( gfx_coord_t  x,
gfx_coord_t  y,
gfx_coord_t  color 
)

Draw pixel to screen.

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

The following will set the pixel at x=10,y=10:

The following example will clear the pixel at x=10,y=10:

And the following will toggle the pixel at x=10,y=10:

References gfx_mono_get_byte, GFX_MONO_LCD_HEIGHT, GFX_MONO_LCD_PIXELS_PER_BYTE, GFX_MONO_LCD_WIDTH, gfx_mono_put_byte, GFX_PIXEL_CLR, GFX_PIXEL_SET, and GFX_PIXEL_XOR.

uint8_t gfx_mono_st7565r_get_byte ( gfx_coord_t  page,
gfx_coord_t  column 
)

Get a byte from the display controller RAM.

If the LCD controller is accessed by the SPI interface we cannot read the data. In this case return the data from the local framebuffer instead.

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

The following code will read the first byte from the display memory or the local framebuffer if direct read is not possible. The data represents the pixels from x = 0 and y = 0 to y = 7.

References gfx_mono_framebuffer_get_byte(), st7565r_read_data(), st7565r_set_column_address(), and st7565r_set_page_address().

void gfx_mono_st7565r_get_page ( gfx_mono_color_t data,
gfx_coord_t  page,
gfx_coord_t  column,
gfx_coord_t  width 
)

Read a page from the LCD controller.

If the LCD controller is accessed by the SPI interface we cannot read data directly from the controller. In that case we will read the data from the local framebuffer instead.

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 display memory:

gfx_mono_st7565r_get_page(read_buffer, 0, 0, 128);

References gfx_mono_framebuffer_get_page(), st7565r_read_data(), st7565r_set_column_address(), and st7565r_set_page_address().

uint8_t gfx_mono_st7565r_get_pixel ( gfx_coord_t  x,
gfx_coord_t  y 
)

Get the pixel value at x,y.

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

The following example will read the pixel value from x=10,y=10:

pixelval = gfx_mono_st7565r_get_pixel(10,10);

References gfx_mono_get_byte, GFX_MONO_LCD_HEIGHT, GFX_MONO_LCD_PIXELS_PER_BYTE, and GFX_MONO_LCD_WIDTH.

void gfx_mono_st7565r_init ( void  )

Initialize ST7565R controller and LCD display.

It will also write the graphic controller RAM to all zeroes.

Note
This function will clear the contents of the display.

References framebuffer, GFX_MONO_LCD_PAGES, GFX_MONO_LCD_WIDTH, gfx_mono_put_byte, gfx_mono_set_framebuffer(), st7565r_init(), and st7565r_set_display_start_line_address().

void gfx_mono_st7565r_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 on the display controller.

This function will read the byte from the display controller (or the framebuffer if we cannot read directly from the controller) 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 display memory with 0xAA

References gfx_mono_get_byte, gfx_mono_put_byte, GFX_PIXEL_CLR, GFX_PIXEL_SET, and GFX_PIXEL_XOR.

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

Put a byte to the display controller RAM.

If the LCD controller is accessed by the SPI interface we will also put the data to the local 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 display memory setting a 8 pixel high column of pixels in the upper left corner of the display.

References gfx_mono_framebuffer_put_byte(), st7565r_set_column_address(), st7565r_set_page_address(), and st7565r_write_data().

void gfx_mono_st7565r_put_framebuffer ( void  )

Put framebuffer to LCD controller.

This function will output the complete framebuffer from RAM to the LCD controller.

Note
This is done automatically if using the graphic primitives. Only needed if you are manipulating the framebuffer directly in your code.

References framebuffer, GFX_MONO_LCD_PAGES, GFX_MONO_LCD_WIDTH, gfx_mono_st7565r_put_page(), st7565r_set_column_address(), and st7565r_set_page_address().

void gfx_mono_st7565r_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 display controller.

If the controller is accessed by the SPI interface, we can not read back data from the LCD controller RAM. Because of this all data that is written to the LCD controller in this mode is also written to a framebuffer in MCU RAM.

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. This will place data_buf in the rectangle x1=10,y1=0,x2=42,y2=8 (10 pixels from the upper left corner of the screen):

gfx_mono_st7565r_put_page(data_buf, 0, 10, 32);

References gfx_mono_framebuffer_put_page(), st7565r_set_column_address(), st7565r_set_page_address(), and st7565r_write_data().

Referenced by gfx_mono_st7565r_put_framebuffer().