Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Monochrome graphical display system

See Quick Start Guide for the mono graphics service.

This library provides an interface to drawing graphics on monochrome graphical displays

The graphics drivers consists of the following:

The generic drawing primitives is a library of functions for drawing graphics primitives such as lines, rectangles and circles. It uses other functions implemented by the display driver for drawing the primitives. The implementation of these functions can optionally be used by a display driver, but if the hardware of the display allows faster handling of any of the primitives, the display driver can implement it directly.

The display specific drivers provides an interface to the graphical display. It implements the low level communication with the display hardware, putting pixels on the display and drawing primitives such as lines, circles and rectangles. Depending on the display driver implementation, drawing the graphics primitives might be handled by the generic graphics drawing primitives rather than the display driver itself.

Examples

The following examples are available for the driver:

API Overview

Note
The functions in the library are not interrupt safe.

Modules

 2832HSWEG04 graphic library abstraction
 This module is an abstraction layer between the graphic library and the 2832HSWEG04 monochrome LCD display connected to a SSD1306 LCD controller.
 
 Generic monochrome graphic primitives
 This is a service providing generic implementations of graphic primitives.
 
 Framebuffer
 This module provides read/write from and to a framebuffer in RAM.
 
 GFX Mono Font Library
 This modules provides functionality for outputting a monochrome font to a display.
 

Typedefs

typedef uint8_t gfx_coord_t
 
typedef uint8_t gfx_mono_color_t
 

Enumerations

enum  gfx_mono_bitmap_type {
  GFX_MONO_BITMAP_RAM,
  GFX_MONO_BITMAP_PROGMEM
}
 Bitmap types. More...
 
enum  gfx_mono_color {
  GFX_PIXEL_CLR = 0,
  GFX_PIXEL_SET = 1,
  GFX_PIXEL_XOR = 2
}
 Pixel operations. More...
 

Circle Sector Definitions

#define GFX_OCTANT0   (1 << 0)
 Bitmask for drawing circle octant 0. More...
 
#define GFX_OCTANT1   (1 << 1)
 Bitmask for drawing circle octant 1. More...
 
#define GFX_OCTANT2   (1 << 2)
 Bitmask for drawing circle octant 2. More...
 
#define GFX_OCTANT3   (1 << 3)
 Bitmask for drawing circle octant 3. More...
 
#define GFX_OCTANT4   (1 << 4)
 Bitmask for drawing circle octant 4. More...
 
#define GFX_OCTANT5   (1 << 5)
 Bitmask for drawing circle octant 5. More...
 
#define GFX_OCTANT6   (1 << 6)
 Bitmask for drawing circle octant 6. More...
 
#define GFX_OCTANT7   (1 << 7)
 Bitmask for drawing circle octant 7. More...
 
#define GFX_QUADRANT0   (GFX_OCTANT0 | GFX_OCTANT1)
 Bitmask for drawing circle quadrant 0. More...
 
#define GFX_QUADRANT1   (GFX_OCTANT2 | GFX_OCTANT3)
 Bitmask for drawing circle quadrant 1. More...
 
#define GFX_QUADRANT2   (GFX_OCTANT4 | GFX_OCTANT5)
 Bitmask for drawing circle quadrant 2. More...
 
#define GFX_QUADRANT3   (GFX_OCTANT6 | GFX_OCTANT7)
 Bitmask for drawing circle quadrant 3. More...
 
#define GFX_LEFTHALF   (GFX_QUADRANT3 | GFX_QUADRANT0)
 Bitmask for drawing left half of circle. More...
 
#define GFX_TOPHALF   (GFX_QUADRANT0 | GFX_QUADRANT1)
 Bitmask for drawing top half of circle. More...
 
#define GFX_RIGHTHALF   (GFX_QUADRANT1 | GFX_QUADRANT2)
 Bitmask for drawing right half of circle. More...
 
#define GFX_BOTTOMHALF   (GFX_QUADRANT2 | GFX_QUADRANT3)
 Bitmask for drawing bottom half of circle. More...
 
#define GFX_WHOLE   0xFF
 Bitmask for drawing whole circle. More...
 

Graphic Drawing Primitives

#define gfx_mono_draw_horizontal_line(x, y, length, color)   gfx_mono_generic_draw_horizontal_line(x, y, length, color)
 Draw a horizontal line, one pixel wide. More...
 
