|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The control task's half of the programmer for servos by Hitec: the HITEC page's link module (hitec_link.h), the commands of the programmer's model and what the model is fed. More...
#include <stdatomic.h>#include <string.h>#include "freertos/FreeRTOS.h"#include "freertos/queue.h"#include "arming.h"#include "hitec_link.h"#include "hitec_prog.h"#include "hitec_rx_link.h"#include "link_host.h"#include "link_pages.h"#include "outputs.h"#include "panel.h"#include "prog_link.h"#include "storage.h"#include "supply_link.h"Functions | |
| static void | hitec_command (const hitec_prog_cmd_t *c) |
| Carry out one command. | |
| void | hitec_commands (void) |
| The Hitec programmer's commands, at most 4 a pass; control task. | |
| static int | hitec_xchg (void *ctx, const hitec_link_xfer_t *x, uint16_t *regs) |
One exchange of the HITEC page, as hitec_link_xchg_fn: a write, or a read of up to 32 registers into regs. | |
| void | hitec_pass (bool link_up) |
| One pass of the HITEC page's module; control task, every pass. | |
| bool | hitec_taken (void) |
| Whether the HITEC page holds a port or a request runs. | |
| void | hitec_publish (hitec_prog_feed_t *f) |
| What the Hitec programmer's model is fed; under the snapshot's lock. | |
Variables | |
| hitec_link_t | s_hitec_link |
| The HITEC page's module (4.23). Control task only. | |
| hitec_prog_gate_t | s_hitec_gate |
| The gate a command in the queue is claimed at (hitec_prog.h). | |
| QueueHandle_t | s_hitec_q |
| The model's commands, app_main -> control task. | |
| static uint32_t | s_hitec_answer_id |
| The id of the last command carried out; 0 none. | |
| static uint8_t | s_hitec_answer |
| What the link module said to it: hitec_link_start_t. | |
| static uint32_t | s_hitec_outcomes |
| Counts the outcomes handed out. | |
| static hitec_link_outcome_t | s_hitec_outcome |
| The last outcome handed out. | |
| static uint32_t | s_hitec_stops |
| The stops an abort was sent for: arming_stop_count()'s count. | |
The control task's half of the programmer for servos by Hitec: the HITEC page's link module (hitec_link.h), the commands of the programmer's model and what the model is fed.
Hitec is a name or trademark of its owner; it is used here only to say which servos this module works with.
The model (hitec_prog.h) runs in the render loop. It hands its commands over through s_hitec_q and reads what became of them in the snapshot: the number of the last command carried out with what the link module said, and a count of the outcomes handed out with the last of them.
hitec_link_service() runs every pass of the control task, 5ms, with at most HITEC_LINK_PASS_MAX exchanges, so a request's status read follows the page within one pass. hitec_commands(), hitec_pass() and hitec_publish() are kept out of line: their locals stay out of control_task()'s frame, from which the task's deepest chain starts.
SPDX-License-Identifier: MIT
|
static |
Carry out one command.
No port is taken on an armed bench: an OPEN is answered BUSY and nothing is sent.
| c | The command. |
| void hitec_pass | ( | bool | link_up | ) |
One pass of the HITEC page's module; control task, every pass.
| link_up | whether the IOmcu answers |
| void hitec_publish | ( | hitec_prog_feed_t * | f | ) |
What the Hitec programmer's model is fed; under the snapshot's lock.
| f | receives the feed |
| bool hitec_taken | ( | void | ) |
Whether the HITEC page holds a port or a request runs.
|
static |
One exchange of the HITEC page, as hitec_link_xchg_fn: a write, or a read of up to 32 registers into regs.
| ctx | Unused. |
| x | The exchange. |
| regs | Receives a read's registers. |
| hitec_prog_gate_t s_hitec_gate |
The gate a command in the queue is claimed at (hitec_prog.h).
The gate the Hitec programmer's commands are claimed at; the one part both tasks touch.
The gate a command in the queue is claimed at (hitec_prog.h).
| hitec_link_t s_hitec_link |
The HITEC page's module (4.23). Control task only.
The HITEC page's module (4.23); control task only.
The HITEC page's module (4.23). Control task only.
| QueueHandle_t s_hitec_q |
The model's commands, app_main -> control task.
app_main -> control task