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... | |
LCD text functions.
#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.
ds | Display state |
ln | Line number |
#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.
ds | Display state |
#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.
ds | Display state |
ln | Line number |
#define lcd_putsAt | ( | ds, | |
ln, | |||
str | |||
) | do { lcd_setLine(ds, ln); lcd_puts(ds,str); } while(0) |
Jump to line ln
and print string.
ds | Display state |
ln | Line number |
str | String to print |
#define lcd_putsR | ( | ds, | |
str | |||
) | do { ds->inv=1; lcd_puts(ds,str); ds->inv=0; } while(0) |
Print string inversely at current line.
ds | Display state |
str | String to print |
#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.
ds | Display state |
ln | Line number |
str | String to print |
int lcd_baseHeight | ( | disp_stat_t * | ds | ) |
Returns baseline position.
ds | Display state |
int lcd_charWidth | ( | disp_stat_t * | ds, |
int | c | ||
) |
Returns width of character.
ds | Display state |
c | Character |
int lcd_fontWidth | ( | disp_stat_t * | ds | ) |
Returns width of font.
ds | Display state |
int lcd_lineHeight | ( | disp_stat_t * | ds | ) |
Returns line height.
ds | Display state |
int lcd_nextFontNr | ( | int | nr | ) |
Get next (bigger) font number.
It returns the same number for biggest font.
int lcd_prevFontNr | ( | int | nr | ) |
Get previous (smaller) font number.
It returns the same number for smallest font.
void lcd_prevLn | ( | disp_stat_t * | ds | ) |
Jump to previous line.
ds | Display state |
void lcd_print | ( | disp_stat_t * | ds, |
const char * | fmt, | ||
... | |||
) |
Print formatted string.
ds | Display state |
fmt | Printf like format |
void lcd_setLine | ( | disp_stat_t * | ds, |
int | ln_nr | ||
) |
Jump to given line.
ds | Display state |
ln_nr | Line number |
void lcd_setXY | ( | disp_stat_t * | ds, |
int | x, | ||
int | y | ||
) |
Jump to pixel position (x,y)
ds | Display state |
x | X position |
y | Y position |
void lcd_switchFont | ( | disp_stat_t * | ds, |
int | nr | ||
) |
Set current font to given font number.
ds | Display state |
nr | Font number |
int lcd_textForWidth | ( | disp_stat_t * | ds, |
const char * | text, | ||
int | expected_width, | ||
int * | plen | ||
) |
Calculate text
width without breaking words
ds | Display state |
text | Text |
expected_width | Expected width |
plen | (optional, out) Width of text which fits into expected_width . Could be NULL. |
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.
void lcd_textToBox | ( | disp_stat_t * | ds, |
int | x, | ||
int | width, | ||
char * | text, | ||
int | from_right, | ||
int | align_right | ||
) |
Display text in confined area.
ds | Display state |
x | X position |
width | X width |
text | Text |
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.
int lcd_textToWidth | ( | disp_stat_t * | ds, |
const char * | text, | ||
int | expected_width, | ||
int * | plen | ||
) |
Determines which part of text fits in expected_width
.
ds | Display state |
text | Text |
expected_width | Expected width |
plen | (optional, out) Width of text which fits into expected_width . Could be NULL. |
expected_width
. 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
.
ds | Display state |
text | Text |
expected_width | Expected width |
plen | (optional, out) Width of text which fits into expected_width . Could be NULL. |
expected_width
. int lcd_textWidth | ( | disp_stat_t * | ds, |
const char * | text | ||
) |
Calculates width of text.
ds | Display state |
text | Text |
int lcd_toggleFontT | ( | int | nr | ) |
Toggle font number between normal and TT font.
void lcd_writeClr | ( | disp_stat_t * | ds | ) |
Jump to first line.
ds | Display state |
void lcd_writeNl | ( | disp_stat_t * | ds | ) |
Jump to next line.
ds | Display state |
void lcd_writeText | ( | disp_stat_t * | ds, |
const char * | text | ||
) |
Display text.
ds | Display state |
text | Text |
Displays text according to display state ds
. Which specifies position, font, background handling, etc.
void lcd_writeTextWidth | ( | disp_stat_t * | ds, |
const char * | text | ||
) |
Updates display state as if lcd_writeText() was be called.
ds | Display state |
text | Text |
Advances ds->x only. Doesn't print anything.