Paparazzi UAS  v5.15_devel-230-gc96ce27
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cyrf6936.c File Reference

Driver for the cyrf6936 2.4GHz radio chip. More...

#include "cyrf6936.h"
#include "mcu_periph/spi.h"
#include "mcu_periph/gpio.h"
#include "mcu_periph/sys_time.h"
#include "subsystems/radio_control.h"
#include "mcu_periph/uart.h"
#include "pprzlink/messages.h"
#include "subsystems/datalink/downlink.h"
+ Include dependency graph for cyrf6936.c:

Go to the source code of this file.

Functions

static bool cyrf6936_write_register (struct Cyrf6936 *cyrf, const uint8_t addr, const uint8_t data)
 Write a byte to a register. More...
 
static bool cyrf6936_write_block (struct Cyrf6936 *cyrf, const uint8_t addr, const uint8_t data[], const uint8_t length)
 Write multiple bytes to a register. More...
 
static bool cyrf6936_read_register (struct Cyrf6936 *cyrf, const uint8_t addr)
 Read a byte from a register. More...
 
static bool cyrf6936_read_block (struct Cyrf6936 *cyrf, const uint8_t addr, const uint8_t length)
 Read multiple bytes from a register. More...
 
void cyrf6936_init (struct Cyrf6936 *cyrf, struct spi_periph *spi_p, const uint8_t slave_idx, const uint32_t rst_port, const uint16_t rst_pin)
 Initializing the cyrf chip. More...
 
void cyrf6936_event (struct Cyrf6936 *cyrf)
 The on event call for the CYRF6936 chip. More...
 
bool cyrf6936_write (struct Cyrf6936 *cyrf, const uint8_t addr, const uint8_t data)
 Write to one register. More...
 
bool cyrf6936_multi_write (struct Cyrf6936 *cyrf, const uint8_t data[][2], const uint8_t length)
 Write to multiple registers one byte. More...
 
bool cyrf6936_write_chan_sop_data_crc (struct Cyrf6936 *cyrf, const uint8_t chan, const uint8_t sop_code[], const uint8_t data_code[], const uint16_t crc_seed)
 Set the channel, SOP code, DATA code and the CRC seed. More...
 
bool cyrf6936_read_rx_irq_status_packet (struct Cyrf6936 *cyrf)
 Read the RX IRQ status register, the rx status register and the rx packet. More...
 
bool cyrf6936_send (struct Cyrf6936 *cyrf, const uint8_t data[], const uint8_t length)
 Send a packet with a certain length. More...
 

Detailed Description

Driver for the cyrf6936 2.4GHz radio chip.

Definition in file cyrf6936.c.

Function Documentation

bool cyrf6936_multi_write ( struct Cyrf6936 cyrf,
const uint8_t  data[][2],
const uint8_t  length 
)

Write to multiple registers one byte.

Definition at line 341 of file cyrf6936.c.

References Cyrf6936::buffer, Cyrf6936::buffer_idx, Cyrf6936::buffer_length, CYRF6936_IDLE, CYRF6936_MULTIWRITE, cyrf6936_write_register(), and Cyrf6936::status.

Referenced by cyrf6936_write(), superbitrf_event(), and superbitrf_receive_packet_cb().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cyrf6936_read_block ( struct Cyrf6936 cyrf,
const uint8_t  addr,
const uint8_t  length 
)
static

Read multiple bytes from a register.

Definition at line 312 of file cyrf6936.c.

References spi_transaction::input_length, Cyrf6936::output_buf, spi_transaction::output_length, Cyrf6936::spi_p, spi_submit(), Cyrf6936::spi_t, SPITransDone, and spi_transaction::status.

Referenced by cyrf6936_event(), and cyrf6936_read_register().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cyrf6936_read_register ( struct Cyrf6936 cyrf,
const uint8_t  addr 
)
static

Read a byte from a register.

Definition at line 304 of file cyrf6936.c.

References cyrf6936_read_block().

Referenced by cyrf6936_event(), and cyrf6936_read_rx_irq_status_packet().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool cyrf6936_read_rx_irq_status_packet ( struct Cyrf6936 cyrf)

Read the RX IRQ status register, the rx status register and the rx packet.

Definition at line 412 of file cyrf6936.c.

References Cyrf6936::buffer_idx, CYRF6936_IDLE, cyrf6936_read_register(), CYRF6936_RX_IRQ_STATUS_PACKET, CYRF_RX_IRQ_STATUS, and Cyrf6936::status.

Referenced by superbitrf_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool cyrf6936_send ( struct Cyrf6936 cyrf,
const uint8_t  data[],
const uint8_t  length 
)

Send a packet with a certain length.

Definition at line 432 of file cyrf6936.c.

References Cyrf6936::buffer, Cyrf6936::buffer_idx, CYRF6936_IDLE, CYRF6936_SEND, cyrf6936_write_register(), CYRF_TX_LENGTH, and Cyrf6936::status.

Referenced by superbitrf_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool cyrf6936_write ( struct Cyrf6936 cyrf,
const uint8_t  addr,
const uint8_t  data 
)

Write to one register.

Definition at line 330 of file cyrf6936.c.

References cyrf6936_multi_write().

Referenced by superbitrf_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cyrf6936_write_block ( struct Cyrf6936 cyrf,
const uint8_t  addr,
const uint8_t  data[],
const uint8_t  length 
)
static

Write multiple bytes to a register.

Definition at line 278 of file cyrf6936.c.

References CYRF_DIR, spi_transaction::input_length, Cyrf6936::output_buf, spi_transaction::output_length, Cyrf6936::spi_p, spi_submit(), Cyrf6936::spi_t, SPITransDone, and spi_transaction::status.

Referenced by cyrf6936_event(), and cyrf6936_write_register().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool cyrf6936_write_chan_sop_data_crc ( struct Cyrf6936 cyrf,
const uint8_t  chan,
const uint8_t  sop_code[],
const uint8_t  data_code[],
const uint16_t  crc_seed 
)

Set the channel, SOP code, DATA code and the CRC seed.

Definition at line 373 of file cyrf6936.c.

References Cyrf6936::buffer, Cyrf6936::buffer_idx, CYRF6936_CHAN_SOP_DATA_CRC, CYRF6936_IDLE, cyrf6936_write_register(), CYRF_CRC_SEED_LSB, and Cyrf6936::status.

Referenced by superbitrf_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static bool cyrf6936_write_register ( struct Cyrf6936 cyrf,
const uint8_t  addr,
const uint8_t  data 
)
static

Write a byte to a register.

Definition at line 270 of file cyrf6936.c.

References cyrf6936_write_block().

Referenced by cyrf6936_event(), cyrf6936_init(), cyrf6936_multi_write(), cyrf6936_send(), and cyrf6936_write_chan_sop_data_crc().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: