Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Monochrome Character Framebuffer

Public Monochrome Character Framebuffer API. More...

Data Structures

struct  cfb_font
 
struct  cfb_position
 

Macros

#define FONT_ENTRY_DEFINE(_name, _width, _height, _caps, _data, _fc, _lc)
 Macro for creating a font entry.
 

Enumerations

enum  cfb_display_param {
  CFB_DISPLAY_HEIGH = 0 , CFB_DISPLAY_WIDTH , CFB_DISPLAY_PPT , CFB_DISPLAY_ROWS ,
  CFB_DISPLAY_COLS
}
 
enum  cfb_font_caps { CFB_FONT_MONO_VPACKED = BIT(0) , CFB_FONT_MONO_HPACKED = BIT(1) , CFB_FONT_MSB_FIRST = BIT(2) }
 

Functions

int cfb_print (const struct device *dev, const char *const str, uint16_t x, uint16_t y)
 Print a string into the framebuffer.
 
int cfb_draw_text (const struct device *dev, const char *const str, int16_t x, int16_t y)
 Print a string into the framebuffer.
 
int cfb_draw_point (const struct device *dev, const struct cfb_position *pos)
 Draw a point.
 
int cfb_draw_line (const struct device *dev, const struct cfb_position *start, const struct cfb_position *end)
 Draw a line.
 
int cfb_draw_rect (const struct device *dev, const struct cfb_position *start, const struct cfb_position *end)
 Draw a rectangle.
 
int cfb_framebuffer_clear (const struct device *dev, bool clear_display)
 Clear framebuffer.
 
int cfb_framebuffer_invert (const struct device *dev)
 Invert Pixels.
 
int cfb_invert_area (const struct device *dev, uint16_t x, uint16_t y, uint16_t width, uint16_t height)
 Invert Pixels in selected area.
 
int cfb_framebuffer_finalize (const struct device *dev)
 Finalize framebuffer and write it to display RAM, invert or reorder pixels if necessary.
 
int cfb_get_display_parameter (const struct device *dev, enum cfb_display_param)
 Get display parameter.
 
int cfb_framebuffer_set_font (const struct device *dev, uint8_t idx)
 Set font.
 
int cfb_set_kerning (const struct device *dev, int8_t kerning)
 Set font kerning (spacing between individual letters).
 
int cfb_get_font_size (const struct device *dev, uint8_t idx, uint8_t *width, uint8_t *height)
 Get font size.
 
int cfb_get_numof_fonts (const struct device *dev)
 Get number of fonts.
 
int cfb_framebuffer_init (const struct device *dev)
 Initialize Character Framebuffer.
 

Detailed Description

Public Monochrome Character Framebuffer API.

Macro Definition Documentation

◆ FONT_ENTRY_DEFINE

#define FONT_ENTRY_DEFINE (   _name,
  _width,
  _height,
  _caps,
  _data,
  _fc,
  _lc 
)

#include <zephyr/display/cfb.h>

Value:
static const STRUCT_SECTION_ITERABLE(cfb_font, _name) = { \
.data = _data, \
.caps = _caps, \
.width = _width, \
.height = _height, \
.first_char = _fc, \
.last_char = _lc, \
}
#define STRUCT_SECTION_ITERABLE(struct_type, varname)
Defines a new element for an iterable section.
Definition: iterable_sections.h:216
Definition: cfb.h:44

Macro for creating a font entry.

Parameters
_nameName of the font entry.
_widthWidth of the font in pixels
_heightHeight of the font in pixels.
_capsFont capabilities.
_dataRaw data of the font.
_fcCharacter mapped to first font element.
_lcCharacter mapped to last font element.

Enumeration Type Documentation

◆ cfb_display_param

#include <zephyr/display/cfb.h>

Enumerator
CFB_DISPLAY_HEIGH 
CFB_DISPLAY_WIDTH 
CFB_DISPLAY_PPT 
CFB_DISPLAY_ROWS 
CFB_DISPLAY_COLS 

◆ cfb_font_caps

#include <zephyr/display/cfb.h>

Enumerator
CFB_FONT_MONO_VPACKED 
CFB_FONT_MONO_HPACKED 
CFB_FONT_MSB_FIRST 

Function Documentation

◆ cfb_draw_line()

int cfb_draw_line ( const struct device dev,
const struct cfb_position start,
const struct cfb_position end 
)

#include <zephyr/display/cfb.h>

Draw a line.

Parameters
devPointer to device structure for driver instance
startstart position of the line
endend position of the line
Returns
0 on success, negative value otherwise

◆ cfb_draw_point()

int cfb_draw_point ( const struct device dev,
const struct cfb_position pos 
)

