Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
cc2500_compat.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
Include dependency graph for cc2500_compat.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  attitude_values_t
struct  attitude_t
struct  pt1Filter_s
struct  pidGains_s
struct  pidProfile_s
struct  gpio_t
struct  controlRateConfig_t

Macros

#define USE_RX_SPI
#define USE_RX_FRSKY_SPI
#define USE_RX_FRSKY_SPI_TELEMETRY
#define USE_RX_FRSKY_SPI_X
#define USE_TELEMETRY_SMARTPORT
#define USE_RX_FRSKY_SPI_D
#define DEBUG_SET(...)
#define STATIC_ASSERT(...)
#define STATIC_UNIT_TESTED   static
#define sensors(...)
#define attitude   bf_attitude
#define FALLTHROUGH   do {} while(0)
#define TIMEUS_MAX   UINT32_MAX
#define MIN(a, b)
#define PID_ROLL   0
#define PID_PITCH   0
#define PID_YAW   0
#define featureIsEnabled(mask)
#define delayMicroseconds(us)
#define delay(ms)
#define micros()
#define millis()
#define ADC_EXTERNAL1   1
#define adcGetChannel(channel)
#define RX_SPI_MAX_PAYLOAD_SIZE   35
#define rxSpiDeviceInit(rxSpiConfig)
#define PPM_RCVR_TIMEOUT   0
#define IO_NONE   NULL
#define IOGetByTag(io)
#define IOInit(io, owner, index)
#define IOConfigGPIO(io, cfg)
#define IORead(gpio)
#define IOHi(io)
#define IOLo(io)
#define IOToggle(io)
#define isArmingDisabled()
#define ARMING_FLAG(...)
#define FLIGHT_MODE(...)
#define FD_ROLL   0
#define FD_PITCH   0
#define FD_YAW   0
#define getEstimatedAltitudeCm()
#define getEstimatedVario()
#define isBatteryVoltageConfigured()
#define getLegacyBatteryVoltage()
#define getBatteryVoltage()
#define getBatteryCellCount()
#define isAmperageConfigured()
#define getAmperage()
#define getMAhDrawn()

Typedefs

typedef int32_t timeDelta_t
typedef uint32_t timeMs_t
typedef uint32_t timeUs_t
typedef struct pt1Filter_s pt1Filter_t
typedef void(* gpiofnptr_t) (uint32_t port, uint16_t pin)
typedef struct gpio_t * IO_t
typedef IO_t ioTag_t

Enumerations

enum  features_e {
  FEATURE_RX_PPM = 1 << 0 , FEATURE_RX_SERIAL = 1 << 3 , FEATURE_TELEMETRY = 1 << 10 , FEATURE_RX_PARALLEL_PWM = 1 << 13 ,
  FEATURE_RX_MSP = 1 << 14 , FEATURE_RSSI_ADC = 1 << 15 , FEATURE_RX_SPI = 1 << 25
}
enum  ioconfig_t { IOCFG_OUT_PP , IOCFG_IN_FLOATING , IOCFG_IPU }
enum  resourceOwner_e { OWNER_RX_SPI_EXTI , OWNER_RX_SPI_BIND , OWNER_LED }

Functions

static timeDelta_t cmpTimeUs (timeUs_t a, timeUs_t b)
float pt1FilterGain (float f_cut, float dT)
void pt1FilterInit (pt1Filter_t *filter, float k)
void pt1FilterUpdateCutoff (pt1Filter_t *filter, float k)
float pt1FilterApply (pt1Filter_t *filter, float input)
bool bf_featureIsEnabled (const uint32_t mask)
void bf_delayMicroseconds (timeUs_t us)
void bf_delay (timeMs_t ms)
timeUs_t bf_micros (void)
timeMs_t bf_millis (void)
uint16_t bf_adcGetChannel (uint8_t channel)
bool bf_rxSpiDeviceInit (void)
IO_t bf_IOGetByTag (ioTag_t io)
void bf_IOInit (IO_t io, uint8_t owner, uint8_t index)
void bf_IOConfigGPIO (IO_t io, enum ioconfig_t cfg)
bool bf_IORead (IO_t gpio)
void bf_IOHi (IO_t io)
void bf_IOLo (IO_t io)
void bf_IOToggle (IO_t io)
int32_t bf_getEstimatedAltitudeCm (void)
int16_t bf_getEstimatedVario (void)
bool bf_isBatteryVoltageConfigured (void)
uint16_t bf_getLegacyBatteryVoltage (void)
uint16_t bf_getBatteryVoltage (void)
uint8_t bf_getBatteryCellCount (void)
bool bf_isAmperageConfigured (void)
int32_t bf_getAmperage (void)
int32_t bf_getMAhDrawn (void)

