|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The SENSE_LIMIT page: see sense_limit.h. More...
#include "sense_limit.h"#include <stddef.h>#include <string.h>#include "link_msg.h"#include "link_pages.h"#include "sense_page_int.h"Functions | |
| static bool | on_page (uint8_t off, uint8_t n) |
| Whether the registers off to off + n - 1 lie within the page. | |
| void | sense_limit_peek (const sense_page_t *p, uint8_t off, uint8_t n, uint16_t *out) |
| The registers as they stand, OVER kept: for a report, not the link. | |
| void | sense_limit_read (sense_page_t *p, uint8_t off, uint8_t n, uint16_t *out) |
| A SENSE_LIMIT read from the link. | |
| uint8_t | sense_limit_write (sense_page_t *p, uint8_t off, uint8_t n, const uint16_t *in) |
| A SENSE_LIMIT write, judged whole. | |
| void | sense_limit_kept (const sense_page_t *p, uint16_t *kept) |
What is kept: the 12 limits into kept. | |
| uint8_t | sense_limit_restore (sense_page_t *p, const uint16_t *kept) |
| Kept limits back at boot, through sense_limit_write()'s checks: 0, or the refusal, which leaves every limit 0. | |
| void | sense_limit_judge (sense_page_t *p, const sense_snap_t *s) |
Core 1's counts of windows over each channel's limit in s into OVER and OVER_COUNT: what each gained since the last snapshot taken. | |
The SENSE_LIMIT page: see sense_limit.h.
SPDX-License-Identifier: MIT
|
static |
Whether the registers off to off + n - 1 lie within the page.
| off | First register index. |
| n | Number of registers. |
| void sense_limit_judge | ( | sense_page_t * | p, |
| const sense_snap_t * | s ) |
Core 1's counts of windows over each channel's limit in s into OVER and OVER_COUNT: what each gained since the last snapshot taken.
| p | The page. |
| s | The snapshot. |
| void sense_limit_kept | ( | const sense_page_t * | p, |
| uint16_t * | kept ) |
What is kept: the 12 limits into kept.
| p | Page state, not changed. |
| kept | Receives LINK_SL_KEPT (12) limit values. Not checked for NULL. |
| void sense_limit_peek | ( | const sense_page_t * | p, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
The registers as they stand, OVER kept: for a report, not the link.
Nothing is done when p or out is NULL, or when off and n reach past the page.
| p | Page state, not changed. |
| off | First register, 0 to LINK_SL_COUNT - 1. |
| n | Number of registers to copy. |
| out | Receives the n register values. |
| void sense_limit_read | ( | sense_page_t * | p, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| uint16_t * | out ) |
A SENSE_LIMIT read from the link.
A read that covers OVER clears it once out holds it.
Nothing is done when p or out is NULL, or when off and n reach past the page.
| p | Page state, read and cleared in place. |
| off | First register, 0 to LINK_SL_COUNT - 1. |
| n | Number of registers to read. |
| out | Receives the n register values. |
| uint8_t sense_limit_restore | ( | sense_page_t * | p, |
| const uint16_t * | kept ) |
Kept limits back at boot, through sense_limit_write()'s checks: 0, or the refusal, which leaves every limit 0.
| p | Page state, written through sense_limit_write(). |
| kept | The LINK_SL_KEPT (12) kept limit values. |
| uint8_t sense_limit_write | ( | sense_page_t * | p, |
| uint8_t | off, | ||
| uint8_t | n, | ||
| const uint16_t * | in ) |
A SENSE_LIMIT write, judged whole.
Refused: off the page (BAD_RANGE), reaching register 12 (READ_ONLY), a limit above 32767 (BAD_VALUE).
Taken in any bank state.
| p | Page state, written only when the whole write is taken. |
| off | First register, 0 to LINK_SL_COUNT - 1. |
| n | Number of registers to write. |
| in | The n new limit values, each at most LINK_SL_MA_MAX (32767). |