nRF5 SDK v13.0.0
Modules | Data Structures | Typedefs | Functions

Module for drawing graphical objects like lines, circles, and rectangles. Provides support for different fonts. More...

Modules

 Macros for defining new graphic objects
 
 GFX module configuration
 
 LCD Library
 This module defines generic API for LCDs.
 
 Font header
 Generated font structures.
 

Data Structures

struct  nrf_gfx_point_t
 GFX point object structure. More...
 
struct  nrf_gfx_line_t
 GFX line object structure. More...
 
struct  nrf_gfx_circle_t
 GFX circle object structure. More...
 
struct  nrf_gfx_rect_t
 GFX rectangle object structure. More...
 

Typedefs

typedef FONT_INFO nrf_gfx_font_desc_t
 Font descriptor type.
 

Functions

ret_code_t nrf_gfx_init (nrf_lcd_t const *p_instance)
 Function for initializing the GFX library. More...
 
void nrf_gfx_uninit (nrf_lcd_t const *p_instance)
 Function for uninitializing the GFX library. More...
 
void nrf_gfx_point_draw (nrf_lcd_t const *p_instance, nrf_gfx_point_t const *p_point, uint32_t color)
 Function for drawing a point. More...
 
ret_code_t nrf_gfx_line_draw (nrf_lcd_t const *p_instance, nrf_gfx_line_t const *p_line, uint32_t color)
 Function for drawing a line. More...
 
ret_code_t nrf_gfx_circle_draw (nrf_lcd_t const *p_instance, nrf_gfx_circle_t const *p_circle, uint32_t color, bool fill)
 Function for drawing a circle. More...
 
ret_code_t nrf_gfx_rect_draw (nrf_lcd_t const *p_instance, nrf_gfx_rect_t const *p_rect, uint16_t thickness, uint32_t color, bool fill)
 Function for drawing a rectangle. More...
 
void nrf_gfx_screen_fill (nrf_lcd_t const *p_instance, uint32_t color)
 Function for filling the screen with selected color. More...
 
ret_code_t nrf_gfx_bmp565_draw (nrf_lcd_t const *p_instance, nrf_gfx_rect_t const *p_rect, uint16_t const *img_buf)
 Function for drawing an image from a .bmp file. More...
 
void nrf_gfx_background_set (nrf_lcd_t const *p_instance, uint16_t const *img_buf)
 Function for drawing an image from a .bmp file. More...
 
void nrf_gfx_display (nrf_lcd_t const *p_instance)
 Function for displaying data from an internal frame buffer. More...
 
void nrf_gfx_rotation_set (nrf_lcd_t const *p_instance, nrf_lcd_rotation_t rotation)
 Function for setting screen rotation. More...
 
void nrf_gfx_invert (nrf_lcd_t const *p_instance, bool invert)
 Function for setting inversion of colors. More...
 
ret_code_t nrf_gfx_print (nrf_lcd_t const *p_instance, nrf_gfx_point_t const *p_point, uint16_t font_color, const char *p_string, const nrf_gfx_font_desc_t *p_font, bool wrap)
 Function for printing a string to the screen. More...
 
uint16_t nrf_gfx_height_get (nrf_lcd_t const *p_instance)
 Function for getting the height of the screen. More...
 
uint16_t nrf_gfx_width_get (nrf_lcd_t const *p_instance)
 Function for getting the width of the screen. More...
 

Detailed Description

Module for drawing graphical objects like lines, circles, and rectangles. Provides support for different fonts.

Function Documentation

void nrf_gfx_background_set ( nrf_lcd_t const *  p_instance,
uint16_t const *  img_buf 
)

Function for drawing an image from a .bmp file.

Data in img_buf is expected to be stored in 2-byte samples, little endianness, RGB565 format. Pointer should skip the header and point to the first byte of data.

Parameters
[in]p_instancePointer to the LCD instance.
[in]img_bufPointer to data from the .bmp file.
Note
Only compatible with displays that accept pixels in RGB565 format.
ret_code_t nrf_gfx_bmp565_draw ( nrf_lcd_t const *  p_instance,
nrf_gfx_rect_t const *  p_rect,
uint16_t const *  img_buf 
)

Function for drawing an image from a .bmp file.

