DMCP interface  03.15_020

LCD text functions. More...

Data Structures

struct  line_font_t
 Font structure. More...
 
struct  disp_stat_t
 Font display state. More...
 

Macros

#define NR2T(x)   (-(x)-1)
 Toggle font number to TT font number.
 
#define T2NR(x)   (-(x)-1)
 Toggle TT font number to font number.
 
#define lcd_printAt(ds, ln, ...)   do { lcd_setLine(ds, ln); lcd_print(ds, __VA_ARGS__); } while(0)
 Jump to line ln and print formatted string. More...
 
#define lcd_printR(ds, ...)   do { ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
 Print formatted string inversely at current line. More...
 
#define lcd_printRAt(ds, ln, ...)   do { lcd_setLine(ds, ln); ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)
 Jump to line ln and print formatted string inversely. More...
 
#define lcd_puts   lcd_writeText
 Shortcut for lcd_writeText()
 
#define lcd_putsAt(ds, ln, str)   do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0)
 Jump to line ln and print string. More...
 
#define lcd_putsR(ds, str)   do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
 Print string inversely at current line. More...
 
#define lcd_putsRAt(ds, ln, str)   do { lcd_setLine(ds, ln); ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)
 Jump to line ln and print string inversely. More...
 

Functions

void lcd_writeNl (disp_stat_t *ds)
 Jump to next line. More...
 
void lcd_prevLn (disp_stat_t *ds)
 Jump to previous line. More...
 
void lcd_writeClr (disp_stat_t *ds)
 Jump to first line. More...
 
void lcd_setLine (disp_stat_t *ds, int ln_nr)
 Jump to given line. More...
 
void lcd_setXY (disp_stat_t *ds, int x, int y)
 Jump to pixel position (x,y) More...
 
int lcd_lineHeight (disp_stat_t *ds)
 Returns line height. More...
 
int lcd_baseHeight (disp_stat_t *ds)
 Returns baseline position. More...
 
int lcd_fontWidth (disp_stat_t *ds)
 Returns width of font. More...
 
void lcd_writeText (disp_stat_t *ds, const char *text)
 Display text. More...
 
void lcd_textToBox (disp_stat_t *ds, int x, int width, char *text, int from_right, int align_right)
 Display text in confined area. More...
 
int lcd_textWidth (disp_stat_t *ds, const char *text)
 Calculates width of text. More...
 
int lcd_charWidth (disp_stat_t *ds, int c)
 Returns width of character. More...
 
int lcd_textToWidth (disp_stat_t *ds, const char *text, int expected_width, int *plen)
 Determines which part of text fits in expected_width. More...
 
int lcd_textToWidthR (disp_stat_t *ds, const char *text, int expected_width, int *plen)
 Determines which part of text from the end of the string fits in expected_width. More...
 
void lcd_writeTextWidth (disp_stat_t *ds, const char *text)
 Updates display state as if lcd_writeText() was be called. More...
 
int lcd_textForWidth (disp_stat_t *ds, const char *text, int expected_width, int *plen)
 Calculate text width without breaking words More...
 
int lcd_nextFontNr (int nr)
 Get next (bigger) font number. More...
 
int lcd_prevFontNr (int nr)
 Get previous (smaller) font number. More...
 
void lcd_switchFont (disp_stat_t *ds, int nr)
 Set current font to given font number. More...
 
int lcd_toggleFontT (int nr)
 Toggle font number between normal and TT font. More...
 
void lcd_print (disp_stat_t *ds, const char *fmt,...)
 Print formatted string. More...
 

Detailed Description

LCD text functions.

Macro Definition Documentation

◆ lcd_printAt

#define lcd_printAt (   ds,
  ln,
  ... 
)    do { lcd_setLine(ds, ln); lcd_print(ds, __VA_ARGS__); } while(0)

Jump to line ln and print formatted string.

Parameters
dsDisplay state
lnLine number

◆ lcd_printR

#define lcd_printR (   ds,
  ... 
)    do { ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)

Print formatted string inversely at current line.

Parameters
dsDisplay state

◆ lcd_printRAt

#define lcd_printRAt (   ds,
  ln,
  ... 
)    do { lcd_setLine(ds, ln); ds->inv=1; lcd_print(ds, __VA_ARGS__); ds->inv=0; } while(0)

Jump to line ln and print formatted string inversely.

Parameters
dsDisplay state
lnLine number

◆ lcd_putsAt

#define lcd_putsAt (   ds,
  ln,
  str 
)    do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0)

Jump to line ln and print string.

Parameters
dsDisplay state
lnLine number
strString to print

◆ lcd_putsR

#define lcd_putsR (   ds,
  str 
)    do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)

Print string inversely at current line.

Parameters
dsDisplay state
strString to print

◆ lcd_putsRAt

#define lcd_putsRAt (   ds,
  ln,
  str 
)    do { lcd_setLine(ds, ln); ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0)

Jump to line ln and print string inversely.

Parameters
dsDisplay state
lnLine number
strString to print

Function Documentation

