NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rx.c File Reference
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <platform.h>
#include "config/config.h"
#include "system_calls.h"
#include "build_config.h"
#include "debug.h"
#include "../common/maths.h"
#include "../common/utils.h"
#include "../drivers/pwm_rx.h"
#include "../drivers/adc.h"
#include "../drivers/system.h"
#include "pwm.h"
#include "sbus.h"
#include "spektrum.h"
#include "sumd.h"
#include "sumh.h"
#include "msp.h"
#include "xbus.h"
#include "ibus.h"
#include "rx.h"
Include dependency graph for rx.c:

Macros

#define DELAY_50_HZ   (1000000 / 50)
 
#define DELAY_10_HZ   (1000000 / 10)
 
#define DELAY_5_HZ   (1000000 / 5)
 
#define SKIP_RC_ON_SUSPEND_PERIOD   1500000
 
#define SKIP_RC_SAMPLES_ON_RESUME   2
 
#define REQUIRED_CHANNEL_MASK   0x0F
 

Functions

void serialRxInit (struct rx_config *rxConfig)
 
bool isPulseValid (const struct rx_config *conf, uint16_t pulseDuration)
 
void rx_init (struct rx *self, const struct system_calls *system, const struct config *config)
 
void rx_set_type (struct rx *self, rx_type_t type)
 changes the receiver type (determines what system calls the rx system will use to get receiver data) More...
 
uint8_t serialRxFrameStatus (struct rx *self)
 
bool rx_has_signal (struct rx *self)
 RX has signal if at least one channel is healthy. More...
 
bool rx_is_healthy (struct rx *self)
 RX is healthy if all channels are healthy. More...
 
bool rx_flight_channels_valid (struct rx *self)
 Returns true if channels 0-3 are active. More...
 
void rx_suspend_signal (struct rx *self)
 
void rx_resume_signal (struct rx *self)
 
void rx_update (struct rx *self)
 
void rx_update_rssi (struct rx *self)
 
uint16_t rx_get_refresh_rate (struct rx *self)
 
uint16_t rx_get_rssi (struct rx *self)
 
uint8_t rx_get_channel_count (struct rx *self)
 
int16_t rx_get_channel (struct rx *self, uint8_t chan)
 Get channel value. Returns interval [rx_min_usec;rx_max_usec]. More...
 

Macro Definition Documentation

#define DELAY_10_HZ   (1000000 / 10)
#define DELAY_50_HZ   (1000000 / 50)
#define DELAY_5_HZ   (1000000 / 5)
#define REQUIRED_CHANNEL_MASK   0x0F
#define SKIP_RC_ON_SUSPEND_PERIOD   1500000
#define SKIP_RC_SAMPLES_ON_RESUME   2

Function Documentation

bool isPulseValid ( const struct rx_config conf,
uint16_t  pulseDuration 
)
bool rx_flight_channels_valid ( struct rx self)

Returns true if channels 0-3 are active.

int16_t rx_get_channel ( struct rx self,
uint8_t  chan 
)

Get channel value. Returns interval [rx_min_usec;rx_max_usec].

uint8_t rx_get_channel_count ( struct rx self)
uint16_t rx_get_refresh_rate ( struct rx self)
uint16_t rx_get_rssi ( struct rx self)
bool rx_has_signal ( struct rx self)

RX has signal if at least one channel is healthy.

void rx_init ( struct rx self,
const struct system_calls system,
const struct config config 
)
bool rx_is_healthy ( struct rx self)

RX is healthy if all channels are healthy.

void rx_resume_signal ( struct rx self)
void rx_set_type ( struct rx self,
rx_type_t  type 
)

changes the receiver type (determines what system calls the rx system will use to get receiver data)

Sets receiver type.

Here is the call graph for this function:

void rx_suspend_signal ( struct rx self)
void rx_update ( struct rx self)

Here is the call graph for this function:

void rx_update_rssi ( struct rx self)
uint8_t serialRxFrameStatus ( struct rx self)

FIXME: Each of the xxxxFrameStatus() methods MUST be able to survive being called without the corresponding xxxInit() method having been called first.

This situation arises when the cli or the msp changes the value of rxConfig->serialrx_provider

A solution is for the ___Init() to configure the serialRxFrameStatus function pointer which should be used instead of the switch statement below.

Here is the call graph for this function:

void serialRxInit ( struct rx_config rxConfig)