rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
kst_card.h File Reference

The card's side of the servo programmer's files: a save, a list and a load of kst_prog.h carried out on the card. More...

#include "kst_prog.h"
#include "kst_reg.h"
#include "kst_store.h"

Go to the source code of this file.

Macros

#define KST_CARD_LIST_MAX   64u
 File names a list holds at a time.

Functions

unsigned kst_card_type (const kst_image_t *img)
 The servo type of an image as a number the screen prints behind a "V": 6 or 8.
void kst_card_run (const kst_store_io_t *io, const kst_prog_card_req_t *req, kst_prog_card_done_t *done)
 Carry out req on the card behind io and write the answer to done.

Detailed Description

The card's side of the servo programmer's files: a save, a list and a load of kst_prog.h carried out on the card.

kst_prog.h asks in images and base names. This file answers with the text of kst_file.h, the names and the directory of kst_store.h and the servo type of kst_reg.h; it states none of the three itself. The card is reached through the 5 functions of kst_store_io_t, so the same code runs on a host without a card.

kst_card_run() blocks as long as the card does and works in static buffers: one caller at a time, on a task that may wait for the card, never inside a draw.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ KST_CARD_LIST_MAX

#define KST_CARD_LIST_MAX   64u

File names a list holds at a time.

A list reaches every file of the directory: for a page behind the first KST_CARD_LIST_MAX files the directory is walked once more per KST_CARD_LIST_MAX files, or fewer by up to KST_PROG_FILES_MAX, in front of the page.

Function Documentation

◆ kst_card_run()

void kst_card_run ( const kst_store_io_t * io,
const kst_prog_card_req_t * req,
kst_prog_card_done_t * done )

Carry out req on the card behind io and write the answer to done.

Every request gets an answer.

KST_PROG_CARD_SAVE writes the text of req->image to a new file: named by kst_store_preset() for a preset save, else req->name. No file is replaced.

KST_PROG_CARD_LIST gives the base names of up to KST_PROG_FILES_MAX files from req->first on in the order of kst_store_list(), the latest proposed name first among the proposed ones, each with the servo type its text states, and the next preset name. done->total is the number of servo files in the directory, 65535 for that many or more.

KST_PROG_CARD_LOAD reads the file of req->name and holds it against req->image with kst_file_load(): done->image is the servo's image with the editable fields of the file.

Parameters
ioThe store the request is carried out on.
reqThe request.
doneReceives the answer.

◆ kst_card_type()

unsigned kst_card_type ( const kst_image_t * img)

The servo type of an image as a number the screen prints behind a "V": 6 or 8.

0 for NULL.

Parameters
imgThe image to read.
Returns
6 or 8; 0 for NULL.