|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The panel's half of the Hitec receive mode: SETUP > INTERFACES > Hitec D receive (SET_HITEC_RX) written to the HITEC page's register 23 (LINK_HT_W_RX_MODE, protocol 4.24), and what SETUP marks on the row. More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | hitec_rx_link_t |
| The panel's state of the Hitec receive mode. More... | |
Macros | |
| #define | HITEC_RX_LINK_ACK 0 |
| How an exchange went, as tone_link.h has it: the ACK, a NACK's reason (LINK_NACK_*), or no answer. | |
| #define | HITEC_RX_LINK_NO_ANSWER (-1) |
| #define | HITEC_RX_LINK_RETRY_MS 500u |
| A write nobody answered goes again this much later. | |
Enumerations | |
| enum | hitec_rx_link_mark_t { HITEC_RX_LINK_HELD = 0 , HITEC_RX_LINK_PENDING , HITEC_RX_LINK_REFUSED , HITEC_RX_LINK_OLD , HITEC_RX_LINK_NO_LINE } |
| What the row of SETUP says, hitec_rx_link_mark(). More... | |
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. | |
| 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. | |
The panel's half of the Hitec receive mode: SETUP > INTERFACES > Hitec D receive (SET_HITEC_RX) written to the HITEC page's register 23 (LINK_HT_W_RX_MODE, protocol 4.24), and what SETUP marks on the row.
The mode is owed to the IOmcu at every link-up, an IOmcu restart included (it starts at PULL-UP), and at every edit. It is written while owed, one write a poll, armed or not: the IOmcu takes it at its next OPEN of a D series line and changes nothing that runs. An acknowledgement is the mode held. A write nobody answered stays owed and goes again HITEC_RX_LINK_RETRY_MS later. A refusal ends the debt until the next edit or link-up: the same write is refused every time.
An IOmcu older than 4.24 is sent nothing: it refuses the register with LINK_NACK_READ_ONLY and receives with the pull-up. With PRECHARGE asked the row says so (HITEC_RX_LINK_OLD); with PULL-UP asked there is nothing to say. An IOmcu older than 4.23 has no HITEC page and no Hitec line; with PRECHARGE asked the row says that instead (HITEC_RX_LINK_NO_LINE).
Pure logic: the caller makes the exchange and reports how it went.
SPDX-License-Identifier: MIT
| enum hitec_rx_link_mark_t |
What the row of SETUP says, hitec_rx_link_mark().
| 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.
| l | The link state. |
| minor | The protocol minor version of the IOmcu. |
| 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.
| l | The link state. |
| result | The write's result: an acknowledgement, a NACK's reason or HITEC_RX_LINK_NO_ANSWER. |
| now_ms | The time of the answer, in ms. |
| void hitec_rx_link_init | ( | hitec_rx_link_t * | l | ) |
No IOmcu, PULL-UP asked, nothing owed.
| l | The link state to set up. |
| void hitec_rx_link_lost | ( | hitec_rx_link_t * | l | ) |
The link went down.
| l | The link state. |
| hitec_rx_link_mark_t hitec_rx_link_mark | ( | const hitec_rx_link_t * | l | ) |
What the row says now.
| l | The link state. |
| 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.
| l | The link state. |
| now_ms | The time of the poll, in ms. |
| value | Receives the register 23 value to write. |
| 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.
| l | The link state. |
| mode | The setting; a value above LINK_HITEC_RX_PRECHARGE is PULL-UP. |