Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
ppm.c File Reference

Architecture independent functions for PPM radio control. More...

+ Include dependency graph for ppm.c:

Go to the source code of this file.

Macros

#define RssiValid()   TRUE
 RssiValid test macro. More...
 

Functions

static void send_ppm (struct transport_tx *trans, struct link_device *dev)
 
void ppm_init (void)
 RC init function. More...
 
void ppm_event (void)
 RC event function. More...
 
void ppm_decode_frame (uint32_t ppm_time)
 Decode a PPM frame from global timer value. More...
 
void ppm_decode_frame_width (uint32_t ppm_width)
 Decode a PPM frame from last width. More...
 

Variables

uint16_t ppm_pulses [RADIO_CTL_NB]
 
volatile bool ppm_frame_available
 
static uint8_t ppm_cur_pulse
 
static uint32_t ppm_last_pulse_time
 
static bool ppm_data_valid
 

Detailed Description

Architecture independent functions for PPM radio control.

Definition in file ppm.c.

Macro Definition Documentation

◆ RssiValid

#define RssiValid ( )    TRUE

RssiValid test macro.

This macro has to be defined to test the validity of ppm frame from an other source (ex: GPIO). By default, always true.

Definition at line 53 of file ppm.c.

Function Documentation

◆ ppm_decode_frame()

void ppm_decode_frame ( uint32_t  ppm_time)

Decode a PPM frame from global timer value.

A valid ppm frame:

  • synchro blank
  • correct number of channels
  • synchro blank

Definition at line 105 of file ppm.c.

References ppm_decode_frame_width(), and ppm_last_pulse_time.

+ Here is the call graph for this function:

◆ ppm_decode_frame_width()

void ppm_decode_frame_width ( uint32_t  ppm_width)

Decode a PPM frame from last width.

A valid ppm frame:

  • synchro blank
  • correct number of channels
  • synchro blank

Definition at line 120 of file ppm.c.

References ppm_cur_pulse, ppm_data_valid, ppm_frame_available, ppm_pulses, RC_PPM_TICKS_OF_USEC, and RssiValid.

Referenced by icuperiodcb(), and ppm_decode_frame().

+ Here is the caller graph for this function:

◆ ppm_event()

void ppm_event ( void  )

RC event function.

PPM frames are normalized using the IIR filter.

Definition at line 86 of file ppm.c.

References RadioControl::frame_cpt, ppm_frame_available, ppm_pulses, radio_control, RADIO_CONTROL_PPM_ID, RadioControl::radio_ok_cpt, RC_OK, RadioControl::status, and RadioControl::time_since_last_frame.

◆ ppm_init()

void ppm_init ( void  )

RC init function.

Definition at line 71 of file ppm.c.

References DefaultPeriodic, RadioControl::nb_channel, ppm_arch_init(), ppm_cur_pulse, ppm_data_valid, ppm_frame_available, ppm_last_pulse_time, radio_control, register_periodic_telemetry(), and send_ppm().

+ Here is the call graph for this function:

◆ send_ppm()

static void send_ppm ( struct transport_tx *  trans,
struct link_device *  dev 
)
static

Definition at line 60 of file ppm.c.

References dev, RadioControl::frame_rate, ppm_pulses, radio_control, and USEC_OF_RC_PPM_TICKS.

Referenced by ppm_init().

+ Here is the caller graph for this function:

Variable Documentation

◆ ppm_cur_pulse

uint8_t ppm_cur_pulse
static

Definition at line 42 of file ppm.c.

Referenced by ppm_decode_frame_width(), and ppm_init().

◆ ppm_data_valid

bool ppm_data_valid
static

Definition at line 44 of file ppm.c.

Referenced by ppm_decode_frame_width(), and ppm_init().

◆ ppm_frame_available

volatile bool ppm_frame_available

Definition at line 37 of file ppm.c.

Referenced by ppm_decode_frame_width(), ppm_event(), ppm_init(), and radio_control_feed().

◆ ppm_last_pulse_time

uint32_t ppm_last_pulse_time
static

Definition at line 43 of file ppm.c.

Referenced by ppm_decode_frame(), and ppm_init().

◆ ppm_pulses

uint16_t ppm_pulses[RADIO_CTL_NB]

Definition at line 36 of file ppm.c.

Referenced by ppm_decode_frame_width(), ppm_event(), radio_control_feed(), and send_ppm().