Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the cyrf6936 2.4GHz radio chip. More...
Go to the source code of this file.
Data Structures | |
struct | Cyrf6936 |
Macros | |
#define | CYRF6936_MAX_BUFFER 80 |
The max buffer size in the cyrf6936 structure. More... | |
Enumerations | |
enum | Cyrf6936Status { CYRF6936_UNINIT , CYRF6936_IDLE , CYRF6936_GET_MFG_ID , CYRF6936_MULTIWRITE , CYRF6936_DATA_CODE , CYRF6936_CHAN_SOP_DATA_CRC , CYRF6936_RX_IRQ_STATUS_PACKET , CYRF6936_SEND } |
Functions | |
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... | |
Driver for the cyrf6936 2.4GHz radio chip.
Definition in file cyrf6936.h.
struct Cyrf6936 |
Definition at line 48 of file cyrf6936.h.
Data Fields | ||
---|---|---|
uint8_t | buffer[CYRF6936_MAX_BUFFER] | The buffer used to write/read multiple registers. |
uint8_t | buffer_idx | The index of the buffer used for MULTIWRITE and used as sub-status for other statuses. |
uint8_t | buffer_length | The length of the buffer used for MULTIWRITE. |
bool | has_irq | When the CYRF6936 is done reading the irq. |
uint8_t | input_buf[17] | The input buffer for the SPI transaction. |
uint8_t | mfg_id[6] | The manufacturer id of the CYRF6936 chip. |
uint8_t | output_buf[17] | The output buffer for the SPI transaction. |
uint8_t | rx_count | The length of the received packet. |
uint8_t | rx_irq_status | The last receive interrupt status. |
uint8_t | rx_packet[16] | The last received packet. |
uint8_t | rx_status | The last receive status. |
struct spi_periph * | spi_p | The SPI peripheral for the connection. |
struct spi_transaction | spi_t | The SPI transaction used for the writing and reading of registers. |
enum Cyrf6936Status | status | The status of the CYRF6936 chip. |
uint8_t | tx_irq_status | The last send interrupt status. |
#define CYRF6936_MAX_BUFFER 80 |
The max buffer size in the cyrf6936 structure.
Definition at line 33 of file cyrf6936.h.
enum Cyrf6936Status |
Definition at line 36 of file cyrf6936.h.
void cyrf6936_event | ( | struct Cyrf6936 * | cyrf | ) |
The on event call for the CYRF6936 chip.
Definition at line 86 of file cyrf6936.c.
References Cyrf6936::buffer, Cyrf6936::buffer_idx, Cyrf6936::buffer_length, CYRF6936_CHAN_SOP_DATA_CRC, CYRF6936_DATA_CODE, CYRF6936_GET_MFG_ID, CYRF6936_IDLE, CYRF6936_MULTIWRITE, cyrf6936_read_block(), cyrf6936_read_register(), CYRF6936_RX_IRQ_STATUS_PACKET, CYRF6936_SEND, CYRF6936_UNINIT, cyrf6936_write_block(), cyrf6936_write_register(), CYRF_CHANNEL, CYRF_CRC_SEED_LSB, CYRF_CRC_SEED_MSB, CYRF_DATA_CODE, CYRF_MFG_ID, CYRF_RX_BUFFER, CYRF_RX_COUNT, CYRF_RX_IRQ_STATUS, CYRF_RX_STATUS, CYRF_SOP_CODE, CYRF_TX_BUFFER, CYRF_TX_CLR, CYRF_TX_CTRL, CYRF_TX_GO, CYRF_TX_IRQ_STATUS, CYRF_TX_LENGTH, CYRF_TXC_IRQEN, CYRF_TXE_IRQEN, Cyrf6936::has_irq, Cyrf6936::input_buf, Cyrf6936::mfg_id, Cyrf6936::rx_count, Cyrf6936::rx_irq_status, Cyrf6936::rx_packet, Cyrf6936::rx_status, Cyrf6936::spi_t, SPITransDone, SPITransFailed, SPITransPending, SPITransRunning, spi_transaction::status, Cyrf6936::status, and Cyrf6936::tx_irq_status.
Referenced by superbitrf_rc_event().
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.
Definition at line 47 of file cyrf6936.c.
References spi_transaction::bitorder, Cyrf6936::buffer_idx, spi_transaction::cdiv, spi_transaction::cpha, spi_transaction::cpol, CYRF6936_GET_MFG_ID, CYRF6936_UNINIT, cyrf6936_write_register(), CYRF_MFG_ID, spi_transaction::dss, gpio_clear(), gpio_set(), gpio_setup_output(), Cyrf6936::has_irq, spi_transaction::input_buf, Cyrf6936::input_buf, spi_transaction::input_length, spi_transaction::output_buf, Cyrf6936::output_buf, spi_transaction::output_length, spi_transaction::select, spi_transaction::slave_idx, Cyrf6936::spi_p, Cyrf6936::spi_t, SPICphaEdge1, SPICpolIdleLow, SPIDiv64, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, SPITransDone, spi_transaction::status, Cyrf6936::status, and sys_time_usleep().
Referenced by superbitrf_init().
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().
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().
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().
Write to one register.
Definition at line 330 of file cyrf6936.c.
References cyrf6936_multi_write().
Referenced by superbitrf_event().
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().