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

The panel's half of the Hitec receive mode. More...

#include "hitec_rx_link.h"
#include <stddef.h>
#include <string.h>
#include "link_pages.h"

Functions

void hitec_rx_link_init (hitec_rx_link_t *l)
 No IOmcu, PULL-UP asked, nothing owed.
void hitec_rx_link_want (hitec_rx_link_t *l, uint8_t mode)
 The setting as it is now; a change owes it.
void hitec_rx_link_came_up (hitec_rx_link_t *l, uint16_t minor)
 A link-up edge with an IOmcu of minor: the mode is owed again.
void hitec_rx_link_lost (hitec_rx_link_t *l)
 The link went down.
static bool knows_register (const hitec_rx_link_t *l)
 Whether the IOmcu has the HITEC RX register (LINK_MINOR_HITEC_RX or later).
bool hitec_rx_link_next (const hitec_rx_link_t *l, uint32_t now_ms, uint16_t *value)
 Whether to write the page's register 23 at now_ms, and with what.
void hitec_rx_link_done (hitec_rx_link_t *l, int result, uint32_t now_ms)
 How the write hitec_rx_link_next() gave went: HITEC_RX_LINK_ACK, a NACK's reason, or HITEC_RX_LINK_NO_ANSWER.
hitec_rx_link_mark_t hitec_rx_link_mark (const hitec_rx_link_t *l)
 What the row says now.

Detailed Description

The panel's half of the Hitec receive mode.

See hitec_rx_link.h.

SPDX-License-Identifier: MIT

Function Documentation

◆ hitec_rx_link_came_up()

void hitec_rx_link_came_up ( hitec_rx_link_t * l,
uint16_t minor )

A link-up edge with an IOmcu of minor: the mode is owed again.

Parameters
lThe link state.
minorThe protocol minor version of the IOmcu.

◆ hitec_rx_link_done()

void hitec_rx_link_done ( hitec_rx_link_t * l,
int result,
uint32_t now_ms )

How the write hitec_rx_link_next() gave went: HITEC_RX_LINK_ACK, a NACK's reason, or HITEC_RX_LINK_NO_ANSWER.

Parameters
lThe link state.
resultThe write's result: an acknowledgement, a NACK's reason or HITEC_RX_LINK_NO_ANSWER.
now_msThe time of the answer, in ms.

◆ hitec_rx_link_init()

void hitec_rx_link_init ( hitec_rx_link_t * l)

No IOmcu, PULL-UP asked, nothing owed.

Parameters
lThe link state to set up.

◆ hitec_rx_link_lost()

void hitec_rx_link_lost ( hitec_rx_link_t * l)

The link went down.

Parameters
lThe link state.

◆ hitec_rx_link_mark()

hitec_rx_link_mark_t hitec_rx_link_mark ( const hitec_rx_link_t * l)

What the row says now.

Parameters
lThe link state.
Returns
The mark the row shows now.

◆ hitec_rx_link_next()

bool hitec_rx_link_next ( const hitec_rx_link_t * l,
uint32_t now_ms,
uint16_t * value )

Whether to write the page's register 23 at now_ms, and with what.

False while nothing is owed, no IOmcu answers, it is older than 4.24, or an unanswered write is younger than HITEC_RX_LINK_RETRY_MS.

Parameters
lThe link state.
now_msThe time of the poll, in ms.
valueReceives the register 23 value to write.
Returns
true when a write is due.

◆ hitec_rx_link_want()

void hitec_rx_link_want ( hitec_rx_link_t * l,
uint8_t mode )

The setting as it is now; a change owes it.

A value above LINK_HITEC_RX_PRECHARGE is PULL-UP.

Parameters
lThe link state.
modeThe setting; a value above LINK_HITEC_RX_PRECHARGE is PULL-UP.

◆ knows_register()

bool knows_register ( const hitec_rx_link_t * l)
static

Whether the IOmcu has the HITEC RX register (LINK_MINOR_HITEC_RX or later).

Parameters
lThe link state.
Returns
true when the IOmcu has the register.