Variables

struct attitude_t bf_attitude
struct pidProfile_s * currentPidProfile
controlRateConfig_t * currentControlRateProfile

Data Structure Documentation

◆ attitude_values_t

struct attitude_values_t

Definition at line 70 of file cc2500_compat.h.

Data Fields
int8_t pitch
int8_t roll
int8_t yaw

◆ attitude_t

struct attitude_t

Definition at line 75 of file cc2500_compat.h.

Collaboration diagram for attitude_t:
Data Fields
struct attitude_values_t values

◆ pt1Filter_s

struct pt1Filter_s

Definition at line 107 of file cc2500_compat.h.

Data Fields
float k
float state

◆ pidGains_s

struct pidGains_s

Definition at line 123 of file cc2500_compat.h.

Data Fields
uint8_t D
uint8_t I
uint8_t P

◆ pidProfile_s

struct pidProfile_s

Definition at line 128 of file cc2500_compat.h.

Collaboration diagram for pidProfile_s:
Data Fields
struct pidGains_s pid[1]

◆ gpio_t

struct gpio_t

Definition at line 199 of file cc2500_compat.h.

Data Fields
gpiofnptr_t hi
gpiofnptr_t lo
uint16_t pin
uint32_t port

◆ controlRateConfig_t

struct controlRateConfig_t

Definition at line 244 of file cc2500_compat.h.

Data Fields
uint8_t rates[1]

Macro Definition Documentation

◆ ADC_EXTERNAL1

#define ADC_EXTERNAL1   1

Definition at line 180 of file cc2500_compat.h.

Referenced by buildTelemetryFrame().

◆ adcGetChannel

#define adcGetChannel ( channel)
Value:
uint16_t bf_adcGetChannel(uint8_t channel)

Definition at line 182 of file cc2500_compat.h.

Referenced by buildTelemetryFrame().

◆ ARMING_FLAG

#define ARMING_FLAG ( ...)
Value:
1

Definition at line 236 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ attitude

◆ DEBUG_SET

#define DEBUG_SET ( ...)
Value:
/* Do nothing */

Definition at line 62 of file cc2500_compat.h.

Referenced by frSkyXHandlePacket().

◆ delay

◆ delayMicroseconds

#define delayMicroseconds ( us)
Value:
void bf_delayMicroseconds(timeUs_t us)

Definition at line 168 of file cc2500_compat.h.

Referenced by frSkyXHandlePacket(), initGetBind(), and initialise().

◆ FALLTHROUGH

#define FALLTHROUGH   do {} while(0)

Definition at line 86 of file cc2500_compat.h.

Referenced by frSkyXHandlePacket().

◆ FD_PITCH

#define FD_PITCH   0

Definition at line 242 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ FD_ROLL

#define FD_ROLL   0

Definition at line 241 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ FD_YAW

#define FD_YAW   0

Definition at line 243 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ featureIsEnabled

#define featureIsEnabled ( mask)
Value:
bool bf_featureIsEnabled(const uint32_t mask)

Definition at line 163 of file cc2500_compat.h.

Referenced by frSkyXInit(), initSmartPortSensors(), processSmartPortTelemetry(), and rxInit().

◆ FLIGHT_MODE

#define FLIGHT_MODE ( ...)
Value:
0

Definition at line 237 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getAmperage

#define getAmperage ( )
Value:
int32_t bf_getAmperage(void)

Definition at line 281 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getBatteryCellCount

#define getBatteryCellCount ( )
Value:
uint8_t bf_getBatteryCellCount(void)

Definition at line 276 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getBatteryVoltage

#define getBatteryVoltage ( )
Value:
uint16_t bf_getBatteryVoltage(void)

Definition at line 273 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getEstimatedAltitudeCm

#define getEstimatedAltitudeCm ( )
Value:
int32_t bf_getEstimatedAltitudeCm(void)

Definition at line 252 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getEstimatedVario

#define getEstimatedVario ( )
Value:
int16_t bf_getEstimatedVario(void)

Definition at line 255 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ getLegacyBatteryVoltage

#define getLegacyBatteryVoltage ( )
Value:
uint16_t bf_getLegacyBatteryVoltage(void)

Definition at line 271 of file cc2500_compat.h.

Referenced by buildTelemetryFrame().

◆ getMAhDrawn

#define getMAhDrawn ( )
Value:
int32_t bf_getMAhDrawn(void)

Definition at line 283 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ IO_NONE

#define IO_NONE   NULL

Definition at line 207 of file cc2500_compat.h.

