|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
PPM frame layout. More...
#include "ppm.h"Functions | |
| static ppm_cfg_t | resolve (const ppm_cfg_t *cfg) |
| A zero field means "the default for it", so a caller can set one thing. | |
| uint32_t | ppm_min_frame_us (uint8_t channels, const ppm_cfg_t *cfg) |
The shortest frame that can carry channels channels whatever they are commanded to, in microseconds: every channel at PPM_CHANNEL_MAX_US, plus the terminating mark, plus the smallest gap that is still a gap. | |
| size_t | ppm_frame (const uint16_t *channel_us, uint8_t channels, const ppm_cfg_t *cfg, uint16_t *runs, size_t max_runs) |
| Lay a frame out as alternating run lengths in microseconds. | |
Variables | |
| static const ppm_cfg_t | k_default |
| size_t ppm_frame | ( | const uint16_t * | channel_us, |
| uint8_t | channels, | ||
| const ppm_cfg_t * | cfg, | ||
| uint16_t * | runs, | ||
| size_t | max_runs ) |
Lay a frame out as alternating run lengths in microseconds.
runs receives mark, space, mark, space, ... and ends with the terminating mark and the sync gap, so it always holds an even number of entries and always begins with a mark. A driver toggles the pin at each one and does not need to know which is which.
Returns the number of runs written, or 0 when the frame cannot be built: no channels or too many, a channel shorter than the mark it has to contain, a channel outside PPM_CHANNEL_MIN_US..PPM_CHANNEL_MAX_US, or a sync gap below cfg->sync_min_us once the channels have been paid for.
| channel_us | Pulse width of each channel, in us. |
| channels | Number of channels in channel_us. |
| cfg | Frame timing; NULL takes the defaults. |
| runs | Receives the runs. |
| max_runs | Capacity of runs, in entries. |
| uint32_t ppm_min_frame_us | ( | uint8_t | channels, |
| const ppm_cfg_t * | cfg ) |
The shortest frame that can carry channels channels whatever they are commanded to, in microseconds: every channel at PPM_CHANNEL_MAX_US, plus the terminating mark, plus the smallest gap that is still a gap.
A configuration screen wants this before it offers a frame rate, so the refusal above becomes a range the operator never leaves rather than an error they hit. Returns 0 for a channel count this module cannot carry.
| channels | Number of channels to carry. |
| cfg | Frame timing; NULL takes the defaults. |
|
static |