rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
picker_screen.h
Go to the documentation of this file.
1
37
38#pragma once
39
40#include <stdbool.h>
41#include <stddef.h>
42#include <stdint.h>
43
44#include "gfx.h"
45#include "link_pages.h"
46#include "out_bind.h"
47#include "outputs_screen.h"
48#include "ui_screen.h"
49
50#ifdef __cplusplus
51extern "C" {
52#endif
53
54const ui_screen_t *picker_screen(void);
55
58
61
66
77void picker_screen_follow(uint8_t proto, bool editable);
78
87typedef void (*picker_select_fn)(uint8_t proto);
89
91#define PICKER_NO_PIN 0xFFu
92
101void picker_screen_set_prog_pin(uint8_t gpio);
102
111void picker_screen_set_prog_ports(uint8_t count, const uint8_t *pins);
112
125void picker_screen_open_on_port(uint8_t port);
126
129
131uint8_t picker_screen_prog_listed(void);
132
150
162picker_pin_t picker_screen_pin(uint8_t index, char *holder, size_t cap);
163
166bool picker_screen_button_rect(uint8_t index, gfx_rect_t *out);
167
173bool picker_screen_marker_rect(uint8_t entry, gfx_rect_t *out);
174
176typedef struct {
177 uint8_t index;
178 uint8_t gpio;
179 int8_t channel;
180 uint8_t pad;
182
184bool picker_screen_row(uint8_t k, picker_row_t *out);
185
212
214#define PICKER_USE_PROG 0xFFu
216#define PICKER_USE_IFACE(f) (0xF0u + (unsigned)(f))
218#define PICKER_USE_IS_IFACE(g) ((g) > 0xF0u && (g) < 0xF0u + OUTPUTS_IFACE_COUNT)
219
221#define PICKER_USE_IFACE_PINS 5u
222
226#define PICKER_USE_MAX \
227 (1u + LINK_PG_PORTS_MAX + (OUTPUTS_IFACE_COUNT - 1u) \
228 + PICKER_USE_IFACE_PINS + (OUTBIND_PROTOS - 1u) + LINK_OUT_SLOTS)
229
230typedef struct {
232 uint8_t proto;
234 uint8_t gpio;
235 int8_t channel;
236 bool compact;
239
241bool picker_screen_in_use(uint8_t k, picker_use_t *out);
242
244void picker_screen_count(char *buf, size_t cap);
245
253bool picker_screen_reason(char *buf, size_t cap);
254
262
266bool picker_screen_list_open(void);
267
269bool picker_screen_editable(void);
270
272typedef void (*picker_apply_fn)(const outbind_t *b);
274
284bool picker_screen_set_drawing(const uint8_t *data, uint32_t bytes,
285 const char **why);
286
294typedef void (*picker_drawing_fn)(uint16_t board);
296
307void picker_board_fit(uint16_t ow, uint16_t oh, int *w, int *h);
308
318bool picker_screen_cat(gfx_rect_t *box, int *pose);
319
322
325bool picker_screen_can_draw(void);
326
327#ifdef __cplusplus
328}
329#endif
gfx: an RGB565 (16-bit red, green, blue) rasteriser with no dependencies.
#define k
Short name for kst_panel_k inside the overlay's seven files.
Definition kst_panel_int.h:238
Binding a protocol to pins: what the operator chooses, and the OUTPUTS page that comes out of it.
The outputs screen: choose a protocol, then tick the pins it drives.
bool picker_screen_has_drawing(void)
Definition picker_screen.c:189
bool picker_screen_set_drawing(const uint8_t *data, uint32_t bytes, const char **why)
Definition picker_screen.c:130
void(*) picker_apply_fn(const outbind_t *b)
Definition picker_screen.h:272
int picker_screen_port_shown(void)
Definition picker_screen.c:469
void picker_screen_set_drawing_source(picker_drawing_fn fn)
Name the function that asks for the drawing of a board.
Definition picker_screen.c:128
bool picker_screen_can_draw(void)
Definition picker_screen.c:191
bool picker_screen_reason(char *buf, size_t cap)
Definition picker_screen.c:393
void picker_screen_count(char *buf, size_t cap)
Definition picker_screen.c:377
void picker_screen_invalidate(void)
Definition picker_screen.c:53
void picker_screen_set_select(picker_select_fn fn)
Name the function a pick in the list tells the Outputs screen by.
Definition picker_screen.c:122
const ui_screen_t * picker_screen(void)
The pin picker.
Definition picker_screen.c:687
void picker_screen_set_prog_pin(uint8_t gpio)
Definition picker_screen.c:164
void(*) picker_drawing_fn(uint16_t board)
Definition picker_screen.h:294
void picker_screen_set_prog_ports(uint8_t count, const uint8_t *pins)
Definition picker_screen.c:150
void(*) picker_select_fn(uint8_t proto)
Definition picker_screen.h:87
void picker_board_fit(uint16_t ow, uint16_t oh, int *w, int *h)
The size in pixels a board outline draws at.
Definition picker_geometry.c:37
bool picker_screen_button_rect(uint8_t index, gfx_rect_t *out)
Definition picker_geometry.c:192
void picker_screen_set_binding(const outbind_t *b)
Definition picker_screen.c:60
picker_use_kind_t
The kinds of a line of the IN USE table.
Definition picker_screen.h:206
@ PICKER_USE_PIN
Definition picker_screen.h:209
@ PICKER_USE_NAME
Definition picker_screen.h:207
@ PICKER_USE_MORE
Definition picker_screen.h:210
gfx_rect_t picker_screen_list_face(void)
Definition picker_geometry.c:277
void picker_screen_open_on_port(uint8_t port)
Definition picker_screen.c:467
void picker_screen_follow(uint8_t proto, bool editable)
Definition picker_screen.c:84
picker_area_t
Definition picker_screen.h:256
@ PICKER_AREA_IN_USE
Definition picker_screen.h:259
@ PICKER_AREA_PINS
Definition picker_screen.h:258
@ PICKER_AREA_HEAD
Definition picker_screen.h:257
bool picker_screen_list_open(void)
Returns whether the protocol list is open.
Definition picker_geometry.c:316
bool picker_screen_row(uint8_t k, picker_row_t *out)
Definition picker_screen.c:351
bool picker_screen_in_use(uint8_t k, picker_use_t *out)
Definition picker_draw.c:413
gfx_rect_t picker_screen_area(picker_area_t area)
Gives the rectangle of one of the screen's tables.
Definition picker_geometry.c:264
void picker_screen_set_apply(picker_apply_fn fn)
Name the function a tick or untick applies the binding through.
Definition picker_screen.c:116
gfx_rect_t picker_screen_list_row(uint8_t proto)
Row proto: a protocol in the first column, PROG PORT entry proto - OUTBIND_PROTOS in the second,...
Definition picker_geometry.c:303
picker_pin_t picker_screen_pin(uint8_t index, char *holder, size_t cap)
The state of catalogue entry index, as the screen draws it.
Definition picker_screen.c:260
const outbind_t * picker_screen_binding(void)
Definition picker_screen.c:58
uint8_t picker_screen_prog_listed(void)
Definition picker_screen.c:249
picker_pin_t
Definition picker_screen.h:134
@ PICKER_PIN_REFUSED
Definition picker_screen.h:143
@ PICKER_PIN_NONE
Definition picker_screen.h:135
@ PICKER_PIN_FREE
Definition picker_screen.h:136
@ PICKER_PIN_TICKED
Definition picker_screen.h:137
@ PICKER_PIN_LOCKED
Definition picker_screen.h:145
@ PICKER_PIN_RESERVED
Definition picker_screen.h:147
@ PICKER_PIN_HELD
Definition picker_screen.h:139
bool picker_screen_cat(gfx_rect_t *box, int *pose)
The cat the last frame drew (picker_cat.c): one pose, picked at random on a visit's first frame among...
Definition picker_cat.c:193
bool picker_screen_marker_rect(uint8_t entry, gfx_rect_t *out)
Definition picker_geometry.c:246
bool picker_screen_editable(void)
Definition picker_screen.c:110
Definition gfx.h:81
The selection: which board, the protocol being edited, and each protocol's pins.
Definition out_bind.h:423
Definition picker_screen.h:176
uint8_t index
Definition picker_screen.h:177
uint8_t pad
Definition picker_screen.h:180
int8_t channel
Definition picker_screen.h:179
Definition picker_screen.h:230
int8_t channel
Definition picker_screen.h:235
bool compact
Definition picker_screen.h:236
uint8_t gpio
Definition picker_screen.h:234
uint8_t proto
Definition picker_screen.h:232
gfx_rect_t rect
Definition picker_screen.h:237
Definition ui_screen.h:68
Screen router.