|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The overlay of the programmer for servos by Hitec: its state, rows, geometry and the caller's side. See hitec_panel.h. More...
#include "hitec_panel.h"#include <stdio.h>#include <string.h>#include "hitec_reg.h"#include "settings.h"#include "ui_tabs.h"#include "ui_text.h"#include "hitec_panel_int.h"Macros | |
| #define | W_NAME ((uint8_t)HITEC_P_COUNT) |
| The classic model name row: no parameter of hitec_reg. | |
Functions | |
| bool | hpn_row_shown (const hpn_row_t *r) |
Whether row r is on the tab shown in the series and layout in use. | |
| const hpn_row_t * | hpn_row_at (int page, int row, int col) |
The row at (page, row, col) shown now, or NULL. | |
| gfx_rect_t | hpn_tabs_rect (void) |
| The tabs' row. | |
| int | hpn_foot (void) |
| Where a control at the foot ends: 8px above the area's foot, and HP_FOOT_GAP above the alert band at the most. | |
| int | hpn_notes_foot (void) |
| Where the notes end: 6px above the area's foot, and HP_FOOT_GAP above the alert band at the most. | |
| gfx_rect_t | hpn_row_rect (const hpn_row_t *r) |
Row r's whole rectangle. | |
| gfx_rect_t | hpn_value_rect (const hpn_row_t *r) |
Row r's control. | |
| int | hpn_cells (void) |
| The cells of HP_FONT a note's row has: the area less 10px a side. | |
| static size_t | row_len (const char *s) |
The bytes of s its first row takes: all of it where it fits, else up to the last space that leaves the row no wider than the line; a word longer than the line is cut. | |
| static const char * | next_row (const char *s, size_t len) |
The start of the row after one of len bytes at s. | |
| int | hitec_panel_text_rows (const char *s) |
| The rows of 10 x 20 cells a line takes, wrapped at a space to the overlay's width less 10px a side: 60 cells on SERVO's left card. | |
| int | hpn_text_rows (gfx_canvas_t *c, int x, int y, const char *s, gfx_color_t color) |
s in rows of the area's width from (x, y). | |
| gfx_rect_t | hitec_panel_tab_rect (int page) |
| A tab, one fifth of the row left of CLOSE, 48px tall. | |
| gfx_rect_t | hitec_panel_close_rect (void) |
| CLOSE, 120 x 48px at the top right. | |
| gfx_rect_t | hitec_panel_value_rect (int page, int row, int col) |
| The control of a row: a button, or the box of a value. | |
| gfx_rect_t | hitec_panel_choice_rect (int i) |
Entry i of the open list, 48px tall at a 56px pitch. | |
| gfx_rect_t | hitec_panel_choice_cancel_rect (void) |
| A list's CANCEL, 150 x 48px at the foot's right. | |
| gfx_rect_t | hitec_panel_apply_rect (void) |
| A hold page's button, 300 x 56px at the foot's left. | |
| gfx_rect_t | hitec_panel_cancel_rect (void) |
| A hold page's CANCEL, 180 x 56px at the foot's right. | |
| hitec_prog_t * | hitec_panel_model (void) |
| The model. | |
| ui_keypad_t * | hitec_panel_keypad (void) |
| The keypad. | |
| const char * | hitec_panel_label (int page, int row, int col) |
| The label of a row as it is drawn now. | |
| const char * | hitec_panel_value (int page, int row, int col) |
| The text in the control of a row: a button's, or the value. | |
| bool | hitec_panel_row_live (int page, int row, int col) |
| Whether the control of a row takes a tap now. | |
| const char * | hitec_panel_port_line (int i) |
Line i of the PORT row's label: 0 the port, the pin and the series, 1 the receive mode and the supply CONNECT asks. | |
| int | hitec_panel_editor (void) |
| What is open over the page. | |
| int | hitec_panel_page (void) |
| The tab shown. | |
| const char * | hitec_panel_choice_label (int i) |
The open list's entry i. | |
| const char * | hitec_panel_page_line (int i) |
Line i of the open hold page, its title first. | |
| void | hitec_panel_gate (hitec_prog_gate_t *g) |
| The gate the link task claims each command at; kept over hitec_panel_init(). NULL for none. | |
| void | hitec_panel_init (gfx_rect_t area) |
Start over: closed, nothing held, laid out in area. | |
| static void | options_fresh (void) |
| The options from the settings where they are loaded: at a screen entry and at an opening, not at hitec_panel_init(), which runs before the settings are loaded. A session keeps what it began with. | |
| void | hitec_panel_screen_entry (void) |
| The SERVO screen was entered: the options are read from the settings, and ENABLE WRITE TO SERVO goes off. | |
| void | hitec_panel_open (void) |
| Opens the overlay. | |
| bool | hitec_panel_is_open (void) |
| Whether the overlay is open. | |
| bool | hitec_panel_holds_port (void) |
| A port is held, by this panel or another session, or a request is on its way: the overlay is shown, no other row on the port opens and the bench takes no arm. | |
| uint8_t | hitec_panel_pin (void) |
| The GPIO the port the overlay names drives. | |
| bool | hitec_panel_safe_at (int x, int y) |
| None of the session's controls stops what the bench drives: it works on a SAFE bench only. Always false. | |
| uint32_t | hitec_panel_revision (void) |
| Changes whenever a render would show something else. | |
| uint32_t | hitec_panel_hold_revision (void) |
| Changes while a page's hold fills; hitec_panel_apply_rect() is where. | |
| static uint32_t | signature (void) |
| Everything of the model a render shows, as one number. | |
| void | hpn_moved (void) |
| The state changed or an operation started: editors that asked for the state they were opened in close and the revision counts. | |
| void | hitec_panel_feed (const hitec_prog_feed_t *f) |
| The link task's feed for this frame. | |
| bool | hitec_panel_take (hitec_prog_cmd_t *out) |
| The next command for the link task. | |
| void | hitec_panel_bench_armed (bool armed) |
| The bench is armed or asked to arm: CONNECT, READ ALL and every write are refused. | |
| size_t | hitec_panel_file_take (char *out, size_t n) |
| The record's text for the card (hitec_prog_file_take()). | |
| void | hitec_panel_file_done (bool ok) |
| How the card took it (hitec_prog_file_done()). | |
| bool | hitec_panel_file_load (const char *text, size_t len) |
| The record's text as the card held it at the start (hitec_prog_file_load()). | |
Variables | |
| const hpn_row_t | hpn_rows [] |
| The rows of every tab and both series; hitec_panel_int.h. | |
| static const ui_text_id_t | k_tabs [HITEC_PANEL_PAGES] |
| The tabs' labels. | |
| hpn_state_t | hitec_panel_h |
| The state, in hitec_panel.c; the files read it as hp. | |
| static hitec_prog_gate_t * | s_gate |
| Not part of hp: a start of the screens leaves it. | |
| const prog_page_set_t | hitec_panel_pages |
| The session's hooks for its row on SERVO > PROGRAM. | |
The overlay of the programmer for servos by Hitec: its state, rows, geometry and the caller's side. See hitec_panel.h.
Hitec is a name or trademark of its owner; it is used here only to say which servos this overlay works with.
The texts are hitec_panel_text.c, the actions and editors hitec_panel_edit.c, the presses hitec_panel_touch.c and the drawing hitec_panel_draw.c, with hitec_panel_int.h between them.
SPDX-License-Identifier: MIT
| gfx_rect_t hitec_panel_apply_rect | ( | void | ) |
A hold page's button, 300 x 56px at the foot's left.
| void hitec_panel_bench_armed | ( | bool | armed | ) |
The bench is armed or asked to arm: CONNECT, READ ALL and every write are refused.
| armed | true while it is |
| gfx_rect_t hitec_panel_cancel_rect | ( | void | ) |
A hold page's CANCEL, 180 x 56px at the foot's right.
| gfx_rect_t hitec_panel_choice_cancel_rect | ( | void | ) |
A list's CANCEL, 150 x 48px at the foot's right.
| const char * hitec_panel_choice_label | ( | int | i | ) |
The open list's entry i.
| i | the entry |
| gfx_rect_t hitec_panel_choice_rect | ( | int | i | ) |
Entry i of the open list, 48px tall at a 56px pitch.
| i | the entry |
| gfx_rect_t hitec_panel_close_rect | ( | void | ) |
CLOSE, 120 x 48px at the top right.
| int hitec_panel_editor | ( | void | ) |
What is open over the page.
| void hitec_panel_feed | ( | const hitec_prog_feed_t * | f | ) |
The link task's feed for this frame.
| f | the feed |
| void hitec_panel_file_done | ( | bool | ok | ) |
How the card took it (hitec_prog_file_done()).
| ok | true when the card holds it whole |
| bool hitec_panel_file_load | ( | const char * | text, |
| size_t | len ) |
The record's text as the card held it at the start (hitec_prog_file_load()).
| text | the text |
| len | its length in bytes |
| size_t hitec_panel_file_take | ( | char * | out, |
| size_t | n ) |
The record's text for the card (hitec_prog_file_take()).
| out | receives the text |
| n | bytes at out |
| void hitec_panel_gate | ( | hitec_prog_gate_t * | g | ) |
The gate the link task claims each command at; kept over hitec_panel_init(). NULL for none.
| g | the gate |
| uint32_t hitec_panel_hold_revision | ( | void | ) |
Changes while a page's hold fills; hitec_panel_apply_rect() is where.
| bool hitec_panel_holds_port | ( | void | ) |
A port is held, by this panel or another session, or a request is on its way: the overlay is shown, no other row on the port opens and the bench takes no arm.
| void hitec_panel_init | ( | gfx_rect_t | area | ) |
Start over: closed, nothing held, laid out in area.
| area | the overlay's area, body pixels |
| bool hitec_panel_is_open | ( | void | ) |
Whether the overlay is open.
| ui_keypad_t * hitec_panel_keypad | ( | void | ) |
The keypad.
| const char * hitec_panel_label | ( | int | page, |
| int | row, | ||
| int | col ) |
The label of a row as it is drawn now.
| page | the tab |
| row | the row |
| col | the column |
| hitec_prog_t * hitec_panel_model | ( | void | ) |
The model.
| int hitec_panel_page | ( | void | ) |
The tab shown.
| const char * hitec_panel_page_line | ( | int | i | ) |
Line i of the open hold page, its title first.
| i | the line |
| uint8_t hitec_panel_pin | ( | void | ) |
The GPIO the port the overlay names drives.
| const char * hitec_panel_port_line | ( | int | i | ) |
Line i of the PORT row's label: 0 the port, the pin and the series, 1 the receive mode and the supply CONNECT asks.
| i | the line |
| uint32_t hitec_panel_revision | ( | void | ) |
Changes whenever a render would show something else.
| bool hitec_panel_row_live | ( | int | page, |
| int | row, | ||
| int | col ) |
Whether the control of a row takes a tap now.
| page | the tab |
| row | the row |
| col | the column |
| bool hitec_panel_safe_at | ( | int | x, |
| int | y ) |
None of the session's controls stops what the bench drives: it works on a SAFE bench only. Always false.
| x | the column, px |
| y | the row, px |
| gfx_rect_t hitec_panel_tab_rect | ( | int | page | ) |
A tab, one fifth of the row left of CLOSE, 48px tall.
| page | hitec_panel_page_t |
| bool hitec_panel_take | ( | hitec_prog_cmd_t * | out | ) |
The next command for the link task.
| out | the command |
| int hitec_panel_text_rows | ( | const char * | s | ) |
The rows of 10 x 20 cells a line takes, wrapped at a space to the overlay's width less 10px a side: 60 cells on SERVO's left card.
| s | the line |
| const char * hitec_panel_value | ( | int | page, |
| int | row, | ||
| int | col ) |
The text in the control of a row: a button's, or the value.
| page | the tab |
| row | the row |
| col | the column |
| gfx_rect_t hitec_panel_value_rect | ( | int | page, |
| int | row, | ||
| int | col ) |
The control of a row: a button, or the box of a value.
| page | the tab |
| row | the row, from the top |
| col | the column, 0 or 1 |
| int hpn_cells | ( | void | ) |
The cells of HP_FONT a note's row has: the area less 10px a side.
| int hpn_foot | ( | void | ) |
Where a control at the foot ends: 8px above the area's foot, and HP_FOOT_GAP above the alert band at the most.
| int hpn_notes_foot | ( | void | ) |
Where the notes end: 6px above the area's foot, and HP_FOOT_GAP above the alert band at the most.
| const hpn_row_t * hpn_row_at | ( | int | page, |
| int | row, | ||
| int | col ) |
The row at (page, row, col) shown now, or NULL.
| page | the tab |
| row | the row |
| col | the column |
| gfx_rect_t hpn_row_rect | ( | const hpn_row_t * | r | ) |
Row r's whole rectangle.
| r | the row |
| bool hpn_row_shown | ( | const hpn_row_t * | r | ) |
Whether row r is on the tab shown in the series and layout in use.
| r | the row |
| gfx_rect_t hpn_tabs_rect | ( | void | ) |
The tabs' row.
| int hpn_text_rows | ( | gfx_canvas_t * | c, |
| int | x, | ||
| int | y, | ||
| const char * | s, | ||
| gfx_color_t | color ) |
s in rows of the area's width from (x, y).
| c | the canvas |
| x | the left, px |
| y | the top, px |
| s | the text |
| color | its colour |
| gfx_rect_t hpn_value_rect | ( | const hpn_row_t * | r | ) |
Row r's control.
| r | the row |
|
static |
The start of the row after one of len bytes at s.
| s | the row |
| len | its bytes |
|
static |
The bytes of s its first row takes: all of it where it fits, else up to the last space that leaves the row no wider than the line; a word longer than the line is cut.
| s | the text |
| const prog_page_set_t hitec_panel_pages |
The session's hooks for its row on SERVO > PROGRAM.
| const hpn_row_t hpn_rows[] |
The rows of every tab and both series; hitec_panel_int.h.
The rows, in hitec_panel.c.
The rows of every tab and both series; hitec_panel_int.h.
|
static |
The tabs' labels.