|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The programmer's files on the card: the save, the list and the load of kst_prog.h as the state sends them and takes their answers back. More...
Functions | |
| static kst_prog_msg_id_t | card_free (const kst_prog_t *p) |
| Whether the card can take a request now. | |
| static kst_prog_msg_id_t | load_ready (const kst_prog_t *p, unsigned *arg) |
| What a load needs of the servo, when it is asked for and when the file is there. | |
| kst_prog_msg_id_t | kst_prog_save (kst_prog_t *p, const char *name) |
Save the servo's image to a new file with name. | |
| kst_prog_msg_id_t | kst_prog_files (kst_prog_t *p, unsigned first) |
Ask for the list of files from file first on, counted from 0: up to KST_PROG_FILES_MAX of them. | |
| unsigned | kst_prog_files_first (const kst_prog_t *p) |
| The number of the last list's first file among the card's. | |
| kst_prog_msg_id_t | kst_prog_load (kst_prog_t *p, const char *name) |
Load the file with name into the draft. | |
| bool | kst_prog_card_busy (const kst_prog_t *p) |
| A save, a list or a load is on its way. | |
| uint32_t | kst_prog_files_seq (const kst_prog_t *p) |
| The sequence number of the file list. | |
| const char * | kst_prog_file_name (const kst_prog_t *p, unsigned i) |
The names of the last list, i from 0; "" beyond them. | |
| unsigned | kst_prog_file_count (const kst_prog_t *p, unsigned *total) |
The entries of the last list and, when total is not NULL, the servo files on the card. | |
| unsigned | kst_prog_file_type (const kst_prog_t *p, unsigned i) |
| That file's servo type as the card's side gave it; 0 none. | |
| kst_field_set_t | kst_prog_load_skipped (const kst_prog_t *p) |
| The fields in which the file in the draft differs from the servo and that are never written; 0 once the servo is read again or the draft is discarded. | |
| const char * | kst_prog_preset_name (const kst_prog_t *p) |
| The next preset name as the last list gave it; "" when none is left. | |
| const char * | kst_prog_card_name (const kst_prog_t *p) |
| The file last saved or asked for. | |
| kst_prog_file_kind_t | kst_prog_load_kind (const kst_prog_t *p) |
| What the file last loaded is. | |
| unsigned | kst_prog_load_named (const kst_prog_t *p, unsigned *fields) |
The fields the file last loaded gives a value for, and through fields, when not NULL, the named fields a file has: 0 where the card's side did not count them. | |
| bool | kst_prog_card_take (kst_prog_t *p, kst_prog_card_req_t *out) |
| A request for the card's side; false while there is none. | |
| static void | name_copy (char *to, const char *from) |
| Copies a file name, at most KST_PROG_NAME_MAX - 1 characters. | |
| static unsigned | card_message (unsigned result, bool load) |
| The message for a card result. | |
| static void | save_done (kst_prog_t *p, const kst_prog_card_done_t *d) |
| Takes the answer of a save. | |
| static void | list_done (kst_prog_t *p, const kst_prog_card_done_t *d) |
| Takes the answer of a list. | |
| static void | load_done (kst_prog_t *p, const kst_prog_card_done_t *d) |
| Takes the answer of a load. | |
| static void | save_late (kst_prog_t *p, const kst_prog_card_done_t *d) |
| The card ends a save this model gave up at KST_PROG_CARD_MS. | |
| void | kst_prog_card_done (kst_prog_t *p, const kst_prog_card_done_t *done) |
| What the card's side made of it. | |
The programmer's files on the card: the save, the list and the load of kst_prog.h as the state sends them and takes their answers back.
See kst_prog.h and kst_card.h.
SPDX-License-Identifier: MIT
|
static |
Whether the card can take a request now.
| p | The programmer state. |
|
static |
The message for a card result.
| result | The card result. |
| load | true for a load, false for a save or a list. |
| bool kst_prog_card_busy | ( | const kst_prog_t * | p | ) |
A save, a list or a load is on its way.
| p | The programmer state. |
| void kst_prog_card_done | ( | kst_prog_t * | p, |
| const kst_prog_card_done_t * | done ) |
What the card's side made of it.
An answer to a request that is no longer awaited changes nothing, but for one: the OK of a save given up at KST_PROG_CARD_MS names its file and, for the servo as it was saved, is the session's backup.
| p | The programmer state. |
| done | The answer of the card. |
| const char * kst_prog_card_name | ( | const kst_prog_t * | p | ) |
The file last saved or asked for.
| p | The programmer state. |
| bool kst_prog_card_take | ( | kst_prog_t * | p, |
| kst_prog_card_req_t * | out ) |
A request for the card's side; false while there is none.
| p | The programmer state. |
| out | Receives the request. |
| unsigned kst_prog_file_count | ( | const kst_prog_t * | p, |
| unsigned * | total ) |
The entries of the last list and, when total is not NULL, the servo files on the card.
| p | The programmer state. |
| total | Receives the total number of servo files on the card, or NULL. |
| const char * kst_prog_file_name | ( | const kst_prog_t * | p, |
| unsigned | i ) |
The names of the last list, i from 0; "" beyond them.
| p | The programmer state. |
| i | The index in the list. |
| unsigned kst_prog_file_type | ( | const kst_prog_t * | p, |
| unsigned | i ) |
That file's servo type as the card's side gave it; 0 none.
| p | The programmer state. |
| i | The index in the list. |
| kst_prog_msg_id_t kst_prog_files | ( | kst_prog_t * | p, |
| unsigned | first ) |
Ask for the list of files from file first on, counted from 0: up to KST_PROG_FILES_MAX of them.
kst_prog_files_seq() moves when it is there. Refused with KST_PROG_MSG_NEED_READ while the servo is in doubt.
| p | The programmer state. |
| first | The index of the first file to list. |
| unsigned kst_prog_files_first | ( | const kst_prog_t * | p | ) |
The number of the last list's first file among the card's.
| p | The programmer state. |
| uint32_t kst_prog_files_seq | ( | const kst_prog_t * | p | ) |
The sequence number of the file list.
| p | The programmer state. |
| kst_prog_msg_id_t kst_prog_load | ( | kst_prog_t * | p, |
| const char * | name ) |
Load the file with name into the draft.
Taken with a servo read that passes the fingerprint and is not in doubt. A file of another servo type, a file with a value that is not taken, a file that breaks a hard rule and a file that is not whole change nothing. A file that breaks soft rules waits for kst_prog_soft_confirm().
| p | The programmer state. |
| name | The file name. |
| kst_prog_file_kind_t kst_prog_load_kind | ( | const kst_prog_t * | p | ) |
What the file last loaded is.
| p | The programmer state. |
| unsigned kst_prog_load_named | ( | const kst_prog_t * | p, |
| unsigned * | fields ) |
The fields the file last loaded gives a value for, and through fields, when not NULL, the named fields a file has: 0 where the card's side did not count them.
| p | The programmer state. |
| fields | Receives the field set, or NULL. |
| kst_field_set_t kst_prog_load_skipped | ( | const kst_prog_t * | p | ) |
The fields in which the file in the draft differs from the servo and that are never written; 0 once the servo is read again or the draft is discarded.
| p | The programmer state. |
| const char * kst_prog_preset_name | ( | const kst_prog_t * | p | ) |
The next preset name as the last list gave it; "" when none is left.
| p | The programmer state. |
| kst_prog_msg_id_t kst_prog_save | ( | kst_prog_t * | p, |
| const char * | name ) |
Save the servo's image to a new file with name.
The card's side says whether the name is one a file may have; a file is never replaced.
| p | The programmer state. |
| name | The file name. |
|
static |
Takes the answer of a list.
| p | The programmer state. |
| d | The answer of the card. |
|
static |
Takes the answer of a load.
| p | The programmer state. |
| d | The answer of the card. |
|
static |
What a load needs of the servo, when it is asked for and when the file is there.
| p | The programmer state. |
| arg | Receives the argument of that message. |
|
static |
Copies a file name, at most KST_PROG_NAME_MAX - 1 characters.
| to | Receives the name. |
| from | The name to copy. |
|
static |
Takes the answer of a save.
| p | The programmer state. |
| d | The answer of the card. |
|
static |
The card ends a save this model gave up at KST_PROG_CARD_MS.
The file is on the card: it is named, and it is the session's backup where a save by hand would be, so that the write that follows makes no second one.
| p | The programmer state. |
| d | The answer of the card. |