|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
A pin's name and a set of pins as text for a screen label or a report: "GPIO 13", "GPIO 2 GPIO 4 +2". More...
#include <stddef.h>#include <stdint.h>Go to the source code of this file.
Functions | |
| size_t | ui_pin_name (char *out, size_t size, unsigned gpio) |
Writes the name of pin gpio into out: the pin word, a space and the number, "GPIO 13". | |
| size_t | ui_pinlist (char *out, size_t size, uint64_t mask, unsigned cells) |
Writes the pins of mask, lowest first, as "GPIO 2 GPIO 4
GPIO 5", each as ui_pin_name() names it, into out. | |
| unsigned | ui_pinlist_count (uint64_t mask) |
The number of pins in mask. | |
A pin's name and a set of pins as text for a screen label or a report: "GPIO 13", "GPIO 2 GPIO 4 +2".
Pure functions, no drawing and no I/O (input/output). Every screen and report that names a pin formats it here, so a pin reads the same everywhere. A text table entry that names a pin writes the same form, "GPIO %u": test_text fails on any entry of ui_text.def, English or German, with "GP" directly followed by a digit or a conversion.
SPDX-License-Identifier: MIT
| size_t ui_pin_name | ( | char * | out, |
| size_t | size, | ||
| unsigned | gpio ) |
Writes the name of pin gpio into out: the pin word, a space and the number, "GPIO 13".
The text is cut to size - 1 characters, as snprintf() cuts it.
| out | Where the text goes; NULL writes nothing. |
| size | The bytes at out; 0 writes nothing. |
| gpio | The pin, 0 to UI_PINLIST_PINS - 1. A higher number (a screen's NO_PIN, 0xFF) is no pin and writes "". |
out or a size of 0. | size_t ui_pinlist | ( | char * | out, |
| size_t | size, | ||
| uint64_t | mask, | ||
| unsigned | cells ) |
Writes the pins of mask, lowest first, as "GPIO 2 GPIO 4
GPIO 5", each as ui_pin_name() names it, into out.
The text is at most cells characters (one character is one cell of the monospaced face the caller draws it in: a TARGET row in 8 x 16 or 10 x 20, ui_target_row_cells()) and at most size - 1 characters. When all pins do not fit, the list shows as many leading pins as fit, then "+N" with N the pins left out: "GPIO 2 GPIO 4 +2". When not even one pin and the count fit, the text is "+N" alone. When "+N" itself is wider than cells, the text is cut to cells characters.
| out | Where the text goes; NULL writes nothing. |
| size | The bytes at out; 0 writes nothing. |
| mask | The pins, bit n for GPIO n; 0 writes "". |
| cells | The cells the text may take. |
out or a size of 0. | unsigned ui_pinlist_count | ( | uint64_t | mask | ) |
The number of pins in mask.
| mask | The pins, bit n for GPIO n. |