Referenced by cc2500SpiInit(), and rxSpiCommonIOInit().

◆ IOConfigGPIO

#define IOConfigGPIO ( io,
cfg )
Value:
void bf_IOConfigGPIO(IO_t io, enum ioconfig_t cfg)

Definition at line 221 of file cc2500_compat.h.

Referenced by cc2500SpiInit(), and rxSpiCommonIOInit().

◆ IOGetByTag

#define IOGetByTag ( io)
Value:
IO_t bf_IOGetByTag(ioTag_t io)

Definition at line 210 of file cc2500_compat.h.

Referenced by cc2500SpiInit(), and rxSpiCommonIOInit().

◆ IOHi

#define IOHi ( io)
Value:
void bf_IOHi(IO_t io)

Definition at line 227 of file cc2500_compat.h.

Referenced by cc2500SpiInit(), rxSpiLedOff(), and rxSpiLedOn().

◆ IOInit

#define IOInit ( io,
owner,
index )
Value:
bf_IOInit(io, owner, index)
void bf_IOInit(IO_t io, uint8_t owner, uint8_t index)

Definition at line 213 of file cc2500_compat.h.

Referenced by cc2500SpiInit(), and rxSpiCommonIOInit().

◆ IOLo

#define IOLo ( io)
Value:
void bf_IOLo(IO_t io)

Definition at line 229 of file cc2500_compat.h.

Referenced by rxSpiLedOff(), and rxSpiLedOn().

◆ IORead

#define IORead ( gpio)
Value:
bf_IORead(gpio)
bool bf_IORead(IO_t gpio)

Definition at line 224 of file cc2500_compat.h.

Referenced by cc2500getGdo(), rxSpiCheckBindRequested(), and rxSpiCommonIOInit().

◆ IOToggle

#define IOToggle ( io)
Value:
void bf_IOToggle(IO_t io)

Definition at line 231 of file cc2500_compat.h.

Referenced by rxSpiLedToggle().

◆ isAmperageConfigured

#define isAmperageConfigured ( )
Value:
bool bf_isAmperageConfigured(void)

Definition at line 279 of file cc2500_compat.h.

Referenced by initSmartPortSensors().

◆ isArmingDisabled

#define isArmingDisabled ( )
Value:
0

Definition at line 235 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ isBatteryVoltageConfigured

#define isBatteryVoltageConfigured ( )
Value:
bool bf_isBatteryVoltageConfigured(void)

Definition at line 268 of file cc2500_compat.h.

Referenced by initSmartPortSensors().

◆ micros

#define micros ( )
Value:
timeUs_t bf_micros(void)

Definition at line 174 of file cc2500_compat.h.

Referenced by frSkyXHandlePacket(), and processSmartPortTelemetry().

◆ millis

#define millis ( )
Value:
timeMs_t bf_millis(void)

Definition at line 176 of file cc2500_compat.h.

Referenced by frSkySpiDataReceived(), frSkySpiInit(), frSkyXProcessFrame(), initTuneRx(), rxInit(), rxSpiLedBlink(), and tuneRx().

◆ MIN

#define MIN ( a,
b )
Value:
__extension__ ({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
_a < _b ? _a : _b; })
float b
Definition wedgebug.c:202

Definition at line 100 of file cc2500_compat.h.

◆ PID_PITCH

#define PID_PITCH   0

Definition at line 120 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ PID_ROLL

#define PID_ROLL   0

Definition at line 119 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ PID_YAW

#define PID_YAW   0

Definition at line 121 of file cc2500_compat.h.

Referenced by processSmartPortTelemetry().

◆ PPM_RCVR_TIMEOUT

#define PPM_RCVR_TIMEOUT   0

Definition at line 193 of file cc2500_compat.h.

Referenced by nullReadRawRC().

◆ RX_SPI_MAX_PAYLOAD_SIZE

#define RX_SPI_MAX_PAYLOAD_SIZE   35

Definition at line 186 of file cc2500_compat.h.

Referenced by rxSpiReadRawRC().

◆ rxSpiDeviceInit

#define rxSpiDeviceInit ( rxSpiConfig)
Value:
bool bf_rxSpiDeviceInit(void)

Definition at line 189 of file cc2500_compat.h.

Referenced by rxSpiInit().

◆ sensors

◆ STATIC_ASSERT

#define STATIC_ASSERT ( ...)
Value:
/* Do nothing */

Definition at line 63 of file cc2500_compat.h.

Referenced by rxSpiReadRawRC().

◆ STATIC_UNIT_TESTED

#define STATIC_UNIT_TESTED   static

Definition at line 64 of file cc2500_compat.h.

