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

The IOmcu's drawing of its own board, on a screen: whether it describes the board the panel knows, and drawing it into a box. More...

#include <stdbool.h>
#include <stdint.h>
#include "gfx.h"
#include "link_drawing.h"
#include "out_bind.h"

Go to the source code of this file.

Functions

bool board_drawing_agrees (const link_drawing_t *d, const outbind_board_t *board, const char **why)
int board_drawing_scale (uint32_t v, int px, uint16_t full)
 A length of the drawing as pixels, rounded to the nearest.
void board_drawing_render (gfx_canvas_t *c, const link_drawing_t *d, int x, int y, int w, int h, gfx_color_t hole)

Detailed Description

The IOmcu's drawing of its own board, on a screen: whether it describes the board the panel knows, and drawing it into a box.

The drawing comes from the IOmcu (link_drawing.h has the layout), the pins the panel offers come from its catalogue. A drawing whose pads say something else than the catalogue – another GPIO on a pad, a ground where the catalogue has a rail, a pad off the shape's grid – is refused whole: a screen that draws one board and binds another sends a lead to the wrong pad.

Every position is scaled from its own value in 0.01mm, never from a neighbour's screen position, so rounding does not add up along a row of forty pads.

SPDX-License-Identifier: MIT

Function Documentation

◆ board_drawing_agrees()

bool board_drawing_agrees ( const link_drawing_t * d,
const outbind_board_t * board,
const char ** why )

Whether d describes board: every catalogue pin is a GPIO pad of the drawing with the same GPIO and no other pad is one; every pad the board lists that is not a pin has the same kind and rail, and the drawing has no other; with a shape, the outline is the shape's and every pad sits where outbind_pad_xy() places it.

False for a NULL board – one this build neither ships nor learned – with why (may be NULL) naming the first disagreement for a log line.

◆ board_drawing_render()

void board_drawing_render ( gfx_canvas_t * c,
const link_drawing_t * d,
int x,
int y,
int w,
int h,
gfx_color_t hole )

Draw d into the box x, y, w by h: the outline in the board colour, the shapes in order, then every pad ring with its hole in hole, the colour behind the board.

◆ board_drawing_scale()

int board_drawing_scale ( uint32_t v,
int px,
uint16_t full )

A length of the drawing as pixels, rounded to the nearest.

Parameters
vthe length, 0.01mm
pxthe pixels full takes
fullthe whole, 0.01mm
Returns
v of full as pixels of px; 0 for a full of 0