#define gfx_mono_draw_vertical_line(x, y, length, color)   gfx_mono_generic_draw_vertical_line(x, y, length, color)
 Draw a vertical line, one pixel wide. More...
 
#define gfx_mono_draw_line(x1, y1, x2, y2, color)   gfx_mono_generic_draw_line(x1, y1, x2, y2, color)
 Draw a line between two arbitrary points. More...
 
#define gfx_mono_draw_rect(x, y, width, height, color)   gfx_mono_generic_draw_rect(x, y, width, height, color)
 Draw an outline of a rectangle. More...
 
#define gfx_mono_draw_filled_rect(x, y, width, height, color)
 Draw a filled rectangle. More...
 
#define gfx_mono_draw_circle(x, y, radius, color, octant_mask)
 Draw an outline of a circle or arc. More...
 
#define gfx_mono_draw_filled_circle(x, y, radius, color, quadrant_mask)
 Draw a filled circle or sector. More...
 

#define GFX_BOTTOMHALF   (GFX_QUADRANT2 | GFX_QUADRANT3)

Bitmask for drawing bottom half of circle.

#define GFX_LEFTHALF   (GFX_QUADRANT3 | GFX_QUADRANT0)

Bitmask for drawing left half of circle.

#define gfx_mono_draw_circle (   x,
  y,
  radius,
  color,
  octant_mask 
)
Value:
gfx_mono_generic_draw_circle(x, y, radius, color, \
octant_mask)
void gfx_mono_generic_draw_circle(gfx_coord_t x, gfx_coord_t y, gfx_coord_t radius, enum gfx_mono_color color, uint8_t octant_mask)
Draw an outline of a circle or arc (generic implementation).
Definition: gfx_mono_generic.c:301

Draw an outline of a circle or arc.

The radius is the distance from the center to the circumference, which means that the total width or height of a circle will be (radius*2+1).

The octant_mask parameter is a bitmask that decides which octants of the circle to draw. Use the GFX_OCTANTn, GFX_QUADRANTn, GFX_xHALF and GFX_WHOLE constants and OR them together if required. Radius equal to zero gives a single pixel.

Parameters
[in]xX coordinate of center.
[in]yY coordinate of center.
[in]radiusCircle radius in pixels.
[in]colorPixel operation.
[in]octant_maskBitmask indicating which octants to draw.
#define gfx_mono_draw_filled_circle (   x,
  y,
  radius,
  color,
  quadrant_mask 
)
Value:
color, quadrant_mask)
void gfx_mono_generic_draw_filled_circle(gfx_coord_t x, gfx_coord_t y, gfx_coord_t radius, enum gfx_mono_color color, uint8_t quadrant_mask)
Draw a filled circle or sector (generic implementation).
Definition: gfx_mono_generic.c:390

Draw a filled circle or sector.

The radius is the distance from the center to the circumference, which means that the total width or height of a circle will be (radius*2+1).

The quadrant_mask parameter is a bitmask that decides which quadrants of the circle to draw. Use the GFX_QUADRANTn, GFX_xHALF and GFX_WHOLE constants and OR them together if required. Radius equal to zero gives a single pixel.

Note
This function only supports quadrants while gfx_draw_circle() supports octants. This is to improve performance on drawing filled circles.
Parameters
[in]xX coordinate of center.
[in]yY coordinate of center.
[in]radiusCircle radius in pixels.
[in]colorPixel operation.
[in]quadrant_maskBitmask indicating which quadrants to draw.
#define gfx_mono_draw_filled_rect (   x,
  y,
  width,
  height,
  color 
)
Value:
gfx_mono_generic_draw_filled_rect(x, y, width, height, \
color)
void gfx_mono_generic_draw_filled_rect(gfx_coord_t x, gfx_coord_t y, gfx_coord_t width, gfx_coord_t height, enum gfx_mono_color color)
Draw a filled rectangle (generic implementation).
Definition: gfx_mono_generic.c:269

Draw a filled rectangle.

Parameters
[in]xX coordinate of the left side.
[in]yY coordinate of the top side.
[in]widthWidth of the rectangle.
[in]heightHeight of the rectangle.
[in]colorPixel operation of the line

Referenced by gfx_mono_draw_char(), main_task(), and terminal_task().

