27 #ifndef DATALINK_SUPERBITRF_H
28 #define DATALINK_SUPERBITRF_H
32 #include "pprzlink/pprzlink_device.h"
33 #include "pprzlink/pprz_transport.h"
37 #define SUPERBITRF_BIND_RECV_TIME 10000
38 #define SUPERBITRF_SYNC_RECV_TIME 7000
39 #define SUPERBITRF_RECV_TIME 20000
40 #define SUPERBITRF_RECV_SHORT_TIME 6000
41 #define SUPERBITRF_DATARECV_TIME 10000
42 #define SUPERBITRF_DATARECVB_TIME 6000
70 #define IS_DSM2(x) (x == DSM_DSM2P || x == DSM_DSM2_1 || x == DSM_DSM2_2)
71 #define IS_DSMX(x) (!IS_DSM2(x))
73 #define SUPERBITRF_TX_BUFFER_SIZE 128
118 struct link_device
device;
@ DSM_DSMXP
Our own DSMX Paparazzi protocol.
@ DSM_DSMX_2
The original DSMX protocol with 2 packets of data.
@ DSM_DSM2_2
The original DSM2 protocol with 2 packets of data.
@ DSM_DSM2_1
The original DSM2 protocol with 1 packet of data.
@ DSM_DSMX_1
The original DSMX protocol with 1 packet of data.
@ DSM_DSM2P
Our own DSM2 Paparazzi protocol.
struct SuperbitRF superbitrf
void superbitrf_set_protocol(uint8_t protocol)
void superbitrf_set_mfg_id(uint32_t id)
Driver for the cyrf6936 2.4GHz radio chip.
Handling of messages coming from ground and other A/Cs.
Some architecture independent helper functions for GPIOs.
uint32_t bind_mfg_id32
The MFG id where the receiver is bound to in uint32.
void superbitrf_dl_event(void)
The superbitrf datalink event call.
uint32_t uplink_count
How many valid uplink packages are received.
uint8_t channels[23]
The channels used for DSM2/DSMX.
uint8_t timeouts
The amount of timeouts.
bool packet_loss
When we have packet loss last packet.
uint32_t rc_count
How many valid RC packages are received.
uint32_t tx_packet_count
How many packets are send(also the invalid)
void superbitrf_event(void)
The superbitrf on event call.
uint8_t channel_idx
The current channel index.
bool timer_overflow
When the timer overflows.
#define SUPERBITRF_TX_BUFFER_SIZE
struct link_device device
Generic device interface.
uint8_t tx_extract_idx
The transmit buffer extract index.
void superbitrf_dl_init(void)
Initialize datalink part.
enum dsm_protocol protocol
The protocol the transmitter uses.
uint32_t resync_count
The amount of resyncs needed during transfer.
uint32_t timer
The timer in microseconds.
uint8_t data_col
The data code column number calculated with the bind MFG id.
uint32_t transfer_timeouts
The amount of timeouts during transfer.
void superbitrf_init(void)
Initialize the superbitrf.
uint8_t tx_buffer[SUPERBITRF_TX_BUFFER_SIZE]
The transmit buffer.
enum SuperbitRFStatus status
The status of the superbitRF.
struct pprz_transport pprz_srf_tp
uint8_t packet_loss_bit
The packet loss indicating bit.
@ SUPERBITRF_10_BIT_RESOLUTION
The transmitter has a 10 bit resolution.
@ SUPERBITRF_11_BIT_RESOLUTION
The transmitter has a 11 bit resolution.
uint16_t crc_seed
The CRC seed that is calculated with the bind MFG id.
uint8_t bind_mfg_id[4]
The MFG id where the receiver is bound to.
enum dsm_resolution resolution
The resolution that the transmitter has.
uint8_t state
The states each status can be in.
uint32_t irq_count
How many interrupts are made.
uint8_t channel
The current channel number.
uint32_t timing2
Time between second last receive in microseconds.
uint8_t num_channels
The number of channels the transmitter has.
uint32_t rx_packet_count
How many packets are received(also the invalid)
struct pprz_transport rx_transport
The receive transport.
uint32_t timing1
Time between last receive in microseconds.
uint8_t sop_col
The sop code column number calculated with the bind MFG id.
struct Cyrf6936 cyrf6936
The cyrf chip used.
uint8_t tx_insert_idx
The transmit buffer insert index.
bool rc_frame_available
When a RC frame is available.
int16_t rc_values[14]
The rc values from the packet.
@ SUPERBITRF_BINDING
The chip is in binding mode.
@ SUPERBITRF_SYNCING_A
The chip is in synchronizing mode for channel A.
@ SUPERBITRF_TRANSFER
The chip is in transfer mode.
@ SUPERBITRF_UNINIT
The chip isn't initialized.
@ SUPERBITRF_INIT_BINDING
The chip is initializing binding mode.
@ SUPERBITRF_INIT_TRANSFER
The chip is initializing transfer mode.
@ SUPERBITRF_SYNCING_B
The chip is in synchronizing mode for channel B.
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
short int16_t
Typedef defining 16 bit short type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.