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

PANEL UPDATE, the screen that writes an uploaded or downloaded image: wifi_screen.h says what it is for and declares its interface. More...

#include "wifi_screen.h"
#include <stdio.h>
#include <string.h>
#include "ui_text.h"
#include "ui_theme.h"
#include "ui_widgets.h"

Data Structures

struct  [struct].u

Macros

#define U_FONT_HEAD   (&gfx_font_20x36)
 The title, the bytes and the step: 20 x 36.
#define U_FONT_BODY   UI_FONT_BODY
 The lines under them: 12 x 24.
#define U_FONT_LABEL   (&gfx_font_10x20)
 The button: 10 x 20.
#define U_BAR_H   64
 The title bar's height, px.
#define U_X   24
 The column's left edge.
#define U_W   (UI_PANEL_W - 2 * U_X)
#define U_BYTES_Y   88
 The bytes' top.
#define U_PBAR   gfx_rect_make(U_X, 140, U_W, 36)
 The bar, 36px tall.
#define U_LINES_Y   208
 The step's or the verdict's top.
#define U_PITCH   28
 A U_FONT_BODY line's pitch, px.
#define U_CLOSE   gfx_rect_make(24, UI_PANEL_H - 18 - 56, 240, 56)
 CLOSE or CANCEL, at the bottom left.

Functions

static bool in (gfx_rect_t r, int x, int y)
 Returns whether (x, y) is inside r.
static void u_reset (void)
 Clears the screen's state.
void update_screen_set (const update_view_t *v)
 Hand PANEL UPDATE what to show.
void update_screen_invalidate (void)
 Repaint PANEL UPDATE on the next frame.
bool update_screen_take_close (void)
bool update_screen_take_cancel (void)
static bool u_has_button (void)
 The one button: CLOSE after a failure, CANCEL while downloading.
static void u_event (const touch_event_t *evt)
 Takes a touch event: a press on the one button, its release and its cancel.
static void u_cancel (void)
 Drops the press when touch events were lost.
static void u_line (gfx_canvas_t *c, int y, const char *t, const gfx_font_t *f, gfx_color_t col)
 One line of t in f from (U_X, y), as wide as the column.
static void u_render (gfx_canvas_t *c, int buffer_index)
 PANEL UPDATE, drawn whole once per framebuffer and again after every change.
const ui_screen_t * update_screen (void)
 The PANEL UPDATE screen, for the router.

Variables

static struct  u
 PANEL UPDATE's state: the view, the press on the one button, and which frame buffers drew it.
static const ui_screen_t k_update
 The screen's hooks for the router.

Detailed Description

PANEL UPDATE, the screen that writes an uploaded or downloaded image: wifi_screen.h says what it is for and declares its interface.

SPDX-License-Identifier: MIT

Macro Definition Documentation

◆ U_W

#define U_W   (UI_PANEL_W - 2 * U_X)

976px: 48 cells of U_FONT_HEAD, 81 of BODY

Function Documentation

◆ u_line()

void u_line ( gfx_canvas_t * c,
int y,
const char * t,
const gfx_font_t * f,
gfx_color_t col )
static

One line of t in f from (U_X, y), as wide as the column.

Parameters
cCanvas, the whole panel.
yThe line's top.
tThe text.
fIts face.
colIts colour.

◆ u_render()

void u_render ( gfx_canvas_t * c,
int buffer_index )
static

PANEL UPDATE, drawn whole once per framebuffer and again after every change.

Parameters
cCanvas, the whole panel.
buffer_indexThe framebuffer drawn into.

◆ update_screen()

const ui_screen_t * update_screen ( void )

The PANEL UPDATE screen, for the router.

Returns
The screen.

◆ update_screen_set()

void update_screen_set ( const update_view_t * v)

Hand PANEL UPDATE what to show.

Parameters
vThe view, copied.

◆ update_screen_take_cancel()

bool update_screen_take_cancel ( void )

True once CANCEL was tapped on a download; cleared when read.

◆ update_screen_take_close()

bool update_screen_take_close ( void )

True once CLOSE was tapped on a failed write or download; cleared when read.

Variable Documentation

◆ k_update

const ui_screen_t k_update
static
Initial value:
= {
.title = "PANEL UPDATE",
.reset = u_reset,
.enter = NULL,
.leave = NULL,
.tick = NULL,
.event = u_event,
.cancel = u_cancel,
.render = u_render,
}
static void u_reset(void)
Clears the screen's state.
Definition update_screen.c:69
static void u_render(gfx_canvas_t *c, int buffer_index)
PANEL UPDATE, drawn whole once per framebuffer and again after every change.
Definition update_screen.c:173
static void u_event(const touch_event_t *evt)
Takes a touch event: a press on the one button, its release and its cancel.
Definition update_screen.c:113
static void u_cancel(void)
Drops the press when touch events were lost.
Definition update_screen.c:145

The screen's hooks for the router.