◆ lcd_baseHeight()

int lcd_baseHeight ( disp_stat_t ds)

Returns baseline position.

Parameters
dsDisplay state
Returns
Baseline position

◆ lcd_charWidth()

int lcd_charWidth ( disp_stat_t ds,
int  c 
)

Returns width of character.

Parameters
dsDisplay state
cCharacter
Returns
Width of character

◆ lcd_fontWidth()

int lcd_fontWidth ( disp_stat_t ds)

Returns width of font.

Parameters
dsDisplay state
Returns
Font width

◆ lcd_lineHeight()

int lcd_lineHeight ( disp_stat_t ds)

Returns line height.

Parameters
dsDisplay state
Returns
Line height

◆ lcd_nextFontNr()

int lcd_nextFontNr ( int  nr)

Get next (bigger) font number.

Returns
Next font number

It returns the same number for biggest font.

◆ lcd_prevFontNr()

int lcd_prevFontNr ( int  nr)

Get previous (smaller) font number.

Returns
Previous font number

It returns the same number for smallest font.

◆ lcd_prevLn()

void lcd_prevLn ( disp_stat_t ds)

Jump to previous line.

Parameters
dsDisplay state

◆ lcd_print()

void lcd_print ( disp_stat_t ds,
const char *  fmt,
  ... 
)

Print formatted string.

Parameters
dsDisplay state
fmtPrintf like format

◆ lcd_setLine()

void lcd_setLine ( disp_stat_t ds,
int  ln_nr 
)

Jump to given line.

Parameters
dsDisplay state
ln_nrLine number

◆ lcd_setXY()

void lcd_setXY ( disp_stat_t ds,
int  x,
int  y 
)

Jump to pixel position (x,y)

Parameters
dsDisplay state
xX position
yY position

◆ lcd_switchFont()

void lcd_switchFont ( disp_stat_t ds,
int  nr 
)

Set current font to given font number.

Parameters
dsDisplay state
nrFont number

◆ lcd_textForWidth()

int lcd_textForWidth ( disp_stat_t ds,
const char *  text,
int  expected_width,
int *  plen 
)

Calculate text width without breaking words

Parameters
dsDisplay state
textText
expected_widthExpected width
plen(optional, out) Width of text which fits into expected_width. Could be NULL.
Returns
Index of character which breaks the space limit. Returns strlen(text) if whole text fits into expected_width.

Gets text which fits in expected width without breaking words. Word could be broken in the middle only if single long word is placed on whole line. It means it is possible to get empty string if ds->x is non-zero.

◆ lcd_textToBox()

void lcd_textToBox ( disp_stat_t ds,
int  x,
int  width,
char *  text,
int  from_right,
int  align_right 
)

Display text in confined area.

Parameters
dsDisplay state
xX position
widthX width
textText
from_right(0/1) 1 - end of text is displayed
align_right(0/1) 1 - text is aligned to the right

Current line is used.

Only part of the text is displayed if it doesn't fit into given area. Ellipsis is displayed in place of text omission.

Note that due to implementation limitation the text has to be in RAM.

◆ lcd_textToWidth()

int lcd_textToWidth ( disp_stat_t ds,
const char *  text,
int  expected_width,
int *  plen 
)

Determines which part of text fits in expected_width.

Parameters
dsDisplay state
textText
expected_widthExpected width
plen(optional, out) Width of text which fits into expected_width. Could be NULL.
Returns
Index of character which breaks the space limit. Returns strlen(text) if whole text fits into expected_width.

◆ lcd_textToWidthR()

int lcd_textToWidthR ( disp_stat_t ds,
const char *  text,
int  expected_width,
int *  plen 
)

Determines which part of text from the end of the string fits in expected_width.

Parameters
dsDisplay state
textText
expected_widthExpected width
plen(optional, out) Width of text which fits into expected_width. Could be NULL.
Returns
Index of character which breaks the space limit. Returns -1 if whole text fits into expected_width.

◆ lcd_textWidth()

int lcd_textWidth ( disp_stat_t ds,
const char *  text 
)

Calculates width of text.

Parameters
dsDisplay state
textText
Returns
Width of text

◆ lcd_toggleFontT()

int lcd_toggleFontT ( int  nr)

Toggle font number between normal and TT font.

Returns
Toggled font number

◆ lcd_writeClr()

void lcd_writeClr ( disp_stat_t ds)

Jump to first line.

Parameters
dsDisplay state

◆ lcd_writeNl()

void lcd_writeNl ( disp_stat_t ds)

Jump to next line.

Parameters
dsDisplay state

◆ lcd_writeText()

void lcd_writeText ( disp_stat_t ds,
const char *  text 
)

Display text.

Parameters
dsDisplay state
textText

Displays text according to display state ds. Which specifies position, font, background handling, etc.

◆ lcd_writeTextWidth()

void lcd_writeTextWidth ( disp_stat_t ds,
const char *  text 
)

Updates display state as if lcd_writeText() was be called.

Parameters
dsDisplay state
textText

Advances ds->x only. Doesn't print anything.