|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Reading a board drawing. More...
Functions | |
| static uint16_t | u16_at (const uint8_t *p) |
| Read a 16-bit little-endian value. | |
| static void | pad_of (const uint8_t *p, link_draw_pad_t *out) |
| Decode one pad record from its 8 bytes. | |
| static void | shape_of (const uint8_t *p, link_draw_shape_t *out) |
| Decode one shape record from its 12 bytes. | |
| static bool | within (int32_t lo, int32_t hi, uint16_t limit) |
| [lo, hi] lies inside [0, limit]: no part of it past either edge. | |
| static bool | pad_ok (const link_drawing_t *d, const link_draw_pad_t *p) |
| Test a pad record against the format and the outline. | |
| static bool | shape_ok (const link_drawing_t *d, const link_draw_shape_t *s) |
| Test a shape record against the format and the outline. | |
| static bool | refuse (link_drawing_t *out, const char **why, const char *reason) |
| Zero the output, record the reason and report failure. | |
| bool | link_drawing_parse (link_drawing_t *out, const uint8_t *data, uint32_t bytes, const char **why) |
Check bytes of data whole and describe them in out. | |
| bool | link_drawing_pad_at (const link_drawing_t *d, uint8_t i, link_draw_pad_t *out) |
Pad record i, 0 to pads - 1, in the order the drawing lists them. | |
| bool | link_drawing_find_pad (const link_drawing_t *d, uint8_t pad, link_draw_pad_t *out) |
The record of pad number pad. | |
| bool | link_drawing_shape_at (const link_drawing_t *d, uint16_t i, link_draw_shape_t *out) |
Shape record i, 0 to shapes - 1, in drawing order. | |
| bool link_drawing_find_pad | ( | const link_drawing_t * | d, |
| uint8_t | pad, | ||
| link_draw_pad_t * | out ) |
The record of pad number pad.
False when the drawing has none.
| d | The parsed drawing. |
| pad | The pad number, 1 to 63. |
| out | Receives the record; may be NULL. |
| bool link_drawing_pad_at | ( | const link_drawing_t * | d, |
| uint8_t | i, | ||
| link_draw_pad_t * | out ) |
Pad record i, 0 to pads - 1, in the order the drawing lists them.
| d | The parsed drawing. |
| i | Index of the record, 0 to pads - 1. |
| out | Receives the record. |
| bool link_drawing_parse | ( | link_drawing_t * | out, |
| const uint8_t * | data, | ||
| uint32_t | bytes, | ||
| const char ** | why ) |
Check bytes of data whole and describe them in out.
False, with out zeroed, when anything is out of place; why (may be NULL) then names the first thing found, for a log line, and is never left pointing at nothing.
| out | Receives the description; zeroed on failure. |
| data | The drawing bytes. |
| bytes | Length of data in bytes. |
| why | Receives the reason text on failure; may be NULL. |
| bool link_drawing_shape_at | ( | const link_drawing_t * | d, |
| uint16_t | i, | ||
| link_draw_shape_t * | out ) |
Shape record i, 0 to shapes - 1, in drawing order.
| d | The parsed drawing. |
| i | Index of the record, 0 to shapes - 1. |
| out | Receives the record. |
|
static |
Decode one pad record from its 8 bytes.
| p | The record's bytes. |
| out | Receives the decoded pad. |
|
static |
Test a pad record against the format and the outline.
| d | The parsed drawing, for the outline and ring radius. |
| p | The pad to test. |
|
static |
Zero the output, record the reason and report failure.
| out | The drawing to zero. |
| why | Receives reason when not NULL. |
| reason | The text of the first fault found. |
|
static |
Decode one shape record from its 12 bytes.
| p | The record's bytes. |
| out | Receives the decoded shape. |
|
static |
Test a shape record against the format and the outline.
| d | The parsed drawing, for the outline. |
| s | The shape to test. |
|
static |
Read a 16-bit little-endian value.
| p | The two bytes, low byte first. |
|
static |
[lo, hi] lies inside [0, limit]: no part of it past either edge.
In 32 bits, so lo - r below zero is a negative number and not a wrap.
| lo | Lower end of the interval, in 0.01mm. |
| hi | Upper end of the interval, in 0.01mm. |
| limit | The outline's width or height, in 0.01mm. |