|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The text of the Hitec programmer's record of a write, and its parse. See hitec_card.h. More...
Data Structures | |
| struct | reader_t |
| The text being read: where it is and where its body ends. More... | |
Macros | |
| #define | CHECK_LEN 11u |
| The check line's length: "check=" 4 digits and the newline. | |
| #define | PIN_LAST 47u |
| The highest GPIO of the IOmcu. | |
Functions | |
| unsigned | hitec_card_addrs (uint8_t series, uint8_t out[HITEC_C_BLOCK_LEN]) |
The addresses a record holds for series. | |
| static char * | put (char *at, const char *s) |
Append s without its terminator. | |
| static char * | put_hex (char *at, unsigned v, unsigned digits) |
Append v as digits upper-case hexadecimal digits. | |
| static char * | put_image (char *at, const char *key, uint8_t series, const hitec_image_t *img) |
Append the line key with the record's addresses of img. | |
| size_t | hitec_card_text (const hitec_card_record_t *r, char *out, size_t n) |
The text of r, or of no record for NULL. | |
| static long | take_hex (const char *s, unsigned digits) |
The value of digits upper-case hexadecimal digits at s. | |
| static const char * | take_line (reader_t *r, const char *key, unsigned digits, long *v) |
| Take the line "@p key + @p digits digits + newline". | |
| static bool | take_image (reader_t *r, const char *key, uint8_t series, hitec_image_t *img) |
Take an image line into img. | |
| hitec_card_result_t | hitec_card_parse (const char *text, size_t len, hitec_card_record_t *out) |
| Parse a text. | |
Variables | |
| static const char | k_head [] = "RCBENCH HITEC 1\n" |
| The first line. | |
The text of the Hitec programmer's record of a write, and its parse. See hitec_card.h.
Hitec is a name or trademark of its owner; it is used here only to say which servos this module works with.
SPDX-License-Identifier: MIT
| unsigned hitec_card_addrs | ( | uint8_t | series, |
| uint8_t | out[HITEC_C_BLOCK_LEN] ) |
The addresses a record holds for series.
| series | hitec_family_t. |
| out | Receives up to 36 addresses, ascending. |
| hitec_card_result_t hitec_card_parse | ( | const char * | text, |
| size_t | len, | ||
| hitec_card_record_t * | out ) |
Parse a text.
A record's images know the addresses hitec_card_addrs() names, nothing else. A pin above 47 reads as HITEC_CARD_NO_PIN.
| text | The text; it need not be terminated. |
| len | Its length in bytes. |
| out | Receives the record on HITEC_CARD_OK; untouched otherwise. |
| size_t hitec_card_text | ( | const hitec_card_record_t * | r, |
| char * | out, | ||
| size_t | n ) |
The text of r, or of no record for NULL.
Only the addresses hitec_card_addrs() names are written; a byte that is not known is written as its value all the same.
| r | The record; NULL for a text without one. |
| out | Receives the text, terminated. |
| n | Bytes at out, HITEC_CARD_TEXT_MAX or more. |
n is too small, r names a series other than classic and D, or a port above 15.
|
static |
Append s without its terminator.
| at | Where it goes. |
| s | The text. |
|
static |
Append v as digits upper-case hexadecimal digits.
| at | Where they go. |
| v | The value. |
| digits | The count. |
|
static |
Append the line key with the record's addresses of img.
| at | Where it goes. |
| key | "before=" or "target=". |
| series | hitec_family_t. |
| img | The image. |
|
static |
The value of digits upper-case hexadecimal digits at s.
| s | The digits. |
| digits | Their count, at most 4. |
|
static |
Take an image line into img.
| r | The reader. |
| key | "before=" or "target=". |
| series | hitec_family_t. |
| img | Receives the addresses, known; emptied first. |
|
static |
Take the line "@p key + @p digits digits + newline".
| r | The reader. |
| key | The key. |
| digits | The digits. |
| v | Receives their value, for at most 4 digits; NULL to keep the place only. |