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

The seam between hitec_prog.c, the session's driving, and hitec_prog_write.c, the edits, writes and the record. More...

#include <stdbool.h>
#include "hitec_prog.h"

Go to the source code of this file.

Enumerations

enum  {
  ST_IDLE = 0 , ST_OPENING , ST_SES , ST_CLOSING ,
  ST_CLEARING , ST_RELEASING , ST_RECORD
}
 The request phases: what the model waits on the link for. More...
enum  {
  OP_NONE = 0 , OP_ENTER , OP_READ , OP_LEAVE ,
  OP_WRITE
}
 The session operations.

Functions

hitec_prog_msg_id_t hpg_say2 (hitec_prog_t *p, hitec_prog_msg_id_t id, unsigned arg, unsigned reg)
 Say message id.
hitec_prog_msg_id_t hpg_held_idle (const hitec_prog_t *p, bool safe)
 Whether an operation of the held port may start now.
void hpg_ses_say (hitec_prog_t *p, hitec_ses_t r)
 The message of a session operation that did not end well.
void hpg_pump (hitec_prog_t *p)
 The session's next step goes out, or its operation's end is taken.
void hpw_connect (hitec_prog_t *p)
 A CONNECT starts: the switch off, the edits and the confirmations gone; the record stays.
void hpw_off (hitec_prog_t *p)
 The write switch goes off: a LEAVE, a lost link, a stop.
void hpw_read_done (hitec_prog_t *p, bool had, const hitec_image_t *was)
 A full read ended well: the draft is the servo again, the switch goes off when the servo changed, and a record stands against it.
void hpw_write_done (hitec_prog_t *p, hitec_ses_t r)
 A write operation ended with r.
void hpw_tick (hitec_prog_t *p)
 Every feed: a stop switches the switch off, and a write that waits for the card gives up after HITEC_PROG_CARD_MS.
bool hpw_abort (hitec_prog_t *p)
 ABORT of a write that waits for the card: nothing was written.

Detailed Description

The seam between hitec_prog.c, the session's driving, and hitec_prog_write.c, the edits, writes and the record.

Hitec is a name or trademark of its owner; it is used here only to say which servos this module works with.

The functions one file calls of the other are prefixed hpg_ (in hitec_prog.c) and hpw_ (in hitec_prog_write.c). Nothing outside the two files includes this header; the interface is hitec_prog.h.

SPDX-License-Identifier: MIT

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

The request phases: what the model waits on the link for.

Enumerator
ST_IDLE 

nothing of this model runs

ST_OPENING 

OPEN

ST_SES 

a session operation, step by step

ST_CLOSING 

CLOSE after a leave

ST_CLEARING 

CLEAR

ST_RELEASING 

CLOSE of another session's port

ST_RECORD 

a write waits for the card's record

Function Documentation

◆ hpg_held_idle()

hitec_prog_msg_id_t hpg_held_idle ( const hitec_prog_t * p,
bool safe )

Whether an operation of the held port may start now.

Parameters
pThe programmer.
safetrue for one that sends frames: not with STOP latched, not armed, not on a STOPPED port.
Returns
HITEC_PROG_MSG_NONE when it may, else why not.

◆ hpg_pump()

void hpg_pump ( hitec_prog_t * p)

The session's next step goes out, or its operation's end is taken.

Parameters
pThe programmer.

◆ hpg_say2()

hitec_prog_msg_id_t hpg_say2 ( hitec_prog_t * p,
hitec_prog_msg_id_t id,
unsigned arg,
unsigned reg )

Say message id.

Parameters
pThe programmer.
idhitec_prog_msg_id_t.
argIts argument.
regIts second argument.
Returns
id.

◆ hpg_ses_say()

void hpg_ses_say ( hitec_prog_t * p,
hitec_ses_t r )

The message of a session operation that did not end well.

Parameters
pThe programmer.
rIts result.

◆ hpw_abort()

bool hpw_abort ( hitec_prog_t * p)

ABORT of a write that waits for the card: nothing was written.

Parameters
pThe programmer.
Returns
true when one waited.

◆ hpw_connect()

void hpw_connect ( hitec_prog_t * p)

A CONNECT starts: the switch off, the edits and the confirmations gone; the record stays.

Parameters
pThe programmer.

◆ hpw_off()

void hpw_off ( hitec_prog_t * p)

The write switch goes off: a LEAVE, a lost link, a stop.

Parameters
pThe programmer.

◆ hpw_read_done()

void hpw_read_done ( hitec_prog_t * p,
bool had,
const hitec_image_t * was )

A full read ended well: the draft is the servo again, the switch goes off when the servo changed, and a record stands against it.

Parameters
pThe programmer.
hadA servo was read before.
wasWhat that read found; NULL with none.

◆ hpw_tick()

void hpw_tick ( hitec_prog_t * p)

Every feed: a stop switches the switch off, and a write that waits for the card gives up after HITEC_PROG_CARD_MS.

Parameters
pThe programmer.

◆ hpw_write_done()

void hpw_write_done ( hitec_prog_t * p,
hitec_ses_t r )

A write operation ended with r.

Parameters
pThe programmer.
rIts result.