Data in img_buf is expected to be stored in 2-byte samples, little endianness, RGB565 format. Pointer should skip the header and point to the first byte of data.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_rectPointer to the rectangle object.
[in]img_bufPointer to data from the .bmp file.
Note
Only compatible with displays that accept pixels in RGB565 format.
ret_code_t nrf_gfx_circle_draw ( nrf_lcd_t const *  p_instance,
nrf_gfx_circle_t const *  p_circle,
uint32_t  color,
bool  fill 
)

Function for drawing a circle.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_circlePointer to the circle object.
[in]colorColor of the object in the display accepted format.
[in]fillIf true, the circle will be filled.
Return values
NRF_ERROR_INVALID_PARAMIf object position is not on the screen.
NRF_SUCCESSIf object was successfully drawn.
Note
The height and width of the drawn circle are determined by: radius * 2 + 1.
void nrf_gfx_display ( nrf_lcd_t const *  p_instance)

Function for displaying data from an internal frame buffer.

Parameters
[in]p_instancePointer to the LCD instance.
uint16_t nrf_gfx_height_get ( nrf_lcd_t const *  p_instance)

Function for getting the height of the screen.

Parameters
[in]p_instancePointer to the LCD instance.
ret_code_t nrf_gfx_init ( nrf_lcd_t const *  p_instance)

Function for initializing the GFX library.

Parameters
[in]p_instancePointer to the LCD instance.
Returns
Values returned by nrf_lcd_t::lcd_init.
void nrf_gfx_invert ( nrf_lcd_t const *  p_instance,
bool  invert 
)

Function for setting inversion of colors.

Parameters
[in]p_instancePointer to the LCD instance.
[in]invertIf true, inversion will be set.
ret_code_t nrf_gfx_line_draw ( nrf_lcd_t const *  p_instance,
nrf_gfx_line_t const *  p_line,
uint32_t  color 
)

Function for drawing a line.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_linePointer to the line object.
[in]colorColor of the object in the display accepted format.
Return values
NRF_ERROR_INVALID_PARAMIf object position is not on the screen.
NRF_SUCCESSIf object was successfully drawn.
void nrf_gfx_point_draw ( nrf_lcd_t const *  p_instance,
nrf_gfx_point_t const *  p_point,
uint32_t  color 
)

Function for drawing a point.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_pointPointer to the point object.
[in]colorColor of the object in the display accepted format.
ret_code_t nrf_gfx_print ( nrf_lcd_t const *  p_instance,
nrf_gfx_point_t const *  p_point,
uint16_t  font_color,
const char *  p_string,
const nrf_gfx_font_desc_t p_font,
bool  wrap 
)

Function for printing a string to the screen.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_pointPointer to the point where to start drawing the object.
[in]font_colorColor of the font in the display accepted format.
[in]p_stringPointer to the string.
[in]p_fontPointer to the font descriptor.
[in]wrapIf true, the string will be wrapped to the new line.
ret_code_t nrf_gfx_rect_draw ( nrf_lcd_t const *  p_instance,
nrf_gfx_rect_t const *  p_rect,
uint16_t  thickness,
uint32_t  color,
bool  fill 
)

Function for drawing a rectangle.

Parameters
[in]p_instancePointer to the LCD instance.
[in]p_rectPointer to the rectangle object.
[in]thicknessThickness of the rectangle border.
[in]colorColor of the object in the display accepted format.
[in]fillIf true, the rectangle will be filled.
Return values
NRF_ERROR_INVALID_PARAMIf object position is not on the screen.
NRF_SUCCESSIf object was successfully drawn.
void nrf_gfx_rotation_set ( nrf_lcd_t const *  p_instance,
nrf_lcd_rotation_t  rotation 
)

Function for setting screen rotation.

Parameters
[in]p_instancePointer to the LCD instance.
[in]rotationRotation to be made.
void nrf_gfx_screen_fill ( nrf_lcd_t const *  p_instance,
uint32_t  color 
)

Function for filling the screen with selected color.

Parameters
[in]p_instancePointer to the LCD instance.
[in]colorColor of the screen in the display accepted format.
void nrf_gfx_uninit ( nrf_lcd_t const *  p_instance)

Function for uninitializing the GFX library.

Parameters
[in]p_instancePointer to the LCD instance.
Returns
Values returned by nrf_lcd_t::lcd_uninit.
uint16_t nrf_gfx_width_get ( nrf_lcd_t const *  p_instance)

Function for getting the width of the screen.

Parameters
[in]p_instancePointer to the LCD instance.

Documentation feedback | Developer Zone | Subscribe | Updated