21 #include "../config/rc_controls.h"
25 #include "../config/rx.h"
27 #ifndef DEFAULT_RX_FEATURE
28 #define DEFAULT_RX_FEATURE FEATURE_RX_PARALLEL_PWM
31 #define STICK_CHANNEL_COUNT 4
51 #define SERIALRX_PROVIDER_COUNT (SERIALRX_PROVIDER_MAX + 1)
53 #define RX_MAX_PPM_CHANNELS 12
54 #define MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT 8
56 #define MAX_AUX_CHANNEL_COUNT (RX_MAX_SUPPORTED_RC_CHANNELS - RX_NON_AUX_CHANNEL_COUNT)
58 #if MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT > RX_MAX_PPM_CHANNELS
59 #define MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT MAX_SUPPORTED_RC_PARALLEL_PWM_CHANNEL_COUNT
61 #define MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT RX_MAX_PPM_CHANNELS
63 #define RX_FAILSAFE_MODE_COUNT 3
70 #define RX_FAILSAFE_TYPE_COUNT 2
75 #define RSSI_ADC_SAMPLE_COUNT 16
76 #define RX_CHANNEL_TIMEOUT 300
77 #define PPM_AND_PWM_SAMPLE_COUNT 3
131 uint8_t adcRssiSampleIndex;
132 uint32_t rssiUpdateAt;
bool rx_has_signal(struct rx *self)
RX has signal if at least one channel is healthy.
Definition: rx.c:280
SerialRXType
Definition: rx.h:39
uint8_t type
Definition: fat_standard.h:67
#define RSSI_ADC_SAMPLE_COUNT
Definition: rx.h:75
uint16_t rx_get_refresh_rate(struct rx *self)
Definition: rx.c:457
rx_type_t
Definition: rx.h:81
uint16_t(* rcReadRawDataPtr)(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)
Definition: rx.h:79
uint16_t rcSamples[MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT][PPM_AND_PWM_SAMPLE_COUNT]
samples collected from the receiver.
Definition: rx.h:110
#define PPM_AND_PWM_SAMPLE_COUNT
Definition: rx.h:77
bool rxSamplesCollected
Definition: rx.h:111
int16_t rx_get_channel(struct rx *self, uint8_t chan)
Get channel value. Returns interval [rx_min_usec;rx_max_usec].
Definition: rx.c:470
uint16_t rxRefreshRate
currently set refresh rate in microseconds
Definition: rx.h:127
int16_t rcData[RX_MAX_SUPPORTED_RC_CHANNELS]
calculated output channels
Definition: rx.h:117
sys_micros_t suspendRxSignalUntil
suspends rx signal until specified deadline
Definition: rx.h:106
bool rx_is_healthy(struct rx *self)
RX is healthy if all channels are healthy.
Definition: rx.c:284
struct system_config system
Definition: config.h:99
uint32_t active_channels
holds currently active channels (until they time out)
Definition: rx.h:119
uint16_t rssi
rssi in range: [0;1023]
Definition: rx.h:100
sys_micros_t rxUpdateAt
time for next update (we only update as often as is necessary depending on what type of receiver we h...
Definition: rx.h:103
void rx_update_rssi(struct rx *self)
Definition: rx.c:446
uint8_t rx_get_channel_count(struct rx *self)
Definition: rx.c:465
uint8_t channelCount
Definition: rx.h:72
const struct config * config
Definition: rx.h:138
int32_t sys_micros_t
Definition: system_calls.h:7
rx_type_t rx_type
Definition: rx.h:98
uint32_t used_channels
holds mask of channels that have been active since receiver was connected
Definition: rx.h:121
uint16_t(* rcReadRawFunc)(rxRuntimeConfig_t *rxRuntimeConfig, uint8_t chan)
function used for reading raw values. Returns 0 on failure to read receiver.
Definition: rx.h:124
char rx_get_channel_letter(uint8_t ch)
rxRuntimeConfig_t rxRuntimeConfig
Definition: flight_tilt_unittest.cc:57
bool rx_flight_channels_valid(struct rx *self)
Returns true if channels 0-3 are active.
Definition: rx.c:288
#define MAX_SUPPORTED_RX_PARALLEL_PWM_OR_PPM_CHANNEL_COUNT
Definition: rx.h:61
void rx_resume_signal(struct rx *self)
Definition: rx.c:299
struct rxRuntimeConfig_s rxRuntimeConfig_t
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) ...
Definition: rx.c:185
rxFailsafeChannelType_e
Definition: rx.h:65
rxRuntimeConfig_t rxRuntimeConfig
Definition: rx.h:135
#define RX_MAX_SUPPORTED_RC_CHANNELS
maximum supported channels when calling rx_get_channel
Definition: rx.h:27
serialrxFrameState_t
Definition: rx.h:33
Definition: system_calls.h:200
void rx_suspend_signal(struct rx *self)
Definition: rx.c:292
const struct system_calls * system
Definition: rx.h:137
sys_micros_t rcInvalidPulsPeriod[RX_MAX_SUPPORTED_RC_CHANNELS]
period under which we have not had valid rx signal
Definition: rx.h:115
uint8_t rcSampleIndex
Definition: rx.h:112
uint8_t skipRxSamples
Definition: rx.h:107
uint16_t rx_get_rssi(struct rx *self)
Definition: rx.c:461
void rx_update(struct rx *self)
Definition: rx.c:391
void rx_init(struct rx *self, const struct system_calls *system, const struct config *config)
Definition: rx.c:143