Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
cc2500.c File Reference
#include "modules/datalink/downlink.h"
#include "cc2500.h"
#include "generated/modules.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/spi.h"
#include <assert.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
+ Include dependency graph for cc2500.c:

Go to the source code of this file.

Macros

#define USE_RX_CC2500
 
#define delayMicroseconds(us)   cc2500_delayMicroseconds(us)
 
#define NOP   0xFF
 

Functions

void cc2500_init (void)
 
static void cc2500_delayMicroseconds (uint32_t us)
 
static void rxSpiReadCommandMulti (uint8_t command, uint8_t commandData, uint8_t *retData, uint8_t length)
 
static uint8_t rxSpiReadCommand (uint8_t command, uint8_t commandData)
 
static void rxSpiWriteCommandMulti (uint8_t command, uint8_t *data, uint8_t length)
 
static void rxSpiWriteCommand (uint8_t command, uint8_t data)
 
static void rxSpiWriteByte (uint8_t data)
 
void cc2500ReadFifo (uint8_t *dpbuffer, uint8_t len)
 
void cc2500WriteFifo (uint8_t *dpbuffer, uint8_t len)
 
void cc2500ReadRegisterMulti (uint8_t address, uint8_t *data, uint8_t length)
 
void cc2500WriteRegisterMulti (uint8_t address, uint8_t *data, uint8_t length)
 
uint8_t cc2500ReadReg (uint8_t reg)
 
void cc2500Strobe (uint8_t address)
 
void cc2500WriteReg (uint8_t address, uint8_t data)
 
void cc2500SetPower (uint8_t power)
 
uint8_t cc2500Reset (void)
 

Variables

static struct spi_periphcc2500_spi_p
 
static struct spi_transaction cc2500_spi_t
 
static uint8_t cc2500_input_buf [64]
 
static uint8_t cc2500_output_buf [64]
 

Macro Definition Documentation

◆ delayMicroseconds

#define delayMicroseconds (   us)    cc2500_delayMicroseconds(us)

Definition at line 70 of file cc2500.c.

◆ NOP

#define NOP   0xFF

Definition at line 172 of file cc2500.c.

◆ USE_RX_CC2500

#define USE_RX_CC2500

Definition at line 35 of file cc2500.c.

Function Documentation

◆ cc2500_delayMicroseconds()

static void cc2500_delayMicroseconds ( uint32_t  us)
static

Definition at line 62 of file cc2500.c.

References get_sys_time_float().

+ Here is the call graph for this function:

◆ cc2500_init()

◆ cc2500ReadFifo()

void cc2500ReadFifo ( uint8_t dpbuffer,
uint8_t  len 
)

Definition at line 174 of file cc2500.c.

References CC2500_3F_RXFIFO, CC2500_READ_BURST, NOP, and rxSpiReadCommandMulti().

Referenced by frSkyXHandlePacket(), getBind1(), getBind2(), and tuneRx().

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

◆ cc2500ReadReg()

uint8_t cc2500ReadReg ( uint8_t  reg)

Definition at line 199 of file cc2500.c.

References NOP, and rxSpiReadCommand().

Referenced by cc2500Reset(), cc2500SpiDetect(), frSkyXHandlePacket(), getBind1(), getBind2(), initialise(), and tuneRx().

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

◆ cc2500ReadRegisterMulti()

void cc2500ReadRegisterMulti ( uint8_t  address,
uint8_t data,
uint8_t  length 
)

Definition at line 188 of file cc2500.c.

References NOP, and rxSpiReadCommandMulti().

+ Here is the call graph for this function:

◆ cc2500Reset()

uint8_t cc2500Reset ( void  )

Definition at line 228 of file cc2500.c.

References CC2500_0E_FREQ1, CC2500_SRES, cc2500ReadReg(), cc2500Strobe(), and delayMicroseconds.

Referenced by initialise(), and radio_control_cc2500_init().

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

◆ cc2500SetPower()

void cc2500SetPower ( uint8_t  power)

