Skip to content

File syn_ppm.h

FileList > input > syn_ppm.h

Go to the source code of this file

Zero-Heap PPM (Pulse-Position Modulation) Multi-Channel RC Receiver Decoder. More...

  • #include "syntropic/common/syn_defs.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_PPM_Decoder

Public Functions

Type Name
uint16_t syn_ppm_get_channel (const SYN_PPM_Decoder * ppm, uint8_t channel_idx)
Get pulse width (us) for specified 0-indexed channel.
SYN_Status syn_ppm_init (SYN_PPM_Decoder * ppm)
Initialize PPM decoder instance.
SYN_Status syn_ppm_process_pulse (SYN_PPM_Decoder * ppm, uint16_t pulse_us)
Process high-resolution measured pulse width (us) from Timer Input Capture interrupt.

Macros

Type Name
define SYN_PPM_MAX_CHANNELS 12
define SYN_PPM_SYNC_MIN_US 2700U

Detailed Description

PPM Protocol Specifications: * Single-wire pulse train consisting of 4..12 channel pulse widths (1000..2000 us). * Sync gap: Pulse width > 2700 us demarcates frame boundary. * Pulse separator: Short low pulse (e.g. 300..500 us).

Public Functions Documentation

function syn_ppm_get_channel

Get pulse width (us) for specified 0-indexed channel.

uint16_t syn_ppm_get_channel (
    const SYN_PPM_Decoder * ppm,
    uint8_t channel_idx
) 

Parameters:

  • ppm Pointer to decoder struct.
  • channel_idx 0-indexed channel index (0..11).

Returns:

Pulse width in microseconds (clamped 1000..2000 us, or 1500 us default if unreceived).


function syn_ppm_init

Initialize PPM decoder instance.

SYN_Status syn_ppm_init (
    SYN_PPM_Decoder * ppm
) 

Parameters:

  • ppm Pointer to decoder struct.

Returns:

SYN_OK on success.


function syn_ppm_process_pulse

Process high-resolution measured pulse width (us) from Timer Input Capture interrupt.

SYN_Status syn_ppm_process_pulse (
    SYN_PPM_Decoder * ppm,
    uint16_t pulse_us
) 

Parameters:

  • ppm Pointer to decoder struct.
  • pulse_us Measured pulse width in microseconds (us).

Returns:

SYN_OK when a complete multi-channel PPM frame is finished, SYN_BUSY during channel reception.


Macro Definition Documentation

define SYN_PPM_MAX_CHANNELS

#define SYN_PPM_MAX_CHANNELS `12`

Maximum supported PPM channels (12)


define SYN_PPM_SYNC_MIN_US

#define SYN_PPM_SYNC_MIN_US `2700U`

Minimum sync pulse gap in microseconds (2700 us)



The documentation for this class was generated from the following file src/syntropic/input/syn_ppm.h