#include <zephyr/display/cfb.h>

Draw a point.

Parameters
devPointer to device structure for driver instance
posposition of the point
Returns
0 on success, negative value otherwise

◆ cfb_draw_rect()

int cfb_draw_rect ( const struct device dev,
const struct cfb_position start,
const struct cfb_position end 
)

#include <zephyr/display/cfb.h>

Draw a rectangle.

Parameters
devPointer to device structure for driver instance
startTop-Left position of the rectangle
endBottom-Right position of the rectangle
Returns
0 on success, negative value otherwise

◆ cfb_draw_text()

int cfb_draw_text ( const struct device dev,
const char *const  str,
int16_t  x,
int16_t  y 
)

#include <zephyr/display/cfb.h>

Print a string into the framebuffer.

For compare to cfb_print, cfb_draw_text accept non tile-aligned coords and not line wrapping.

Parameters
devPointer to device structure for driver instance
strString to print
xPosition in X direction of the beginning of the string
yPosition in Y direction of the beginning of the string
Returns
0 on success, negative value otherwise

◆ cfb_framebuffer_clear()

int cfb_framebuffer_clear ( const struct device dev,
bool  clear_display 
)

#include <zephyr/display/cfb.h>

Clear framebuffer.

Parameters
devPointer to device structure for driver instance
clear_displayClear the display as well
Returns
0 on success, negative value otherwise

◆ cfb_framebuffer_finalize()

int cfb_framebuffer_finalize ( const struct device dev)

#include <zephyr/display/cfb.h>

Finalize framebuffer and write it to display RAM, invert or reorder pixels if necessary.

Parameters
devPointer to device structure for driver instance
Returns
0 on success, negative value otherwise

◆ cfb_framebuffer_init()

int cfb_framebuffer_init ( const struct device dev)

#include <zephyr/display/cfb.h>

Initialize Character Framebuffer.

Parameters
devPointer to device structure for driver instance
Returns
0 on success, negative value otherwise

◆ cfb_framebuffer_invert()

int cfb_framebuffer_invert ( const struct device dev)

#include <zephyr/display/cfb.h>

Invert Pixels.

Parameters
devPointer to device structure for driver instance
Returns
0 on success, negative value otherwise

◆ cfb_framebuffer_set_font()

int cfb_framebuffer_set_font ( const struct device dev,
uint8_t  idx 
)

#include <zephyr/display/cfb.h>

Set font.

Parameters
devPointer to device structure for driver instance
idxFont index
Returns
0 on success, negative value otherwise

◆ cfb_get_display_parameter()

int cfb_get_display_parameter ( const struct device dev,
enum  cfb_display_param 
)

#include <zephyr/display/cfb.h>

Get display parameter.

Parameters
devPointer to device structure for driver instance
cfb_display_paramOne of the display parameters
Returns
Display parameter value

◆ cfb_get_font_size()

int cfb_get_font_size ( const struct device dev,
uint8_t  idx,
uint8_t width,
uint8_t height 
)

#include <zephyr/display/cfb.h>

Get font size.

Parameters
devPointer to device structure for driver instance
idxFont index
widthPointers to the variable where the font width will be stored.
heightPointers to the variable where the font height will be stored.
Returns
0 on success, negative value otherwise

◆ cfb_get_numof_fonts()

int cfb_get_numof_fonts ( const struct device dev)

#include <zephyr/display/cfb.h>

Get number of fonts.

Parameters
devPointer to device structure for driver instance
Returns
number of fonts

◆ cfb_invert_area()

int cfb_invert_area ( const struct device dev,
uint16_t  x,
uint16_t  y,
uint16_t  width,
uint16_t  height 
)

#include <zephyr/display/cfb.h>

Invert Pixels in selected area.

Parameters
devPointer to device structure for driver instance
xPosition in X direction of the beginning of area
yPosition in Y direction of the beginning of area
widthWidth of area in pixels
heightHeight of area in pixels
Returns
0 on success, negative value otherwise

◆ cfb_print()

int cfb_print ( const struct device dev,
const char *const  str,
uint16_t  x,
uint16_t  y 
)

#include <zephyr/display/cfb.h>

Print a string into the framebuffer.

Parameters
devPointer to device structure for driver instance
strString to print
xPosition in X direction of the beginning of the string
yPosition in Y direction of the beginning of the string
Returns
0 on success, negative value otherwise

◆ cfb_set_kerning()

int cfb_set_kerning ( const struct device dev,
int8_t  kerning 
)

#include <zephyr/display/cfb.h>

Set font kerning (spacing between individual letters).

Parameters
devPointer to device structure for driver instance
kerningFont kerning
Returns
0 on success, negative value otherwise