|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The pick of a cat among the poses that fit a screen's spots, its drawing, and the random source. See include/ui_cats.h. More...
Functions | |
| void | ui_cats_set_random (ui_cats_random_fn fn) |
| Name the source ui_cats_roll() reads. | |
| void | ui_cats_seed (uint32_t seed) |
| Seed the built-in xorshift. | |
| uint32_t | ui_cats_roll (void) |
| The next random number from the source. | |
| void | ui_cats_force (int pose) |
| Put one pose, or none, in place of the random pick. | |
| int | ui_cats_forced (void) |
| The pose ui_cats_force() set. | |
| gfx_rect_t | ui_cat_rect (int pose, const ui_cat_spot_t *spot) |
The box pose pose covers in spot. | |
| static uint32_t | clear_spots (int pose, const ui_cat_spot_t *spots, int n, ui_cat_clear_fn clear) |
The spots of spots that pose pose may take and that are clear, as a mask of indexes. | |
| static int | nth_bit (uint32_t m, unsigned k) |
The index of the k-th set bit of m, counting from 0. | |
| static unsigned | bits (uint32_t m) |
The set bits of m. | |
| ui_cat_pick_t | ui_cats_pick (const ui_cat_spot_t *spots, int n, ui_cat_clear_fn clear, uint32_t roll) |
| Pick a pose among the ones with a clear spot, and that spot. | |
| gfx_rect_t | ui_cats_draw (gfx_canvas_t *c, ui_cat_pick_t pick, const ui_cat_spot_t *spots, int n) |
| Draw a pick. | |
Variables | |
| static ui_cats_random_fn | s_random |
| The source ui_cats_roll() reads; NULL for the xorshift. | |
| static uint32_t | s_state = 1u |
| The xorshift's state, never 0. | |
| static int | s_forced = UI_CAT_RANDOM |
| The pose ui_cats_force() set, UI_CAT_RANDOM by default. | |
The pick of a cat among the poses that fit a screen's spots, its drawing, and the random source. See include/ui_cats.h.
SPDX-License-Identifier: MIT
|
static |
The set bits of m.
| m | the mask |
|
static |
The spots of spots that pose pose may take and that are clear, as a mask of indexes.
| pose | index into ui_cat_poses[] |
| spots | the screen's spots |
| n | how many, at most 32 |
| clear | the screen's test of a box |
|
static |
The index of the k-th set bit of m, counting from 0.
| m | the mask, with more than k bits set |
| k | which set bit |
| gfx_rect_t ui_cat_rect | ( | int | pose, |
| const ui_cat_spot_t * | spot ) |
The box pose pose covers in spot.
| pose | index into ui_cat_poses[] |
| spot | the spot |
| gfx_rect_t ui_cats_draw | ( | gfx_canvas_t * | c, |
| ui_cat_pick_t | pick, | ||
| const ui_cat_spot_t * | spots, | ||
| int | n ) |
Draw a pick.
| c | the canvas |
| pick | the pick |
| spots | the list its spot indexes |
| n | how many |
| void ui_cats_force | ( | int | pose | ) |
Put one pose, or none, in place of the random pick.
| pose | index into ui_cat_poses[], UI_CAT_RANDOM or UI_CAT_NONE; anything else is UI_CAT_NONE |
| int ui_cats_forced | ( | void | ) |
The pose ui_cats_force() set.
| ui_cat_pick_t ui_cats_pick | ( | const ui_cat_spot_t * | spots, |
| int | n, | ||
| ui_cat_clear_fn | clear, | ||
| uint32_t | roll ) |
Pick a pose among the ones with a clear spot, and that spot.
A pose counts when one of the n spots is one it may take and clear says its box there is clear. roll picks among them, and among the clear spots of the pose picked: pose roll mod P, spot (roll / P) mod S. A forced pose (ui_cats_force()) is the only one looked at; UI_CAT_NONE forced picks none.
| spots | the screen's spots |
| n | how many, at most 32 |
| clear | the screen's test of a box |
| roll | the random number |
| uint32_t ui_cats_roll | ( | void | ) |
The next random number from the source.
| void ui_cats_seed | ( | uint32_t | seed | ) |
Seed the built-in xorshift.
| seed | the seed; 0 is taken as 1, which xorshift needs nonzero |
| void ui_cats_set_random | ( | ui_cats_random_fn | fn | ) |
Name the source ui_cats_roll() reads.
| fn | the source, esp_random() on the panel; NULL for the built-in xorshift |