Definition at line 211 of file cc2500.c.

References CC2500_3E_PATABLE, and cc2500WriteReg().

Referenced by frSkyXHandlePacket().

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

◆ cc2500Strobe()

void cc2500Strobe ( uint8_t  address)

Definition at line 204 of file cc2500.c.

References rxSpiWriteByte().

Referenced by cc2500Reset(), cc2500WriteFifo(), frSkySpiDataReceived(), frSkyXHandlePacket(), initGetBind(), initialise(), initTuneRx(), and nextChannel().

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

◆ cc2500WriteFifo()

void cc2500WriteFifo ( uint8_t dpbuffer,
uint8_t  len 
)

Definition at line 180 of file cc2500.c.

References CC2500_3F_TXFIFO, CC2500_SFTX, CC2500_STX, CC2500_WRITE_BURST, cc2500Strobe(), and rxSpiWriteCommandMulti().

Referenced by frSkyXHandlePacket().

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

◆ cc2500WriteReg()

void cc2500WriteReg ( uint8_t  address,
uint8_t  data 
)

Definition at line 206 of file cc2500.c.

References rxSpiWriteCommand().

Referenced by cc2500SetPower(), initGetBind(), initialise(), initialiseData(), initTuneRx(), nextChannel(), and tuneRx().

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

◆ cc2500WriteRegisterMulti()

void cc2500WriteRegisterMulti ( uint8_t  address,
uint8_t data,
uint8_t  length 
)

Definition at line 193 of file cc2500.c.

References rxSpiWriteCommandMulti().

+ Here is the call graph for this function:

◆ rxSpiReadCommand()

static uint8_t rxSpiReadCommand ( uint8_t  command,
uint8_t  commandData 
)
static

Definition at line 92 of file cc2500.c.

References rxSpiReadCommandMulti().

Referenced by cc2500ReadReg().

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

◆ rxSpiReadCommandMulti()

static void rxSpiReadCommandMulti ( uint8_t  command,
uint8_t  commandData,
uint8_t retData,
uint8_t  length 
)
static

◆ rxSpiWriteByte()

static void rxSpiWriteByte ( uint8_t  data)
static

Definition at line 121 of file cc2500.c.

References rxSpiWriteCommandMulti().

Referenced by cc2500Strobe().

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

◆ rxSpiWriteCommand()

static void rxSpiWriteCommand ( uint8_t  command,
uint8_t  data 
)
static

Definition at line 117 of file cc2500.c.

References rxSpiWriteCommandMulti().

Referenced by cc2500WriteReg().

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

◆ rxSpiWriteCommandMulti()

static void rxSpiWriteCommandMulti ( uint8_t  command,
uint8_t data,
uint8_t  length 
)
static

Definition at line 99 of file cc2500.c.

References cc2500_spi_p, cc2500_spi_t, spi_transaction::input_length, spi_transaction::output_buf, spi_transaction::output_length, spi_submit(), SPITransDone, SPITransSuccess, and spi_transaction::status.

Referenced by cc2500WriteFifo(), cc2500WriteRegisterMulti(), rxSpiWriteByte(), and rxSpiWriteCommand().

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

Variable Documentation

◆ cc2500_input_buf

uint8_t cc2500_input_buf[64]
static

Definition at line 39 of file cc2500.c.

Referenced by cc2500_init().

◆ cc2500_output_buf

uint8_t cc2500_output_buf[64]
static

Definition at line 40 of file cc2500.c.

Referenced by cc2500_init().

◆ cc2500_spi_p

struct spi_periph* cc2500_spi_p
static

Definition at line 37 of file cc2500.c.

Referenced by cc2500_init(), rxSpiReadCommandMulti(), and rxSpiWriteCommandMulti().

◆ cc2500_spi_t

struct spi_transaction cc2500_spi_t
static

Definition at line 37 of file cc2500.c.

Referenced by cc2500_init(), rxSpiReadCommandMulti(), and rxSpiWriteCommandMulti().