Referenced by rxSpiReadRawRC(), and rxSpiSetProtocol().

◆ TIMEUS_MAX

#define TIMEUS_MAX   UINT32_MAX

Definition at line 94 of file cc2500_compat.h.

◆ USE_RX_FRSKY_SPI

#define USE_RX_FRSKY_SPI

Definition at line 51 of file cc2500_compat.h.

◆ USE_RX_FRSKY_SPI_D

#define USE_RX_FRSKY_SPI_D

Definition at line 59 of file cc2500_compat.h.

◆ USE_RX_FRSKY_SPI_TELEMETRY

#define USE_RX_FRSKY_SPI_TELEMETRY

Definition at line 52 of file cc2500_compat.h.

◆ USE_RX_FRSKY_SPI_X

#define USE_RX_FRSKY_SPI_X

Definition at line 55 of file cc2500_compat.h.

◆ USE_RX_SPI

#define USE_RX_SPI

Definition at line 50 of file cc2500_compat.h.

◆ USE_TELEMETRY_SMARTPORT

#define USE_TELEMETRY_SMARTPORT

Definition at line 56 of file cc2500_compat.h.

Typedef Documentation

◆ gpiofnptr_t

typedef void(* gpiofnptr_t) (uint32_t port, uint16_t pin)

Definition at line 197 of file cc2500_compat.h.

◆ IO_t

typedef struct gpio_t* IO_t

Definition at line 205 of file cc2500_compat.h.

◆ ioTag_t

typedef IO_t ioTag_t

Definition at line 206 of file cc2500_compat.h.

◆ pt1Filter_t

typedef struct pt1Filter_s pt1Filter_t

◆ timeDelta_t

Definition at line 91 of file cc2500_compat.h.

◆ timeMs_t

typedef uint32_t timeMs_t

Definition at line 92 of file cc2500_compat.h.

◆ timeUs_t

typedef uint32_t timeUs_t

Definition at line 93 of file cc2500_compat.h.

Enumeration Type Documentation

◆ features_e

enum features_e
Enumerator
FEATURE_RX_PPM 
FEATURE_RX_SERIAL 
FEATURE_TELEMETRY 
FEATURE_RX_PARALLEL_PWM 
FEATURE_RX_MSP 
FEATURE_RSSI_ADC 
FEATURE_RX_SPI 

Definition at line 135 of file cc2500_compat.h.

◆ ioconfig_t

enum ioconfig_t
Enumerator
IOCFG_OUT_PP 
IOCFG_IN_FLOATING 
IOCFG_IPU 

Definition at line 215 of file cc2500_compat.h.

◆ resourceOwner_e

Enumerator
OWNER_RX_SPI_EXTI 
OWNER_RX_SPI_BIND 
OWNER_LED 

Definition at line 259 of file cc2500_compat.h.

Function Documentation

◆ bf_adcGetChannel()

uint16_t bf_adcGetChannel ( uint8_t channel)

Definition at line 95 of file cc2500_compat.c.

References electrical.

◆ bf_delay()

void bf_delay ( timeMs_t ms)

Definition at line 81 of file cc2500_compat.c.

References bf_delayMicroseconds().

Here is the call graph for this function:

◆ bf_delayMicroseconds()

void bf_delayMicroseconds ( timeUs_t us)

Definition at line 77 of file cc2500_compat.c.

References sys_time_usleep().

Referenced by bf_delay().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bf_featureIsEnabled()

bool bf_featureIsEnabled ( const uint32_t mask)

Definition at line 47 of file cc2500_compat.c.

References FEATURE_RX_SPI, and FEATURE_TELEMETRY.

◆ bf_getAmperage()

int32_t bf_getAmperage ( void )

Definition at line 193 of file cc2500_compat.c.

References electrical.

◆ bf_getBatteryCellCount()

uint8_t bf_getBatteryCellCount ( void )

Definition at line 185 of file cc2500_compat.c.

◆ bf_getBatteryVoltage()

uint16_t bf_getBatteryVoltage ( void )

Definition at line 181 of file cc2500_compat.c.

References electrical.

◆ bf_getEstimatedAltitudeCm()

int32_t bf_getEstimatedAltitudeCm ( void )

Definition at line 163 of file cc2500_compat.c.

References stateGetPositionEnu_f(), and EnuCoor_f::z.

Here is the call graph for this function:

◆ bf_getEstimatedVario()

int16_t bf_getEstimatedVario ( void )

Definition at line 167 of file cc2500_compat.c.

References stateGetSpeedEnu_f(), and EnuCoor_f::z.

Here is the call graph for this function:

◆ bf_getLegacyBatteryVoltage()

