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

The state of the programmer for KST and Chaservo servos: see kst_prog.h. More...

#include "kst_prog.h"
#include <string.h>
#include "kst_prog_int.h"

Macros

#define RUN_FIELDS

Functions

static uint8_t pin_of (const kst_prog_t *p, uint8_t port)
 The GPIO programming port port drives as the feed says, or KST_PROG_NO_PIN.
unsigned kst_prog_journal_arg (const kst_prog_t *p)
 The argument of the journal's messages: the port + 1 in bits 0-7, the pin + 1 in bits 8-15, 0 there when the pin is not known.
bool kst_prog_same (const kst_image_t *a, const kst_image_t *b)
 Whether two images hold the same values.
static bool is_write (unsigned op)
 Whether an operation writes the servo.
unsigned kst_prog_lowest (uint64_t set)
 The index of the lowest field bit set in a set.
unsigned kst_prog_ones (uint64_t set)
 The number of field bits set in a set.
static kst_prog_level_t level_of (unsigned id)
 The level of a message.
kst_prog_msg_id_t kst_prog_say_reg (kst_prog_t *p, unsigned id, unsigned arg, unsigned reg)
 Sets the message with an argument and a register.
kst_prog_msg_id_t kst_prog_say (kst_prog_t *p, unsigned id, unsigned arg)
 Sets the message with an argument.
static void hush (kst_prog_t *p)
 The last message no longer describes what is shown: an edit was taken, the switch went on, the pending values went.
static void file_want (kst_prog_t *p, uint8_t what)
 Asks for a file before the next write.
static void journal_clear (kst_prog_t *p)
 Clears the journal record and its pin.
static bool flag (const kst_prog_t *p, uint16_t f)
 Whether a flag of the status read is set.
static void session_gone (kst_prog_t *p)
 The session no longer stands: the port is in PWM, the link went, or the IOmcu started again.
bool kst_prog_field_editable (kst_field_id_t id)
 Whether a field may be edited.
kst_field_set_t kst_prog_differ (const kst_image_t *a, const kst_image_t *b)
 The fields in which two images differ.
kst_rules_t kst_prog_hard_new (const kst_prog_t *p, const kst_image_t *target)
 The hard rules the target image breaks.
static kst_rules_t soft_new (const kst_prog_t *p, const kst_image_t *target)
 The soft rules target breaks as a step from the servo as last read: what a restore is checked with, which moves the servo back and is warned of by where it moves from.
static const kst_image_t * soft_base (const kst_prog_t *p)
 The image the soft rules compare with: the servo as the session found it, so that the writes of a session do not add up unseen.
static kst_rules_t soft_of (const kst_prog_t *p, const kst_image_t *img)
 The soft rules an image breaks against the soft base.
static kst_rules_t soft_by (const kst_prog_t *p, const kst_image_t *img, kst_field_id_t id)
 The soft rules of img that field id is at fault for: the ones that go when the field takes the base's value.
static bool further (uint16_t raw, uint16_t conf, uint16_t base)
 Whether raw is further from the base's value base than conf, the value confirmed, or on its other side.
static uint16_t confirmed (const kst_prog_t *p, kst_field_id_t id)
 The value of id the operator has confirmed a soft rule for; what the servo holds where none was.
kst_rules_t kst_prog_soft_asks (const kst_prog_t *p, const kst_image_t *from, const kst_image_t *target)
 The soft rules an edit from one image to another asks about.
static void confirm (kst_prog_t *p, const kst_image_t *from, const kst_image_t *img)
 The values of img that differ from from are confirmed.
const kst_image_t * kst_prog_soft_base (const kst_prog_t *p)
 The image the soft rules compare with: the backup of the IOmcu's session, the servo as the session first read it.
kst_field_set_t kst_prog_soft_fields (const kst_prog_t *p, const kst_image_t *img)
 The fields of img that differ from the servo and are at fault for a soft rule: the rule goes when the field takes the value of kst_prog_soft_base().
static bool raw_taken (const kst_prog_t *p, kst_field_id_t id, uint16_t raw)
 Whether a raw value is taken for a field of the draft.
void kst_prog_send (kst_prog_t *p, const kst_link_request_t *req)
 Queues a command for the task that owns the link module.
static kst_link_request_t request (const kst_prog_t *p, link_kst_op_t op)
 Builds the link request for an operation.
static bool waits_unsent (const kst_prog_t *p)
 Whether the programmer waits on a card or a command that is not sent.
void kst_prog_card_ask (kst_prog_t *p, kst_prog_card_op_t op, const char *name)
 Asks the card side for a save, a list or a load.
void kst_prog_write_go (kst_prog_t *p)
 Starts the write that is held: its journal, its file, then the request.
static void send_write (kst_prog_t *p, const kst_link_request_t *req, const kst_image_t *target)
 A write to the servo.
static kst_prog_state_t port_state (const kst_prog_t *p)
 The state the link and the port report, an operation of this model awaited or queued left out.
static kst_prog_msg_id_t state_gate (kst_prog_state_t st)
 Whether an operation may start in a state; the message when not.
static kst_prog_msg_id_t idle (const kst_prog_t *p)
 Whether an operation may start now; the message when not.
static bool bench_armed (const kst_prog_t *p)
 Whether the bench is armed.
static kst_prog_msg_id_t idle_safe (const kst_prog_t *p)
 The same for an operation that sends frames: not after STOP, and not on an armed bench.
kst_prog_msg_id_t kst_prog_held_gate (const kst_prog_t *p)
 The start gate of the held write as it is now, the wait for its own files left out: the port in PROGRAMMING and idle, the port the write was held for, no STOP, the bench not ARMED and the switch on.
static void doubt (kst_prog_t *p)
 What the servo holds is not known until a read ends: nothing is written to it, and the switch a write needs is off with what it was held for.
static void adopt (kst_prog_t *p)
 Adopts the image the link read as the servo image.
static uint32_t journal_detours (const kst_prog_t *p)
 The registers a plan of the record's write may set to a value that is neither the record's nor the target's: the low register of every field in two registers that the write changes (kst_plan.h, the extra write).
static bool journal_fits (const kst_prog_t *p)
 Whether the servo read can be the one the journal records: on its port, and holding in every register the record's value or the target's.
static kst_prog_msg_id_t journal_asks (const kst_prog_t *p)
 The record held and a servo read that holds the record's image or its target, register for register: a servo of the same type with the same settings holds them too, so the record stands until the operator says that this is the servo of the write.
kst_prog_msg_id_t kst_prog_journal_asks (const kst_prog_t *p)
 The servo read holds, register for register, the record's image (KST_PROG_MSG_JOURNAL_SAME) or the write's target (KST_PROG_MSG_JOURNAL_DONE), and the record stands: a second servo with the same settings is not told apart from the one of the write.
bool kst_prog_journal_classify (kst_prog_t *p)
 Classifies the held journal record against the servo read.
static void read_done (kst_prog_t *p)
 Takes the result of a read of the servo.
static void done_ok (kst_prog_t *p, unsigned op)
 Takes the end of an operation that succeeded.
kst_prog_res_t kst_prog_result_class (unsigned result)
 The class of result, a kst_ses_t or a LINK_KST_RESULT_ value.
static void keep_now (kst_prog_t *p)
 The pending values and the prompt as they are, for a write that ends with nothing written.
static void keep_back (kst_prog_t *p)
 The pending values of before a write that wrote nothing.
static bool write_failed (kst_prog_t *p, const kst_link_outcome_t *o)
 A write that ended without the servo verified.
static void outcome (kst_prog_t *p, const kst_link_outcome_t *o)
 Takes the outcome of an operation.
static bool outcome_due (const kst_prog_t *p, const kst_link_outcome_t *o)
 Whether an outcome is taken.
void kst_prog_not_started (kst_prog_t *p, unsigned id, unsigned arg)
 Ends a command that was not taken, with its message.
static bool taken_back (kst_prog_t *p)
 The START awaited is taken back at the gate: the link's task takes it out of its queue and drops it, whenever that is.
static void unanswered (kst_prog_t *p, unsigned id)
 A START nobody answers.
static void leave_old (kst_prog_t *p)
 An IOmcu below link 4.15 has no LEAVE.
void kst_prog_init (kst_prog_t *p)
 Sets up the programmer state.
void kst_prog_gate_set (kst_prog_t *p, kst_prog_gate_t *g)
 The gate the link's task claims each START at.
void kst_prog_gate_init (kst_prog_gate_t *g)
 Sets up a START gate.
void kst_prog_gate_offer (kst_prog_gate_t *g, uint32_t id)
 The pass of START id is there to be taken.
static bool gate_take (kst_prog_gate_t *g, uint32_t id)
 The pass of id, taken by whoever asks first.
bool kst_prog_gate_claim (kst_prog_gate_t *g, uint32_t id)
 The link's task, with a START out of its queue: true when the command is to be carried out.
bool kst_prog_gate_revoke (kst_prog_gate_t *g, uint32_t id)
 The model: true when START id is not carried out and never is.
void kst_prog_screen_entry (kst_prog_t *p)
 The screen was entered: ENABLE WRITE TO SERVO goes off.
void kst_prog_feed (kst_prog_t *p, const kst_prog_feed_t *f)
 The published state of this frame.
bool kst_prog_take (kst_prog_t *p, kst_prog_cmd_t *out)
 The next command for the task that owns the link module; false for none.
kst_prog_state_t kst_prog_state (const kst_prog_t *p)
 The programmer state.
bool kst_prog_writing (const kst_prog_t *p)
 A write, a restore or a release is on its way or runs under this model: the record of it is no interrupted write yet.
unsigned kst_prog_write_steps (const kst_prog_t *p)
 The registers that write writes, as this model planned it; 0 when no write runs or the IOmcu alone plans it (a restore with no checked order, a release).
bool kst_prog_planning (const kst_prog_t *p)
 The IOmcu plans the order of a write's or a restore's writes: no frame goes to the servo yet.
link_kst_op_t kst_prog_op (const kst_prog_t *p)
 The operation on its way or running; LINK_KST_OP_NONE for none.
const kst_prog_msg_t * kst_prog_message (const kst_prog_t *p)
 The last message.
bool kst_prog_have_servo (const kst_prog_t *p)
 Whether a servo was read.
bool kst_prog_editable (const kst_prog_t *p)
 A servo was read, its image passes the fingerprint and is not in doubt: it may be edited and written.
const kst_image_t * kst_prog_servo (const kst_prog_t *p)
 The servo's image as last read.
const kst_image_t * kst_prog_draft (const kst_prog_t *p)
 The draft image being edited.
bool kst_prog_write_enabled (const kst_prog_t *p)
 Whether the write switch is on.
uint8_t kst_prog_port (const kst_prog_t *p)
 The programming port.
bool kst_prog_journal (const kst_prog_t *p)
 A write was interrupted and the servo was not compared since.
bool kst_prog_journal_held (const kst_prog_t *p)
 A record of an interrupted write is held, read back or not: the one RESTORE offers the values of.
bool kst_prog_journal_other (const kst_prog_t *p)
 The servo read cannot be the one of the interrupted write: it is on another port, or a register of it holds neither the record's value nor the write's target.
uint8_t kst_prog_journal_port (const kst_prog_t *p)
 The port of the interrupted write, from 0.
uint8_t kst_prog_journal_pin (const kst_prog_t *p)
 The GPIO that port drove at the write, or KST_PROG_NO_PIN: not known, or a record of version 1.
bool kst_prog_in_doubt (const kst_prog_t *p)
 The servo may hold part of a write: a journal stands, the port asks for a read, an operation timed out, or the session is locked.
bool kst_prog_first_write (const kst_prog_t *p)
 No write was sent since the servo was connected: the next asks for the free horn.
bool kst_prog_backed_up (const kst_prog_t *p)
 A file holds the servo as this session found it: the next write waits for no save.
const char * kst_prog_backup_name (const kst_prog_t *p)
 That file's name; "" while there is none.
bool kst_prog_no_file (const kst_prog_t *p)
 A write of this session started with no card in the slot, and no file holds the servo as the session found it: the session's backup is the one copy.
static bool maybe_written (const kst_prog_t *p)
 Whether the servo may hold other values than the session found: after a write that went with no card, and in a session whose writes this model did not all see, one the IOmcu kept over a link loss or a start of the panel.
const kst_image_t * kst_prog_file_image (const kst_prog_t *p)
 The image the file before a write takes: the servo as the session found it.
bool kst_prog_run_matches (const kst_prog_t *p)
 The servo read differs from the run's in LEFT ANGLE, RIGHT ANGLE, PULSE LOWER and PULSE UPPER at most.
bool kst_prog_save_first (const kst_prog_t *p)
 The next write saves the servo as the session found it to a file first.
bool kst_prog_save_none (const kst_prog_t *p)
 That write goes without the file: no card is mounted, or the servo may hold other values than the session found and the session's backup, the image the file takes then, is not fetched.
kst_field_set_t kst_prog_changed (const kst_prog_t *p)
 The fields in which the draft differs from the servo, register 01's copy of Max.
unsigned kst_prog_changes (const kst_prog_t *p)
 The number of fields the draft differs in.
kst_rules_t kst_prog_rules (const kst_prog_t *p)
 The rules the draft breaks as an edit of the servo's image.
bool kst_prog_range (const kst_prog_t *p, kst_field_id_t id, uint16_t *lo, uint16_t *hi)
 The raw values of id the hard rules accept in the draft as it is, as the lowest and the highest.
kst_prog_edit_t kst_prog_edit (kst_prog_t *p, kst_field_id_t id, uint16_t raw)
 Set a field of the draft to raw.
kst_prog_edit_t kst_prog_step (kst_prog_t *p, kst_field_id_t id, int dir)
 One raw count up (dir above 0) or down.
kst_rules_t kst_prog_soft_rules (const kst_prog_t *p)
 The soft rules the edit that waits asks a confirmation for; 0 while none waits.
const kst_image_t * kst_prog_soft_image (const kst_prog_t *p)
 The image the edit that waits would leave.
static unsigned loaded_message (const kst_prog_t *p)
 The message for a loaded file, by its kind.
void kst_prog_load_take (kst_prog_t *p, const kst_image_t *target)
 Takes a loaded file's target into the draft.
void kst_prog_soft_confirm (kst_prog_t *p)
 Confirms the waiting soft edit.
void kst_prog_soft_cancel (kst_prog_t *p)
 Drops the waiting soft edit.
bool kst_prog_soft_is_load (const kst_prog_t *p)
 The edit that waits for kst_prog_soft_confirm() is a file.
void kst_prog_discard (kst_prog_t *p)
 The draft becomes the servo's image again, and no value counts as confirmed.
static kst_prog_msg_id_t from_pwm (const kst_prog_t *p, uint8_t port)
 What keeps the tester's port from an ENTER.
kst_prog_msg_id_t kst_prog_connect (kst_prog_t *p, uint8_t port)
 Take programming port port, from 0, with the supply set by kst_prog_supply_set().
void kst_prog_bench_armed (kst_prog_t *p, bool armed)
 The bench is armed or asked to arm.
bool kst_prog_port_taken (const kst_link_readout_t *rd)
 Whether the bench takes no arm by what the link module reads: an operation is on its way or runs, the port is read and is not in PWM, or the page answers and is not read yet (KST_LINK_SYNC).
bool kst_prog_holds_port (const kst_prog_t *p)
 Whether nothing but the programmer reaches the port: an operation of this model is on its way or a session is open (ENTERING, PROGRAMMING, WORKING, LEAVING), or kst_prog_port_taken() says so of the readout last fed.
void kst_prog_supply_set (kst_prog_t *p, uint16_t mv, uint16_t ma)
 What an ENTER asks of the PD mini: mv and its current limit ma.
void kst_prog_supply_caps (kst_prog_t *p, uint16_t max_mv, uint16_t max_ma)
 The highest voltage and current limit the operator lets the supply give (the SUPPLY screen's limits), 0 for none.
void kst_prog_supply_floor (kst_prog_t *p, uint16_t min_mv)
 The lowest voltage a session runs at, mV; 0 for none.
uint16_t kst_prog_supply_mv (const kst_prog_t *p)
 The voltage an ENTER asks for, in mV.
uint16_t kst_prog_supply_ma (const kst_prog_t *p)
 The current limit an ENTER asks for, in mA.
kst_prog_msg_id_t kst_prog_read (kst_prog_t *p)
 Asks for a read of the servo.
kst_prog_msg_id_t kst_prog_verify (kst_prog_t *p)
 Asks for a check of the servo's image.
bool kst_prog_restore_only (const kst_prog_t *p)
 The session is locked and its backup is held: the switch is taken with no servo read, and the restore of that backup is the one write that goes.
kst_prog_msg_id_t kst_prog_enable_check (const kst_prog_t *p)
 What kst_prog_enable() would refuse the switch for, and nothing said; KST_PROG_MSG_NONE where it goes on.
kst_prog_msg_id_t kst_prog_enable (kst_prog_t *p, bool on)
 The switch.
static kst_prog_msg_id_t write_ready (const kst_prog_t *p, unsigned *arg)
 What a write of the draft needs, the switch left out.
static kst_prog_msg_id_t session_restore_ready (const kst_prog_t *p, unsigned *arg)
 The session's restore while the servo's image is in doubt: taken in a locked session, where it is the one write, and after a read otherwise.
static kst_prog_msg_id_t plan_message (kst_plan_result_t r, kst_rules_t broken, unsigned *arg)
 The message for a plan result.
static kst_prog_msg_id_t write_check (kst_prog_t *p, unsigned *arg)
 Checks whether a write may go.
kst_prog_msg_id_t kst_prog_write_check (kst_prog_t *p)
 Whether kst_prog_write() would be sent, without sending it.
static kst_prog_msg_id_t write_draft (kst_prog_t *p, kst_prog_from_t from)
 Writes the draft to the servo.
kst_prog_msg_id_t kst_prog_write (kst_prog_t *p)
 Write the draft.
static kst_prog_msg_id_t release_check (kst_prog_t *p, unsigned *arg)
 Checks whether a release may go.
kst_prog_msg_id_t kst_prog_release_check (kst_prog_t *p)
 The same for kst_prog_release().
kst_prog_msg_id_t kst_prog_release (kst_prog_t *p)
 Releases the servo.
bool kst_prog_backup_other (const kst_prog_t *p)
 The servo read is not the one the session's backup was read from: the two differ in a field no write of the session set out to change.
static const kst_image_t * source (const kst_prog_t *p, kst_prog_from_t from)
static kst_prog_msg_id_t from_none (const kst_prog_t *p, kst_prog_from_t from)
 Why source() gives none.
bool kst_prog_restore_offered (const kst_prog_t *p, kst_prog_from_t from)
 Whether from holds an image that differs from the servo.
static unsigned editable_target (const kst_prog_t *p, const kst_image_t *src, kst_image_t *target, unsigned *stay)
 What a restore from a record or a file writes: the servo's image with the editable fields of src.
kst_prog_msg_id_t kst_prog_restore_plan (kst_prog_t *p, kst_prog_from_t from, kst_prog_restore_t *out)
 Prepare a restore.
static kst_prog_msg_id_t restore_editable (kst_prog_t *p, kst_prog_from_t from, const kst_image_t *src)
 The confirmed restore from a record or a file: its values become the pending ones and go out as an ordinary write.
kst_prog_msg_id_t kst_prog_restore (kst_prog_t *p, const kst_prog_restore_t *plan)
 Run the restore prepared.
bool kst_prog_run_hold (kst_prog_t *p)
 Hold the servo as read now as the run's.
void kst_prog_run_written (kst_prog_t *p)
 The run's first write was sent, whether it ended well or not: the file it saved, if any, holds the servo as held.
void kst_prog_run_close (kst_prog_t *p)
 The run is over: the servo stays held for RESTORE, and a later session's first write saves its own file again.
void kst_prog_run_drop (kst_prog_t *p)
 Nothing held.
const kst_image_t * kst_prog_run_image (const kst_prog_t *p)
 The servo the run held, or NULL.
const char * kst_prog_run_backup (const kst_prog_t *p)
 The file of that servo; "" for none: no card, or the first write not ended yet.
void kst_prog_forget (kst_prog_t *p)
 Discard the journal.
kst_prog_msg_id_t kst_prog_leave (kst_prog_t *p)
 End the session: the port goes back to PWM and the supply stays as it is.
bool kst_prog_wait_set (kst_prog_t *p, uint32_t ms)
 The wait between the end of a session and the first PWM pulse, up to KST_PROG_WAIT_MAX_MS.
uint16_t kst_prog_wait_ms (const kst_prog_t *p)
 The wait before the first PWM pulse.
void kst_prog_abort (kst_prog_t *p)
 The operator's cancel.

Detailed Description

The state of the programmer for KST and Chaservo servos: see kst_prog.h.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ RUN_FIELDS

#define RUN_FIELDS
Value:
#define KST_FIELD_BIT(id)
The bit of field id in a kst_field_set_t.
Definition kst_reg.h:112
@ KST_F_LEFT_ANGLE
Definition kst_reg.h:85
@ KST_F_PULSE_LOWER
Definition kst_reg.h:75
@ KST_F_RIGHT_ANGLE
Definition kst_reg.h:86
@ KST_F_PULSE_UPPER
Definition kst_reg.h:76

Function Documentation

◆ adopt()

void adopt ( kst_prog_t * p)
static

Adopts the image the link read as the servo image.

Parameters
pThe programmer state.

◆ bench_armed()

bool bench_armed ( const kst_prog_t * p)
static

Whether the bench is armed.

Parameters
pThe programmer state.
Returns
true when the programmer or the feed says so.

◆ confirm()

void confirm ( kst_prog_t * p,
const kst_image_t * from,
const kst_image_t * img )
static

The values of img that differ from from are confirmed.

Parameters
pThe programmer state.
fromThe image before the edit.
imgThe image whose values are confirmed.

◆ confirmed()

uint16_t confirmed ( const kst_prog_t * p,
kst_field_id_t id )
static

The value of id the operator has confirmed a soft rule for; what the servo holds where none was.

Parameters
pThe programmer state.
idThe field.
Returns
The confirmed raw value, or the servo's value where none was.

◆ done_ok()

void done_ok ( kst_prog_t * p,
unsigned op )
static

Takes the end of an operation that succeeded.

Parameters
pThe programmer state.
opThe operation.

◆ doubt()

void doubt ( kst_prog_t * p)
static

What the servo holds is not known until a read ends: nothing is written to it, and the switch a write needs is off with what it was held for.

Parameters
pThe programmer state.

◆ editable_target()

unsigned editable_target ( const kst_prog_t * p,
const kst_image_t * src,
kst_image_t * target,
unsigned * stay )
static

What a restore from a record or a file writes: the servo's image with the editable fields of src.

Returns the fields that change and gives the ones that differ and stay in stay.

Parameters
pThe programmer state.
srcThe source image.
targetReceives the target image.
stayReceives the fields that stay.
Returns
The count of fields the target differs in.

◆ file_want()

void file_want ( kst_prog_t * p,
uint8_t what )
static

Asks for a file before the next write.

Parameters
pThe programmer state.
whatThe file step asked for.

◆ flag()

bool flag ( const kst_prog_t * p,
uint16_t f )
static

Whether a flag of the status read is set.

Parameters
pThe programmer state.
fThe flag bit.
Returns
true when the flag is set in a known read.

◆ from_none()

kst_prog_msg_id_t from_none ( const kst_prog_t * p,
kst_prog_from_t from )
static

Why source() gives none.

Parameters
pThe programmer state.
fromThe source of the image.
Returns
The message id.

◆ from_pwm()

kst_prog_msg_id_t from_pwm ( const kst_prog_t * p,
uint8_t port )
static

What keeps the tester's port from an ENTER.

Parameters
pThe programmer state.
portThe port, from 0.
Returns
The message id, or KST_PROG_MSG_NONE.

◆ further()

bool further ( uint16_t raw,
uint16_t conf,
uint16_t base )
static

Whether raw is further from the base's value base than conf, the value confirmed, or on its other side.

Parameters
rawThe raw value.
confThe confirmed raw value.
baseThe base raw value.
Returns
true when raw is further from base than conf, or on its other side.

◆ gate_take()

bool gate_take ( kst_prog_gate_t * g,
uint32_t id )
static

The pass of id, taken by whoever asks first.

Parameters
gThe gate.
idThe START id.
Returns
true when the pass was taken.

◆ hush()

void hush ( kst_prog_t * p)
static

The last message no longer describes what is shown: an edit was taken, the switch went on, the pending values went.

A message of the danger level stays until the next one.

Parameters
pThe programmer state.

◆ idle()

kst_prog_msg_id_t idle ( const kst_prog_t * p)
static

Whether an operation may start now; the message when not.

Parameters
pThe programmer state.
Returns
KST_PROG_MSG_NONE when it may, else the message why not.

◆ idle_safe()

kst_prog_msg_id_t idle_safe ( const kst_prog_t * p)
static

The same for an operation that sends frames: not after STOP, and not on an armed bench.

Parameters
pThe programmer state.
Returns
KST_PROG_MSG_NONE when it may, else the message why not.

◆ is_write()

bool is_write ( unsigned op)
static

Whether an operation writes the servo.

Parameters
opThe operation.
Returns
true for WRITE, RESTORE or RELEASE.

◆ journal_asks()

kst_prog_msg_id_t journal_asks ( const kst_prog_t * p)
static

The record held and a servo read that holds the record's image or its target, register for register: a servo of the same type with the same settings holds them too, so the record stands until the operator says that this is the servo of the write.

Parameters
pThe programmer state.
Returns
The message id, or KST_PROG_MSG_NONE.

◆ journal_clear()

void journal_clear ( kst_prog_t * p)
static

Clears the journal record and its pin.

Parameters
pThe programmer state.

◆ journal_detours()

uint32_t journal_detours ( const kst_prog_t * p)
static

The registers a plan of the record's write may set to a value that is neither the record's nor the target's: the low register of every field in two registers that the write changes (kst_plan.h, the extra write).

Parameters
pThe programmer state.
Returns
A bit mask of those registers.

◆ journal_fits()

bool journal_fits ( const kst_prog_t * p)
static

Whether the servo read can be the one the journal records: on its port, and holding in every register the record's value or the target's.

A register the write leaves alone holds the record's value then; a field the write changes holds the one, the other, or a mix of their registers. The registers of journal_detours() are exempt. A servo of the same type with other settings does not fit.

Parameters
pThe programmer state.
Returns
true when it can.

◆ keep_back()

void keep_back ( kst_prog_t * p)
static

The pending values of before a write that wrote nothing.

Parameters
pThe programmer state.

◆ keep_now()

void keep_now ( kst_prog_t * p)
static

The pending values and the prompt as they are, for a write that ends with nothing written.

Parameters
pThe programmer state.

◆ kst_prog_abort()

void kst_prog_abort ( kst_prog_t * p)

The operator's cancel.

Parameters
pThe programmer state.

◆ kst_prog_backed_up()

bool kst_prog_backed_up ( const kst_prog_t * p)

A file holds the servo as this session found it: the next write waits for no save.

Parameters
pThe programmer state.
Returns
true when a file holds the servo as the session found it.

◆ kst_prog_backup_name()

const char * kst_prog_backup_name ( const kst_prog_t * p)

That file's name; "" while there is none.

Parameters
pThe programmer state.
Returns
The backup file's name, or an empty string.

◆ kst_prog_backup_other()

bool kst_prog_backup_other ( const kst_prog_t * p)

The servo read is not the one the session's backup was read from: the two differ in a field no write of the session set out to change.

The backup is not offered and not restored until a new session reads its own. Two servos that agree in every such field are not told apart. Never true for a session this model did not see begin, after a link loss or a start of the panel under a session: its writes are not known.

Parameters
pThe programmer state.
Returns
true when the servo read is not the one the session's backup was read from.

◆ kst_prog_bench_armed()

void kst_prog_bench_armed ( kst_prog_t * p,
bool armed )

The bench is armed or asked to arm.

Programming and an armed bench are exclusive: while this is set or the feed reports armed outputs no port is taken and no operation that sends frames starts (KST_PROG_MSG_NEED_DISARM), and the caller takes no arm while a port is held.

Parameters
pThe programmer state.
armedtrue when the bench is armed or asked to arm.

◆ kst_prog_card_ask()

void kst_prog_card_ask ( kst_prog_t * p,
kst_prog_card_op_t op,
const char * name )

Asks the card side for a save, a list or a load.

Parameters
pThe programmer state.
opThe card operation.
nameThe file name, or NULL.

◆ kst_prog_changed()

kst_field_set_t kst_prog_changed ( const kst_prog_t * p)

The fields in which the draft differs from the servo, register 01's copy of Max.

Duty left out.

Parameters
pThe programmer state.
Returns
The fields in which the draft differs from the servo.

◆ kst_prog_changes()

unsigned kst_prog_changes ( const kst_prog_t * p)

The number of fields the draft differs in.

Parameters
pThe programmer state.
Returns
The number of changed fields.

◆ kst_prog_connect()

kst_prog_msg_id_t kst_prog_connect ( kst_prog_t * p,
uint8_t port )

Take programming port port, from 0, with the supply set by kst_prog_supply_set().

KST_PROG_MSG_NEED_TARGET while the feed's target is not that port, KST_PROG_MSG_NEED_DISARM on an armed bench.

Parameters
pThe programmer state.
portThe programming port, from 0.
Returns
The message for the connect attempt.

◆ kst_prog_differ()

kst_field_set_t kst_prog_differ ( const kst_image_t * a,
const kst_image_t * b )

The fields in which two images differ.

Parameters
aThe first image.
bThe second image.
Returns
The set of fields that differ.

◆ kst_prog_discard()

void kst_prog_discard ( kst_prog_t * p)

The draft becomes the servo's image again, and no value counts as confirmed.

Parameters
pThe programmer state.

◆ kst_prog_draft()

const kst_image_t * kst_prog_draft ( const kst_prog_t * p)

The draft image being edited.

Parameters
pThe programmer state.
Returns
The draft image.

◆ kst_prog_edit()

kst_prog_edit_t kst_prog_edit ( kst_prog_t * p,
kst_field_id_t id,
uint16_t raw )

Set a field of the draft to raw.

Parameters
pThe programmer state.
idThe field.
rawThe raw value to set.
Returns
The result of the edit.

◆ kst_prog_editable()

bool kst_prog_editable ( const kst_prog_t * p)

A servo was read, its image passes the fingerprint and is not in doubt: it may be edited and written.

Parameters
pThe programmer state.
Returns
true when the servo may be edited and written.

◆ kst_prog_enable()

kst_prog_msg_id_t kst_prog_enable ( kst_prog_t * p,
bool on )

The switch.

On is taken with a servo read that passes the fingerprint, and by a locked session that holds its backup.

Parameters
pThe programmer state.
ontrue to switch the write switch on.
Returns
The message for the switch.

◆ kst_prog_enable_check()

kst_prog_msg_id_t kst_prog_enable_check ( const kst_prog_t * p)

What kst_prog_enable() would refuse the switch for, and nothing said; KST_PROG_MSG_NONE where it goes on.

Parameters
pThe programmer state.
Returns
What enable would refuse the switch for, or KST_PROG_MSG_NONE.

◆ kst_prog_feed()

void kst_prog_feed ( kst_prog_t * p,
const kst_prog_feed_t * f )

The published state of this frame.

Outcomes and answers are taken here.

Parameters
pThe programmer state.
fThe inputs of this frame.

◆ kst_prog_field_editable()

bool kst_prog_field_editable ( kst_field_id_t id)

Whether a field may be edited.

Parameters
idThe field.
Returns
true when the field may be edited.

◆ kst_prog_file_image()

const kst_image_t * kst_prog_file_image ( const kst_prog_t * p)

The image the file before a write takes: the servo as the session found it.

Parameters
pThe programmer state.
Returns
The image the file takes.

◆ kst_prog_first_write()

bool kst_prog_first_write ( const kst_prog_t * p)

No write was sent since the servo was connected: the next asks for the free horn.

Parameters
pThe programmer state.
Returns
true when no write was sent since the servo was connected.

◆ kst_prog_forget()

void kst_prog_forget ( kst_prog_t * p)

Discard the journal.

KST_PROG_MSG_START + KST_LINK_START_BUSY, and nothing discarded, while an operation is on its way.

Parameters
pThe programmer state.

◆ kst_prog_gate_claim()

bool kst_prog_gate_claim ( kst_prog_gate_t * g,
uint32_t id )

The link's task, with a START out of its queue: true when the command is to be carried out.

False: it is dropped, with no answer.

Parameters
gThe gate.
idThe START's id.
Returns
true when the command is to be carried out.

◆ kst_prog_gate_init()

void kst_prog_gate_init ( kst_prog_gate_t * g)

Sets up a START gate.

Parameters
gThe gate to set up.

◆ kst_prog_gate_offer()

void kst_prog_gate_offer ( kst_prog_gate_t * g,
uint32_t id )

The pass of START id is there to be taken.

Parameters
gThe gate.
idThe START's id.

◆ kst_prog_gate_revoke()

bool kst_prog_gate_revoke ( kst_prog_gate_t * g,
uint32_t id )

The model: true when START id is not carried out and never is.

Parameters
gThe gate.
idThe START's id.
Returns
true when START id is not carried out and never is.

◆ kst_prog_gate_set()

void kst_prog_gate_set ( kst_prog_t * p,
kst_prog_gate_t * g )

The gate the link's task claims each START at.

With one set, a START nobody answers within KST_PROG_START_MS is revoked and was never carried out. With none set, such a START counts as one that may have run: the servo is read before anything else. kst_prog_init() sets none.

Parameters
pThe programmer state.
gThe gate, or NULL for none.

◆ kst_prog_hard_new()

kst_rules_t kst_prog_hard_new ( const kst_prog_t * p,
const kst_image_t * target )

The hard rules the target image breaks.

Parameters
pThe programmer state.
targetThe image to check.
Returns
The rules broken.

◆ kst_prog_have_servo()

bool kst_prog_have_servo ( const kst_prog_t * p)

Whether a servo was read.

Parameters
pThe programmer state.
Returns
true when a servo was read.

◆ kst_prog_held_gate()

kst_prog_msg_id_t kst_prog_held_gate ( const kst_prog_t * p)

The start gate of the held write as it is now, the wait for its own files left out: the port in PROGRAMMING and idle, the port the write was held for, no STOP, the bench not ARMED and the switch on.

Parameters
pThe programmer state.
Returns
KST_PROG_MSG_NONE when the write may go, else the message why not.

◆ kst_prog_holds_port()

bool kst_prog_holds_port ( const kst_prog_t * p)

Whether nothing but the programmer reaches the port: an operation of this model is on its way or a session is open (ENTERING, PROGRAMMING, WORKING, LEAVING), or kst_prog_port_taken() says so of the readout last fed.

The tester's target and the port's pulse stay as they are for as long (settings_held(), prog_link_hold()).

Parameters
pThe programmer state.
Returns
true when nothing but the programmer reaches the port.

◆ kst_prog_in_doubt()

bool kst_prog_in_doubt ( const kst_prog_t * p)

The servo may hold part of a write: a journal stands, the port asks for a read, an operation timed out, or the session is locked.

Parameters
pThe programmer state.
Returns
true when the servo may hold part of a write.

◆ kst_prog_init()

void kst_prog_init ( kst_prog_t * p)

Sets up the programmer state.

Parameters
pThe programmer state to set up.

◆ kst_prog_journal()

bool kst_prog_journal ( const kst_prog_t * p)

A write was interrupted and the servo was not compared since.

Parameters
pThe programmer state.
Returns
true while a write was interrupted and the servo was not compared since.

◆ kst_prog_journal_arg()

unsigned kst_prog_journal_arg ( const kst_prog_t * p)

The argument of the journal's messages: the port + 1 in bits 0-7, the pin + 1 in bits 8-15, 0 there when the pin is not known.

Parameters
pThe programmer state.
Returns
The argument of the journal's messages.

◆ kst_prog_journal_asks()

kst_prog_msg_id_t kst_prog_journal_asks ( const kst_prog_t * p)

The servo read holds, register for register, the record's image (KST_PROG_MSG_JOURNAL_SAME) or the write's target (KST_PROG_MSG_JOURNAL_DONE), and the record stands: a second servo with the same settings is not told apart from the one of the write.

Nothing is written to the servo until kst_prog_forget() discards the record. KST_PROG_MSG_NONE otherwise.

Parameters
pThe programmer state.
Returns
The message the journal asks for, or KST_PROG_MSG_NONE.

◆ kst_prog_journal_classify()

bool kst_prog_journal_classify ( kst_prog_t * p)

Classifies the held journal record against the servo read.

Parameters
pThe programmer state.
Returns
true when the record is another servo's.

◆ kst_prog_journal_held()

bool kst_prog_journal_held ( const kst_prog_t * p)

A record of an interrupted write is held, read back or not: the one RESTORE offers the values of.

Parameters
pThe programmer state.
Returns
true when a record of an interrupted write is held.

◆ kst_prog_journal_other()

bool kst_prog_journal_other ( const kst_prog_t * p)

The servo read cannot be the one of the interrupted write: it is on another port, or a register of it holds neither the record's value nor the write's target.

The low register of a field in two registers that the write changes is exempt: a plan may set it to a third value. Nothing is restored to it and nothing is written to it until the journal is discarded.

Parameters
pThe programmer state.
Returns
true when the servo read cannot be the interrupted write's servo.

◆ kst_prog_journal_pin()

uint8_t kst_prog_journal_pin ( const kst_prog_t * p)

The GPIO that port drove at the write, or KST_PROG_NO_PIN: not known, or a record of version 1.

Parameters
pThe programmer state.
Returns
The GPIO that port drove, or KST_PROG_NO_PIN.

◆ kst_prog_journal_port()

uint8_t kst_prog_journal_port ( const kst_prog_t * p)

The port of the interrupted write, from 0.

Parameters
pThe programmer state.
Returns
The port of the interrupted write, from 0.

◆ kst_prog_leave()

kst_prog_msg_id_t kst_prog_leave ( kst_prog_t * p)

End the session: the port goes back to PWM and the supply stays as it is.

The one place a session is ended by the operator. While a PD mini answers the port has no command for it and the answer is KST_PROG_MSG_LEAVE_SUPPLY.

Parameters
pThe programmer state.
Returns
The message id.

◆ kst_prog_load_take()

void kst_prog_load_take ( kst_prog_t * p,
const kst_image_t * target )

Takes a loaded file's target into the draft.

Parameters
pThe programmer state.
targetThe file's target image.

◆ kst_prog_lowest()

unsigned kst_prog_lowest ( uint64_t set)

The index of the lowest field bit set in a set.

Parameters
setA set of fields, one bit each.
Returns
The index of the lowest bit set in set.

◆ kst_prog_message()

const kst_prog_msg_t * kst_prog_message ( const kst_prog_t * p)

The last message.

Parameters
pThe programmer state.
Returns
The last message, or NULL.

◆ kst_prog_no_file()

bool kst_prog_no_file ( const kst_prog_t * p)

A write of this session started with no card in the slot, and no file holds the servo as the session found it: the session's backup is the one copy.

Ends with the next file a write saves.

Parameters
pThe programmer state.
Returns
true when the session's backup is the one copy.

◆ kst_prog_not_started()

void kst_prog_not_started ( kst_prog_t * p,
unsigned id,
unsigned arg )

Ends a command that was not taken, with its message.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.

◆ kst_prog_ones()

unsigned kst_prog_ones ( uint64_t set)

The number of field bits set in a set.

Parameters
setA set of fields, one bit each.
Returns
The number of bits set in set.

◆ kst_prog_op()

link_kst_op_t kst_prog_op ( const kst_prog_t * p)

The operation on its way or running; LINK_KST_OP_NONE for none.

Parameters
pThe programmer state.
Returns
The operation, as link_kst_op_t.

◆ kst_prog_planning()

bool kst_prog_planning ( const kst_prog_t * p)

The IOmcu plans the order of a write's or a restore's writes: no frame goes to the servo yet.

Parameters
pThe programmer state.
Returns
true while the IOmcu plans the order of the writes.

◆ kst_prog_port()

uint8_t kst_prog_port ( const kst_prog_t * p)

The programming port.

Parameters
pThe programmer state.
Returns
The port the session holds, from 0.

◆ kst_prog_port_taken()

bool kst_prog_port_taken ( const kst_link_readout_t * rd)

Whether the bench takes no arm by what the link module reads: an operation is on its way or runs, the port is read and is not in PWM, or the page answers and is not read yet (KST_LINK_SYNC).

False where no page answers: nothing can hold a port there.

Parameters
rdThe link module's readout.
Returns
true when the bench takes no arm by what the link module reads.

◆ kst_prog_range()

bool kst_prog_range ( const kst_prog_t * p,
kst_field_id_t id,
uint16_t * lo,
uint16_t * hi )

The raw values of id the hard rules accept in the draft as it is, as the lowest and the highest.

False when none is accepted, the field is not editable or no servo was read.

Parameters
pThe programmer state.
idThe field.
loReceives the lowest raw value accepted.
hiReceives the highest raw value accepted.
Returns
false when none is accepted, the field is not editable or no servo was read.

◆ kst_prog_read()

kst_prog_msg_id_t kst_prog_read ( kst_prog_t * p)

Asks for a read of the servo.

Parameters
pThe programmer state.
Returns
The message for the read.

◆ kst_prog_release()

kst_prog_msg_id_t kst_prog_release ( kst_prog_t * p)

Releases the servo.

Parameters
pThe programmer state.
Returns
The message for the release.

◆ kst_prog_release_check()

kst_prog_msg_id_t kst_prog_release_check ( kst_prog_t * p)

The same for kst_prog_release().

Parameters
pThe programmer state.
Returns
The message the release would give.

◆ kst_prog_restore()

kst_prog_msg_id_t kst_prog_restore ( kst_prog_t * p,
const kst_prog_restore_t * plan )

Run the restore prepared.

Parameters
pThe programmer state.
planThe plan from kst_prog_restore_plan().
Returns
The message for the restore.

◆ kst_prog_restore_offered()

bool kst_prog_restore_offered ( const kst_prog_t * p,
kst_prog_from_t from )

Whether from holds an image that differs from the servo.

Parameters
pThe programmer state.
fromThe source of the image.
Returns
true when from holds an image that differs from the servo.

◆ kst_prog_restore_only()

bool kst_prog_restore_only ( const kst_prog_t * p)

The session is locked and its backup is held: the switch is taken with no servo read, and the restore of that backup is the one write that goes.

Every other write waits for a read and for the lock to end.

Parameters
pThe programmer state.
Returns
true when the switch is taken with no servo read and only the restore goes.

◆ kst_prog_restore_plan()

kst_prog_msg_id_t kst_prog_restore_plan ( kst_prog_t * p,
kst_prog_from_t from,
kst_prog_restore_t * out )

Prepare a restore.

For KST_PROG_FROM_JOURNAL the draft becomes the servo's image with the editable fields of the source.

Parameters
pThe programmer state.
fromThe source of the image.
outReceives the plan.
Returns
The message for the plan.

◆ kst_prog_result_class()

kst_prog_res_t kst_prog_result_class ( unsigned result)

The class of result, a kst_ses_t or a LINK_KST_RESULT_ value.

A value that is neither is KST_PROG_RES_DOUBT.

Parameters
resultThe result code.
Returns
The class of the result, as kst_prog_res_t.

◆ kst_prog_rules()

kst_rules_t kst_prog_rules ( const kst_prog_t * p)

The rules the draft breaks as an edit of the servo's image.

Parameters
pThe programmer state.
Returns
The rules the draft breaks as an edit of the servo image.

◆ kst_prog_run_backup()

const char * kst_prog_run_backup ( const kst_prog_t * p)

The file of that servo; "" for none: no card, or the first write not ended yet.

Parameters
pThe programmer state.
Returns
The file name the run wrote, or an empty string.

◆ kst_prog_run_close()

void kst_prog_run_close ( kst_prog_t * p)

The run is over: the servo stays held for RESTORE, and a later session's first write saves its own file again.

Parameters
pThe programmer state.

◆ kst_prog_run_drop()

void kst_prog_run_drop ( kst_prog_t * p)

Nothing held.

Parameters
pThe programmer state.

◆ kst_prog_run_hold()

bool kst_prog_run_hold ( kst_prog_t * p)

Hold the servo as read now as the run's.

False, and nothing held, with no servo read.

Parameters
pThe programmer state.
Returns
true when the hold was taken, false with no servo read.

◆ kst_prog_run_image()

const kst_image_t * kst_prog_run_image ( const kst_prog_t * p)

The servo the run held, or NULL.

Parameters
pThe programmer state.
Returns
The held image, or NULL when no run holds one.

◆ kst_prog_run_matches()

bool kst_prog_run_matches ( const kst_prog_t * p)

The servo read differs from the run's in LEFT ANGLE, RIGHT ANGLE, PULSE LOWER and PULSE UPPER at most.

Parameters
pThe programmer state.
Returns
true when the servo differs from the held image only in the run fields.

◆ kst_prog_run_written()

void kst_prog_run_written ( kst_prog_t * p)

The run's first write was sent, whether it ended well or not: the file it saved, if any, holds the servo as held.

Parameters
pThe programmer state.

◆ kst_prog_same()

bool kst_prog_same ( const kst_image_t * a,
const kst_image_t * b )

Whether two images hold the same values.

Parameters
aThe first image.
bThe second image.
Returns
true when they are equal.

◆ kst_prog_save_first()

bool kst_prog_save_first ( const kst_prog_t * p)

The next write saves the servo as the session found it to a file first.

A mounted card that does not take the file ends the write. False while a record of an interrupted write is held: the servo may be half written, and the record holds it as found.

Parameters
pThe programmer state.
Returns
true when the next write saves the servo to a file first.

◆ kst_prog_save_none()

bool kst_prog_save_none ( const kst_prog_t * p)

That write goes without the file: no card is mounted, or the servo may hold other values than the session found and the session's backup, the image the file takes then, is not fetched.

Parameters
pThe programmer state.
Returns
true when that write goes without the file.

◆ kst_prog_say()

kst_prog_msg_id_t kst_prog_say ( kst_prog_t * p,
unsigned id,
unsigned arg )

Sets the message with an argument.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.
Returns
The message id.

◆ kst_prog_say_reg()

kst_prog_msg_id_t kst_prog_say_reg ( kst_prog_t * p,
unsigned id,
unsigned arg,
unsigned reg )

Sets the message with an argument and a register.

Parameters
pThe programmer state.
idThe message id.
argThe argument of the message.
regThe register the message names.
Returns
The message id.

◆ kst_prog_screen_entry()

void kst_prog_screen_entry ( kst_prog_t * p)

The screen was entered: ENABLE WRITE TO SERVO goes off.

Parameters
pThe programmer state.

◆ kst_prog_send()

void kst_prog_send ( kst_prog_t * p,
const kst_link_request_t * req )

Queues a command for the task that owns the link module.

Parameters
pThe programmer state.
reqThe request to send.

◆ kst_prog_servo()

const kst_image_t * kst_prog_servo ( const kst_prog_t * p)

The servo's image as last read.

Parameters
pThe programmer state.
Returns
The servo's image.

◆ kst_prog_soft_asks()

kst_rules_t kst_prog_soft_asks ( const kst_prog_t * p,
const kst_image_t * from,
const kst_image_t * target )

The soft rules an edit from one image to another asks about.

Parameters
pThe programmer state.
fromThe image before the edit.
targetThe image after the edit.
Returns
The soft rules the edit asks a confirmation for.

◆ kst_prog_soft_base()

const kst_image_t * kst_prog_soft_base ( const kst_prog_t * p)

The image the soft rules compare with: the backup of the IOmcu's session, the servo as the session first read it.

The servo as last read while that backup is not held or is another servo's (kst_prog_backup_other()).

Parameters
pThe programmer state.
Returns
The image the soft rules compare with.

◆ kst_prog_soft_cancel()

void kst_prog_soft_cancel ( kst_prog_t * p)

Drops the waiting soft edit.

Parameters
pThe programmer state.

◆ kst_prog_soft_confirm()

void kst_prog_soft_confirm ( kst_prog_t * p)

Confirms the waiting soft edit.

Parameters
pThe programmer state.

◆ kst_prog_soft_fields()

kst_field_set_t kst_prog_soft_fields ( const kst_prog_t * p,
const kst_image_t * img )

The fields of img that differ from the servo and are at fault for a soft rule: the rule goes when the field takes the value of kst_prog_soft_base().

Parameters
pThe programmer state.
imgThe image to check.
Returns
The fields of img at fault for a soft rule.

◆ kst_prog_soft_image()

const kst_image_t * kst_prog_soft_image ( const kst_prog_t * p)

The image the edit that waits would leave.

Parameters
pThe programmer state.
Returns
The image the waiting edit would leave.

◆ kst_prog_soft_is_load()

bool kst_prog_soft_is_load ( const kst_prog_t * p)

The edit that waits for kst_prog_soft_confirm() is a file.

Parameters
pThe programmer state.
Returns
true when a soft edit waits and it came from a load.

◆ kst_prog_soft_rules()

kst_rules_t kst_prog_soft_rules ( const kst_prog_t * p)

The soft rules the edit that waits asks a confirmation for; 0 while none waits.

They are the rules it breaks and the draft does not, and the rules of a field it moves further from kst_prog_soft_base() than the value last confirmed for that field, or to its other side. A value the servo holds counts as confirmed.

Parameters
pThe programmer state.
Returns
The soft rules the waiting edit asks a confirmation for, or 0.

◆ kst_prog_state()

kst_prog_state_t kst_prog_state ( const kst_prog_t * p)

The programmer state.

Parameters
pThe programmer state.
Returns
The state, as kst_prog_state_t.

◆ kst_prog_step()

kst_prog_edit_t kst_prog_step ( kst_prog_t * p,
kst_field_id_t id,
int dir )

One raw count up (dir above 0) or down.

Parameters
pThe programmer state.
idThe field.
dirThe direction: above 0 counts up, else down.
Returns
The result of the edit.

◆ kst_prog_supply_caps()

void kst_prog_supply_caps ( kst_prog_t * p,
uint16_t max_mv,
uint16_t max_ma )

The highest voltage and current limit the operator lets the supply give (the SUPPLY screen's limits), 0 for none.

kst_prog_connect() is KST_PROG_MSG_SUPPLY_CAPS and asks nothing while a value of kst_prog_supply_set() is above its limit: a session never runs at values other than the ones shown. None after kst_prog_init().

Parameters
pThe programmer state.
max_mvThe highest voltage the supply may give, in mV, or 0 for none.
max_maThe highest current limit, in mA, or 0 for none.

◆ kst_prog_supply_floor()

void kst_prog_supply_floor ( kst_prog_t * p,
uint16_t min_mv )

The lowest voltage a session runs at, mV; 0 for none.

An ENTER lowers a PD mini output that is on to the session's voltage or leaves it, and never raises it: kst_prog_connect() is KST_PROG_MSG_REF + LINK_KST_REF_SUPPLY_LOW and asks nothing while the feed reads an output that is on (supply_read) and set (set_mv) under min_mv. The port of link version 4.15 refuses the same ENTER by that name; an IOmcu built before the refusal takes it, so the panel holds the floor for every peer. None after kst_prog_init().

Parameters
pThe programmer state.
min_mvThe lowest voltage a session runs at, in mV, or 0 for none.

◆ kst_prog_supply_ma()

uint16_t kst_prog_supply_ma ( const kst_prog_t * p)

The current limit an ENTER asks for, in mA.

Parameters
pThe programmer state.
Returns
The current limit, in mA.

◆ kst_prog_supply_mv()

uint16_t kst_prog_supply_mv ( const kst_prog_t * p)

The voltage an ENTER asks for, in mV.

Parameters
pThe programmer state.
Returns
The voltage, in mV.

◆ kst_prog_supply_set()

void kst_prog_supply_set ( kst_prog_t * p,
uint16_t mv,
uint16_t ma )

What an ENTER asks of the PD mini: mv and its current limit ma.

The port checks the range. KST_PROG_SUPPLY_MV and KST_PROG_SUPPLY_MA after kst_prog_init().

Parameters
pThe programmer state.
mvThe voltage an ENTER asks for, in mV.
maThe current limit an ENTER asks for, in mA.

◆ kst_prog_take()

bool kst_prog_take ( kst_prog_t * p,
kst_prog_cmd_t * out )

The next command for the task that owns the link module; false for none.

Parameters
pThe programmer state.
outReceives the command.
Returns
true when a command is taken.

◆ kst_prog_verify()

kst_prog_msg_id_t kst_prog_verify ( kst_prog_t * p)

Asks for a check of the servo's image.

Parameters
pThe programmer state.
Returns
The message for the check.

◆ kst_prog_wait_ms()

uint16_t kst_prog_wait_ms ( const kst_prog_t * p)

The wait before the first PWM pulse.

Parameters
pThe programmer state.
Returns
The wait, in ms.

◆ kst_prog_wait_set()

bool kst_prog_wait_set ( kst_prog_t * p,
uint32_t ms )

The wait between the end of a session and the first PWM pulse, up to KST_PROG_WAIT_MAX_MS.

False, and nothing set, above it.

Parameters
pThe programmer state.
msThe wait, in ms.
Returns
false when ms is above KST_PROG_WAIT_MAX_MS.

◆ kst_prog_write()

kst_prog_msg_id_t kst_prog_write ( kst_prog_t * p)

Write the draft.

The first write of a session saves the servo's image to a file before it and is not sent without one; the journal goes to its file before every write.

Parameters
pThe programmer state.
Returns
The message for the write.

◆ kst_prog_write_check()

kst_prog_msg_id_t kst_prog_write_check ( kst_prog_t * p)

Whether kst_prog_write() would be sent, without sending it.

Parameters
pThe programmer state.
Returns
The message the write would give.

◆ kst_prog_write_enabled()

bool kst_prog_write_enabled ( const kst_prog_t * p)

Whether the write switch is on.

Parameters
pThe programmer state.
Returns
true when ENABLE WRITE TO SERVO is on.

◆ kst_prog_write_go()

void kst_prog_write_go ( kst_prog_t * p)

Starts the write that is held: its journal, its file, then the request.

Parameters
pThe programmer state.

◆ kst_prog_write_steps()

unsigned kst_prog_write_steps ( const kst_prog_t * p)

The registers that write writes, as this model planned it; 0 when no write runs or the IOmcu alone plans it (a restore with no checked order, a release).

The register under way is not on the link page.

Parameters
pThe programmer state.
Returns
The registers the write writes, or 0.

◆ kst_prog_writing()

bool kst_prog_writing ( const kst_prog_t * p)

A write, a restore or a release is on its way or runs under this model: the record of it is no interrupted write yet.

Parameters
pThe programmer state.
Returns
true while a write, restore or release is on its way or runs.

◆ leave_old()

void leave_old ( kst_prog_t * p)
static

An IOmcu below link 4.15 has no LEAVE.

Its one command from PROGRAMMING to PWM is POWER_CYCLED, and with a PD mini answering the port cycles the supply on it: it is sent only where no PD mini answers, where it changes nothing but the port's state, and its end says that no wait was applied. With a PD mini the session stays and the message says what ends it.

Parameters
pThe programmer state.

◆ level_of()

kst_prog_level_t level_of ( unsigned id)
static

The level of a message.

Parameters
idThe message id.
Returns
The level, as kst_prog_level_t.

◆ loaded_message()

unsigned loaded_message ( const kst_prog_t * p)
static

The message for a loaded file, by its kind.

Parameters
pThe programmer state.
Returns
The message id.

◆ maybe_written()

bool maybe_written ( const kst_prog_t * p)
static

Whether the servo may hold other values than the session found: after a write that went with no card, and in a session whose writes this model did not all see, one the IOmcu kept over a link loss or a start of the panel.

The session's backup holds the servo as found then.

Parameters
pThe programmer state.
Returns
true when it may.

◆ outcome()

void outcome ( kst_prog_t * p,
const kst_link_outcome_t * o )
static

Takes the outcome of an operation.

Parameters
pThe programmer state.
oThe outcome.

◆ outcome_due()

bool outcome_due ( const kst_prog_t * p,
const kst_link_outcome_t * o )
static

Whether an outcome is taken.

The one of the operation awaited is, by its number. An IOmcu that started again ends whatever is awaited. The late end of a write given up is taken while nothing else is on its way; with another operation asked for, it is left out: the servo is in doubt already, and the operation asked for is not that outcome's.

Parameters
pThe programmer state.
oThe outcome.
Returns
true when the outcome is taken.

◆ pin_of()

uint8_t pin_of ( const kst_prog_t * p,
uint8_t port )
static

The GPIO programming port port drives as the feed says, or KST_PROG_NO_PIN.

Parameters
pThe programmer state.
portThe programming port, from 0.
Returns
The GPIO, or KST_PROG_NO_PIN.

◆ plan_message()

kst_prog_msg_id_t plan_message ( kst_plan_result_t r,
kst_rules_t broken,
unsigned * arg )
static

The message for a plan result.

Parameters
rThe plan result.
brokenThe rules the plan breaks.
argReceives the argument of the message.
Returns
The message id.

◆ port_state()

kst_prog_state_t port_state ( const kst_prog_t * p)
static

The state the link and the port report, an operation of this model awaited or queued left out.

Parameters
pThe programmer state.
Returns
The state.

◆ raw_taken()

bool raw_taken ( const kst_prog_t * p,
kst_field_id_t id,
uint16_t raw )
static

Whether a raw value is taken for a field of the draft.

Parameters
pThe programmer state.
idThe field.
rawThe raw value.
Returns
true when no hard rule is broken.

◆ read_done()

void read_done ( kst_prog_t * p)
static

Takes the result of a read of the servo.

Parameters
pThe programmer state.

◆ release_check()

kst_prog_msg_id_t release_check ( kst_prog_t * p,
unsigned * arg )
static

Checks whether a release may go.

Parameters
pThe programmer state.
argReceives the argument of the message.
Returns
The message id; KST_PROG_MSG_NONE when it may.

◆ request()

kst_link_request_t request ( const kst_prog_t * p,
link_kst_op_t op )
static

Builds the link request for an operation.

Parameters
pThe programmer state.
opThe operation.
Returns
The request.

◆ restore_editable()

kst_prog_msg_id_t restore_editable ( kst_prog_t * p,
kst_prog_from_t from,
const kst_image_t * src )
static

The confirmed restore from a record or a file: its values become the pending ones and go out as an ordinary write.

A restore that does not start leaves the pending values as they were.

Parameters
pThe programmer state.
fromThe source of the image.
srcThe source image.
Returns
The message id.

◆ send_write()

void send_write ( kst_prog_t * p,
const kst_link_request_t * req,
const kst_image_t * target )
static

A write to the servo.

The first of a session to a servo whose image is known waits for that image in a file. Without a card it goes with no file, and the session's backup is the one copy of the servo as found. A servo in doubt has no image worth a file: the session's restore, the one write it takes, goes without.

Parameters
pThe programmer state.
reqThe request.
targetThe image the write leaves.

◆ session_gone()

void session_gone ( kst_prog_t * p)
static

The session no longer stands: the port is in PWM, the link went, or the IOmcu started again.

Parameters
pThe programmer state.

◆ session_restore_ready()

kst_prog_msg_id_t session_restore_ready ( const kst_prog_t * p,
unsigned * arg )
static

The session's restore while the servo's image is in doubt: taken in a locked session, where it is the one write, and after a read otherwise.

The record's question is answered first.

Parameters
pThe programmer state.
argReceives the argument of the message.
Returns
The message id; KST_PROG_MSG_NONE when it may go.

◆ soft_base()

const kst_image_t * soft_base ( const kst_prog_t * p)
static

The image the soft rules compare with: the servo as the session found it, so that the writes of a session do not add up unseen.

The servo as last read where the session's backup is not held or is another servo's.

◆ soft_by()

kst_rules_t soft_by ( const kst_prog_t * p,
const kst_image_t * img,
kst_field_id_t id )
static

The soft rules of img that field id is at fault for: the ones that go when the field takes the base's value.

Parameters
pThe programmer state.
imgThe image to check.
idThe field.
Returns
The soft rules the field is at fault for.

◆ soft_new()

kst_rules_t soft_new ( const kst_prog_t * p,
const kst_image_t * target )
static

The soft rules target breaks as a step from the servo as last read: what a restore is checked with, which moves the servo back and is warned of by where it moves from.

Parameters
pThe programmer state.
targetThe image the step goes to.
Returns
The soft rules.

◆ soft_of()

kst_rules_t soft_of ( const kst_prog_t * p,
const kst_image_t * img )
static

The soft rules an image breaks against the soft base.

Parameters
pThe programmer state.
imgThe image to check.
Returns
The soft rules.

◆ state_gate()

kst_prog_msg_id_t state_gate ( kst_prog_state_t st)
static

Whether an operation may start in a state; the message when not.

Parameters
stThe state.
Returns
KST_PROG_MSG_NONE in PROGRAMMING, else the message why not.

◆ taken_back()

bool taken_back ( kst_prog_t * p)
static

The START awaited is taken back at the gate: the link's task takes it out of its queue and drops it, whenever that is.

Parameters
pThe programmer state.
Returns
true when the START was taken back before it was carried out.

◆ unanswered()

void unanswered ( kst_prog_t * p,
unsigned id )
static

A START nobody answers.

One never handed out was not sent, and one taken back at the gate never is. One whose pass the link's task took is carried out, and its answer is waited for once more. With no answer then, or with no gate, it may have run: the outcome is the one of an operation that did not answer, and an abort follows it.

Parameters
pThe programmer state.
idThe message id of the START.

◆ waits_unsent()

bool waits_unsent ( const kst_prog_t * p)
static

Whether the programmer waits on a card or a command that is not sent.

Parameters
pThe programmer state.
Returns
true when it waits.

◆ write_check()

kst_prog_msg_id_t write_check ( kst_prog_t * p,
unsigned * arg )
static

Checks whether a write may go.

Parameters
pThe programmer state.
argReceives the argument of the message.
Returns
The message id; KST_PROG_MSG_NONE when it may.

◆ write_draft()

kst_prog_msg_id_t write_draft ( kst_prog_t * p,
kst_prog_from_t from )
static

Writes the draft to the servo.

Parameters
pThe programmer state.
fromThe source of the write.
Returns
The message id.

◆ write_failed()

bool write_failed ( kst_prog_t * p,
const kst_link_outcome_t * o )
static

A write that ended without the servo verified.

True when no register was written.

Parameters
pThe programmer state.
oThe outcome.
Returns
true when no register was written.

◆ write_ready()

kst_prog_msg_id_t write_ready ( const kst_prog_t * p,
unsigned * arg )
static

What a write of the draft needs, the switch left out.

Parameters
pThe programmer state.
argReceives the argument of the message.
Returns
The message id; KST_PROG_MSG_NONE when it may go.