#define gfx_mono_draw_horizontal_line (   x,
  y,
  length,
  color 
)    gfx_mono_generic_draw_horizontal_line(x, y, length, color)

Draw a horizontal line, one pixel wide.

Parameters
[in]xX coordinate of leftmost pixel.
[in]yY coordinate of the line.
[in]lengthLength of the line in pixels.
[in]colorPixel operation of the line.

Referenced by gfx_mono_generic_draw_filled_rect(), gfx_mono_generic_draw_rect(), and main_task().

#define gfx_mono_draw_line (   x1,
  y1,
  x2,
  y2,
  color 
)    gfx_mono_generic_draw_line(x1, y1, x2, y2, color)

Draw a line between two arbitrary points.

Parameters
[in]x1Start X coordinate.
[in]y1Start Y coordinate.
[in]x2End X coordinate.
[in]y2End Y coordinate.
[in]colorPixel operation of the line.

Referenced by graph_task().

#define gfx_mono_draw_rect (   x,
  y,
  width,
  height,
  color 
)    gfx_mono_generic_draw_rect(x, y, width, height, color)

Draw an outline of a rectangle.

Parameters
[in]xX coordinate of the left side.
[in]yY coordinate of the top side.
[in]widthWidth of the rectangle.
[in]heightHeight of the rectangle.
[in]colorPixel operation of the line.

Referenced by main_task().

#define gfx_mono_draw_vertical_line (   x,
  y,
  length,
  color 
)    gfx_mono_generic_draw_vertical_line(x, y, length, color)

Draw a vertical line, one pixel wide.

Parameters
[in]xX coordinate of the line.
[in]yY coordinate of the topmost pixel.
[in]lengthLength of the line in pixels.
[in]colorPixel operation of the line.

Referenced by gfx_mono_generic_draw_filled_circle(), gfx_mono_generic_draw_rect(), graph_task(), and main_task().

#define GFX_OCTANT0   (1 << 0)

Bitmask for drawing circle octant 0.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT1   (1 << 1)

Bitmask for drawing circle octant 1.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT2   (1 << 2)

Bitmask for drawing circle octant 2.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT3   (1 << 3)

Bitmask for drawing circle octant 3.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT4   (1 << 4)

Bitmask for drawing circle octant 4.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT5   (1 << 5)

Bitmask for drawing circle octant 5.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT6   (1 << 6)

Bitmask for drawing circle octant 6.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_OCTANT7   (1 << 7)

Bitmask for drawing circle octant 7.

Referenced by gfx_mono_generic_draw_circle().

#define GFX_QUADRANT0   (GFX_OCTANT0 | GFX_OCTANT1)

Bitmask for drawing circle quadrant 0.

Referenced by gfx_mono_generic_draw_filled_circle().

#define GFX_QUADRANT1   (GFX_OCTANT2 | GFX_OCTANT3)

Bitmask for drawing circle quadrant 1.

Referenced by gfx_mono_generic_draw_filled_circle().

#define GFX_QUADRANT2   (GFX_OCTANT4 | GFX_OCTANT5)

Bitmask for drawing circle quadrant 2.

Referenced by gfx_mono_generic_draw_filled_circle().

#define GFX_QUADRANT3   (GFX_OCTANT6 | GFX_OCTANT7)

Bitmask for drawing circle quadrant 3.

Referenced by gfx_mono_generic_draw_filled_circle().

#define GFX_RIGHTHALF   (GFX_QUADRANT1 | GFX_QUADRANT2)

Bitmask for drawing right half of circle.

#define GFX_TOPHALF   (GFX_QUADRANT0 | GFX_QUADRANT1)

Bitmask for drawing top half of circle.

#define GFX_WHOLE   0xFF

Bitmask for drawing whole circle.

typedef uint8_t gfx_coord_t
typedef uint8_t gfx_mono_color_t

Bitmap types.

Enumerator
GFX_MONO_BITMAP_RAM 

Bitmap stored in SRAM.

GFX_MONO_BITMAP_PROGMEM 

Bitmap stored in progmem.

Pixel operations.

Enumerator
GFX_PIXEL_CLR 

Pixel is cleared.

GFX_PIXEL_SET 

Pixel is set on screen (OR)

GFX_PIXEL_XOR 

Pixel is XORed.