![]() |
ucglib_xmega_hal
4.0
Xmega Hardware Abstraction Layer for Ucglib
|
Print facilities for ucglib from Oli Kraus. More...
#include <stdio.h>#include <stdlib.h>#include <stdarg.h>#include "ucg.h"Functions | |
| void | ucg_PrintInit (ucg_t *ucg) |
| Initializes the printing facilities compatible with Arduino/C++ version of library. More... | |
| void | ucg_GetPrintPos (ucg_t *ucg, ucg_int_t *x, ucg_int_t *y) |
| Gets the current position of the 'print cursor'. More... | |
| void | ucg_SetPrintPos (ucg_t *ucg, ucg_int_t x, ucg_int_t y) |
| Sets the position for next "print" command. More... | |
| void | ucg_SetPrintDir (ucg_t *ucg, uint8_t dir) |
| Sets the direction for next "print" command. More... | |
| int | ucg_Print (ucg_t *ucg, char *fmt,...) |
| Put a formatted string to the display at the current position and in the current direction. More... | |
Print facilities for ucglib from Oli Kraus.
This is an addition to the c-implementation of Oli Kraus.
The Arduino/C++ implementation of ucglib contains extra printing facilities. This file contains a bunch of functions that implements the same facilities. So you can use ucg_SetPrintPos(), ucg_SetPrintDir() and in stead of print and println you can use ucg_Print() which prints a formatstring.
This print facility uses the user pointer in the struct ucg_t. To use this pointer you need to remove the comment (at line 100 in ucg.h), before the macrodefinition of WITH_USER_PTR
/ * Define this for an additional user pointer inside the ucg data struct * /
#define WITH_USER_PTROriginally these functionality was added in the Xmega Hardware Abstraction Layer (version 2.0, 2.1 and 3.0). From vesion 4.0 this functionality is separated from the HAL.
| void ucg_GetPrintPos | ( | ucg_t * | ucg, |
| ucg_int_t * | x, | ||
| ucg_int_t * | y | ||
| ) |
Gets the current position of the 'print cursor'.
| ucg | pointer to struct for the display |
| x | pointer to a variable for the x-coordinate of the current position |
| y | pointer to a variable for the y-coordinate of the current position |
| int ucg_Print | ( | ucg_t * | ucg, |
| char * | fmt, | ||
| ... | |||
| ) |
Put a formatted string to the display at the current position and in the current direction.
This replaces print and println from the Arduino implementation of ucg_lib
The Arduino style:
* ucg.print("text ");
* ucg.print(x); // x is an int
* ucg.print(" more text ");
* ucg.print(y); // y is a float
* ucg.println(";"); The replacement in Xmega style:
* ucg_Print(&ucg, "text %d more text %f;\n", x, y);
| ucg | pointer to struct for the display |
| fmt | formatstring with escape sequences |
| ... | variables that are printed |
| void ucg_PrintInit | ( | ucg_t * | ucg | ) |
Initializes the printing facilities compatible with Arduino/C++ version of library.
| ucg | pointer to struct for the display |
| void ucg_SetPrintDir | ( | ucg_t * | ucg, |
| uint8_t | dir | ||
| ) |
Sets the direction for next "print" command.
| ucg | pointer to struct for the display |
| dir | the direction |
| void ucg_SetPrintPos | ( | ucg_t * | ucg, |
| ucg_int_t | x, | ||
| ucg_int_t | y | ||
| ) |
Sets the position for next "print" command.
| ucg | pointer to struct for the display |
| x | x-coordinate of the position |
| y | y-coordinate of the position |