NinjaFlight
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rx.h File Reference
#include <stdbool.h>
#include "../config/rc_controls.h"
#include "target.h"
#include "system_calls.h"
#include "../config/rx.h"
Include dependency graph for rx.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rxRuntimeConfig_s
 
struct  rx
 

Macros

#define DEFAULT_RX_FEATURE   FEATURE_RX_PARALLEL_PWM
 
#define STICK_CHANNEL_COUNT   4
 
#define SERIALRX_PROVIDER_COUNT   (SERIALRX_PROVIDER_MAX + 1)
 
#define RX_MAX_PPM_CHANNELS   12
 
#define MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT   8
 
#define MAX_AUX_CHANNEL_COUNT   (RX_MAX_SUPPORTED_RC_CHANNELS - RX_NON_AUX_CHANNEL_COUNT)
 
#define MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT   RX_MAX_PPM_CHANNELS
 
#define RX_FAILSAFE_MODE_COUNT   3
 
#define RX_FAILSAFE_TYPE_COUNT   2
 
#define RSSI_ADC_SAMPLE_COUNT   16
 
#define RX_CHANNEL_TIMEOUT   300
 
#define PPM_AND_PWM_SAMPLE_COUNT   3
 

Typedefs

typedef struct rxRuntimeConfig_s rxRuntimeConfig_t
 
typedef uint16_t(* rcReadRawDataPtr )(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)
 

Enumerations

enum  serialrxFrameState_t { SERIAL_RX_FRAME_PENDING = 0, SERIAL_RX_FRAME_COMPLETE = (1 << 0), SERIAL_RX_FRAME_FAILSAFE = (1 << 1) }
 
enum  SerialRXType {
  SERIALRX_SPEKTRUM1024 = 0, SERIALRX_SPEKTRUM2048 = 1, SERIALRX_SBUS = 2, SERIALRX_SUMD = 3,
  SERIALRX_SUMH = 4, SERIALRX_XBUS_MODE_B = 5, SERIALRX_XBUS_MODE_B_RJ01 = 6, SERIALRX_IBUS = 7,
  SERIALRX_PROVIDER_MAX = SERIALRX_IBUS
}
 
enum  rxFailsafeChannelType_e { RX_FAILSAFE_TYPE_FLIGHT = 0, RX_FAILSAFE_TYPE_AUX }
 
enum  rx_type_t {
  RX_PWM, RX_PPM, RX_MSP, RX_SERIAL,
  RX_SERIAL_SPEKTRUM1024 = RX_SERIAL, RX_SERIAL_SPEKTRUM2048, RX_SERIAL_SBUS, RX_SERIAL_SUMD,
  RX_SERIAL_SUMH, RX_SERIAL_XBUS_MODE_B, RX_SERIAL_XBUS_MODE_B_RJ01, RX_SERIAL_IBUS
}
 

Functions

void rx_update (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_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...
 
void rx_update_rssi (struct rx *self)
 
void rx_suspend_signal (struct rx *self)
 
void rx_resume_signal (struct rx *self)
 
uint16_t rx_get_refresh_rate (struct rx *self)
 
uint16_t rx_get_rssi (struct rx *self)
 
char rx_get_channel_letter (uint8_t ch)
 
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 DEFAULT_RX_FEATURE   FEATURE_RX_PARALLEL_PWM
#define MAX_AUX_CHANNEL_COUNT   (RX_MAX_SUPPORTED_RC_CHANNELS - RX_NON_AUX_CHANNEL_COUNT)
#define MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT   8
#define MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT   RX_MAX_PPM_CHANNELS
#define PPM_AND_PWM_SAMPLE_COUNT   3
#define RSSI_ADC_SAMPLE_COUNT   16
#define RX_CHANNEL_TIMEOUT   300
#define RX_FAILSAFE_MODE_COUNT   3
#define RX_FAILSAFE_TYPE_COUNT   2
#define RX_MAX_PPM_CHANNELS   12
#define SERIALRX_PROVIDER_COUNT   (SERIALRX_PROVIDER_MAX + 1)
#define STICK_CHANNEL_COUNT   4

Typedef Documentation

typedef uint16_t(* rcReadRawDataPtr)(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)

Enumeration Type Documentation

enum rx_type_t
Enumerator
RX_PWM 
RX_PPM 
RX_MSP 
RX_SERIAL 
RX_SERIAL_SPEKTRUM1024 
RX_SERIAL_SPEKTRUM2048 
RX_SERIAL_SBUS 
RX_SERIAL_SUMD 
RX_SERIAL_SUMH 
RX_SERIAL_XBUS_MODE_B 
RX_SERIAL_XBUS_MODE_B_RJ01 
RX_SERIAL_IBUS 
Enumerator
RX_FAILSAFE_TYPE_FLIGHT 
RX_FAILSAFE_TYPE_AUX 
Enumerator
SERIAL_RX_FRAME_PENDING 
SERIAL_RX_FRAME_COMPLETE 
SERIAL_RX_FRAME_FAILSAFE 
Enumerator
SERIALRX_SPEKTRUM1024 
SERIALRX_SPEKTRUM2048 
SERIALRX_SBUS 
SERIALRX_SUMD 
SERIALRX_SUMH 
SERIALRX_XBUS_MODE_B 
SERIALRX_XBUS_MODE_B_RJ01 
SERIALRX_IBUS 
SERIALRX_PROVIDER_MAX 

Function Documentation

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)
char rx_get_channel_letter ( uint8_t  ch)
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)