uint16_t bf_getLegacyBatteryVoltage ( void )

Definition at line 177 of file cc2500_compat.c.

References electrical.

◆ bf_getMAhDrawn()

int32_t bf_getMAhDrawn ( void )

Definition at line 197 of file cc2500_compat.c.

References electrical.

◆ bf_IOConfigGPIO()

void bf_IOConfigGPIO ( IO_t io,
enum ioconfig_t cfg )

Definition at line 119 of file cc2500_compat.c.

References gpio_setup_input(), gpio_setup_input_pullup(), gpio_setup_output(), IOCFG_IN_FLOATING, IOCFG_IPU, IOCFG_OUT_PP, gpio_t::pin, and gpio_t::port.

Here is the call graph for this function:

◆ bf_IOGetByTag()

IO_t bf_IOGetByTag ( ioTag_t io)

Definition at line 109 of file cc2500_compat.c.

◆ bf_IOHi()

void bf_IOHi ( IO_t io)

Definition at line 142 of file cc2500_compat.c.

References gpio_t::hi, gpio_t::pin, and gpio_t::port.

◆ bf_IOInit()

void bf_IOInit ( IO_t io,
uint8_t owner,
uint8_t index )

Definition at line 113 of file cc2500_compat.c.

◆ bf_IOLo()

void bf_IOLo ( IO_t io)

Definition at line 147 of file cc2500_compat.c.

References gpio_t::lo, gpio_t::pin, and gpio_t::port.

◆ bf_IORead()

bool bf_IORead ( IO_t gpio)

Definition at line 137 of file cc2500_compat.c.

References gpio_get(), gpio_t::pin, and gpio_t::port.

Here is the call graph for this function:

◆ bf_IOToggle()

void bf_IOToggle ( IO_t io)

Definition at line 152 of file cc2500_compat.c.

References gpio_toggle(), gpio_t::pin, and gpio_t::port.

Here is the call graph for this function:

◆ bf_isAmperageConfigured()

bool bf_isAmperageConfigured ( void )

Definition at line 189 of file cc2500_compat.c.

References TRUE.

◆ bf_isBatteryVoltageConfigured()

bool bf_isBatteryVoltageConfigured ( void )

Definition at line 173 of file cc2500_compat.c.

References TRUE.

◆ bf_micros()

timeUs_t bf_micros ( void )

Definition at line 85 of file cc2500_compat.c.

References get_sys_time_usec().

Here is the call graph for this function:

◆ bf_millis()

timeMs_t bf_millis ( void )

Definition at line 89 of file cc2500_compat.c.

References get_sys_time_msec().

Here is the call graph for this function:

◆ bf_rxSpiDeviceInit()

bool bf_rxSpiDeviceInit ( void )

Definition at line 103 of file cc2500_compat.c.

References TRUE.

◆ cmpTimeUs()

timeDelta_t cmpTimeUs ( timeUs_t a,
timeUs_t b )
inlinestatic

Definition at line 96 of file cc2500_compat.h.

References b.

Referenced by frSkyXHandlePacket(), and processSmartPortTelemetry().

Here is the caller graph for this function:

◆ pt1FilterApply()

float pt1FilterApply ( pt1Filter_t * filter,
float input )

Definition at line 70 of file cc2500_compat.c.

References pt1Filter_s::k, and pt1Filter_s::state.

Referenced by setRssi().

Here is the caller graph for this function:

◆ pt1FilterGain()

float pt1FilterGain ( float f_cut,
float dT )

Definition at line 55 of file cc2500_compat.c.

References M_PI_FLOAT.

Referenced by rxInit().

Here is the caller graph for this function:

◆ pt1FilterInit()

void pt1FilterInit ( pt1Filter_t * filter,
float k )

Definition at line 61 of file cc2500_compat.c.

References pt1Filter_s::k, and pt1Filter_s::state.

Referenced by rxInit().

Here is the caller graph for this function:

◆ pt1FilterUpdateCutoff()

void pt1FilterUpdateCutoff ( pt1Filter_t * filter,
float k )

Definition at line 66 of file cc2500_compat.c.

References pt1Filter_s::k.

Variable Documentation

◆ bf_attitude

struct attitude_t bf_attitude
extern

Definition at line 39 of file cc2500_compat.c.

◆ currentControlRateProfile

controlRateConfig_t* currentControlRateProfile
extern

Definition at line 159 of file cc2500_compat.c.

Referenced by processSmartPortTelemetry().

◆ currentPidProfile

struct pidProfile_s* currentPidProfile
extern

Definition at line 43 of file cc2500_compat.c.

Referenced by processSmartPortTelemetry().