|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
Stick programming: the beep detector. More...
Functions | |
| void | esc_det_init (esc_det_t *d, const esc_stick_timing_t *t, uint8_t long_equals_short) |
| Set up the beep detector. | |
| void | esc_det_drop_group (esc_det_t *d) |
| Forget any group under way, as if the line had been silent. | |
| void | esc_det_floor_only (esc_det_t *d) |
| Floor only: no pulses, no groups. | |
| void | esc_det_count (esc_det_t *d) |
| Pulses and groups from the next reading on; the floor is kept. | |
| int32_t | esc_det_floor_ma (const esc_det_t *d) |
| The idle floor, mA. | |
| static uint32_t | readings_in (const esc_det_t *d, uint32_t ms) |
How many readings a span of ms must hold, at the longest interval seen that was not late. 0 while no interval is known. | |
| static void | close_pulse (esc_det_t *d, uint32_t t_ms) |
| Close the pulse that has just fallen and judge its length. | |
| esc_det_event_t | esc_det_reading (esc_det_t *d, uint32_t t_ms, int32_t ma, bool late) |
One reading, at t_ms, of ma; late marks it as having come too long after the one before. | |
Stick programming: the beep detector.
It turns the supply readings into pulses and the pulses into groups. See esc_stick.h, and esc_stick.c for the rules that make a count safe.
SPDX-License-Identifier: MIT
|
static |
Close the pulse that has just fallen and judge its length.
Counts the pulse as a short or a long beep, or marks the group bad when it is no beep.
| d | The beep detector. |
| t_ms | Time of the first low reading after the pulse, ms. |
| void esc_det_count | ( | esc_det_t * | d | ) |
Pulses and groups from the next reading on; the floor is kept.
| d | The detector. |
| void esc_det_drop_group | ( | esc_det_t * | d | ) |
Forget any group under way, as if the line had been silent.
In esc_det.c.
| d | The beep detector. |
| int32_t esc_det_floor_ma | ( | const esc_det_t * | d | ) |
The idle floor, mA.
| d | The detector. |
| void esc_det_floor_only | ( | esc_det_t * | d | ) |
| void esc_det_init | ( | esc_det_t * | d, |
| const esc_stick_timing_t * | t, | ||
| uint8_t | long_equals_short ) |
Set up the beep detector.
| d | The detector. |
| t | The timing. |
| long_equals_short | Count of short beeps that one long beep equals, 0 when every beep is short. |
| esc_det_event_t esc_det_reading | ( | esc_det_t * | d, |
| uint32_t | t_ms, | ||
| int32_t | ma, | ||
| bool | late ) |
One reading, at t_ms, of ma; late marks it as having come too long after the one before.
| d | The detector. |
| t_ms | Time of the reading, ms. |
| ma | Current, mA. |
| late | true when the reading came too long after the one before. |
|
static |
How many readings a span of ms must hold, at the longest interval seen that was not late. 0 while no interval is known.
| d | The beep detector. |
| ms | Span, ms. |