Functions useful during debugging.
More...
#include <stdint.h>
Go to the source code of this file.
|
void | Debug_GetCursorPosition (int *x, int *y) |
|
void | Debug_Printf (int x, int y, bool invert, int zero, const char *format,...) |
|
void | Debug_PrintNumberHex_Byte (uint8_t value, int x, int y) |
|
void | Debug_PrintNumberHex_Dword (uint32_t value, int x, int y) |
|
void | Debug_PrintNumberHex_Nibble (uint8_t value, int x, int y) |
|
void | Debug_PrintNumberHex_Word (uint16_t value, int x, int y) |
|
bool | Debug_PrintString (const char *string, bool invert) |
|
int | Debug_SetCursorPosition (int x, int y) |
|
int | Debug_WaitKey () |
|
Functions useful during debugging.
It can be useful to print text or numbers to the screen whilst debugging, without creating a full GUI, or pause execution and wait for a key press. Thoroughly recommended only for debugging - prefer GUI elements for user-facing input/output!
Example:
Debug_Printf(20, 20,
false, 0,
"Format strings are %s in %d!",
"cool", 2018);
void Debug_Printf(int x, int y, bool invert, int zero, const char *format,...)
bool Debug_PrintString(const char *string, bool invert)
int Debug_SetCursorPosition(int x, int y)
void Debug_PrintNumberHex_Word(uint16_t value, int x, int y)
◆ Debug_GetCursorPosition()
void Debug_GetCursorPosition |
( |
int * |
x, |
|
|
int * |
y |
|
) |
| |
Returns the current position of the cursor in debug text mode.
- Parameters
-
[out] | x,y | The position of the cursor. |
◆ Debug_Printf()
void Debug_Printf |
( |
int |
x, |
|
|
int |
y, |
|
|
bool |
invert, |
|
|
int |
zero, |
|
|
const char * |
format, |
|
|
|
... |
|
) |
| |
Print a formatted string in small debug text mode, either in normal black-on-white or inverted white-on-black. Color inversion occurs if invert
is true.
Supports most format specifiers.
- Parameters
-
| x,y | The coordinates to print the formatted string at. |
| invert | True if the colors used to print the text should be inverted. |
| zero | Must be passed 0. |
[in] | format | The format string to use. |
| ... | The values to substitute into the format string. |
◆ Debug_PrintNumberHex_Byte()
void Debug_PrintNumberHex_Byte |
( |
uint8_t |
value, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Prints the hex representation of a byte (8-bit number) at the specified position in debug text mode.
- Parameters
-
value | The byte to print. |
x,y | The coordinates to print the number at. |
◆ Debug_PrintNumberHex_Dword()
void Debug_PrintNumberHex_Dword |
( |
uint32_t |
value, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Prints the hex representation of a dword (32-bit number) at the specified position in debug text mode.
- Parameters
-
value | The dword to print. |
x,y | The coordinates to print the number at. |
◆ Debug_PrintNumberHex_Nibble()
void Debug_PrintNumberHex_Nibble |
( |
uint8_t |
value, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Prints the hex representation of a nibble (4-bit number) at the specified position in debug text mode.
- Parameters
-
value | The nibble to print. High 4 bits are ignored. |
x,y | The coordinates to print the number at. |
◆ Debug_PrintNumberHex_Word()
void Debug_PrintNumberHex_Word |
( |
uint16_t |
value, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| |
Prints the hex representation of a word (16-bit number) at the specified position in debug text mode.
- Parameters
-
value | The word to print. |
x,y | The coordinates to print the number at. |
◆ Debug_PrintString()
bool Debug_PrintString |
( |
const char * |
string, |
|
|
bool |
invert |
|
) |
| |
Prints a string in debug text mode, either in normal black-on-white or inverted white-on-black. Color inversion occurs if invert
is true.
Returns false if the string did not fit on the screen.
- Parameters
-
[in] | string | The string to print. |
| invert | True if the colors used to print the text should be inverted. |
- Returns
- True if writing the string was successful, false otherwise.
◆ Debug_SetCursorPosition()
int Debug_SetCursorPosition |
( |
int |
x, |
|
|
int |
y |
|
) |
| |
Sets the position of the cursor in debug text mode.
- Parameters
-
x,y | The cursor's new position. |
- Returns
- Always returns 0.
◆ Debug_WaitKey()
Waits until a key is pressed, then returns a number representing the key. Only appears to react to number keys and the Power/Clear key. Returns 0x30 to 0x39 for keys 0 to 9, and 0x98 for the Power/Clear key.
- Returns
- A number representing the key that was pressed.