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
syslink.h File Reference

Syslink protocol for communication with bitcraze/crazyflie NRF mcu. More...

#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for syslink.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

Macros

#define SYSLINK_GROUP   0xF0
 
#define SYSLINK_RADIO   0x00
 
#define SYSLINK_RADIO_RAW   0x00
 
#define SYSLINK_RADIO_CHANNEL   0x01
 
#define SYSLINK_RADIO_DATARATE   0x02
 
#define SYSLINK_RADIO_CONTWAVE   0x03
 
#define SYSLINK_RADIO_RSSI   0x04
 
#define SYSLINK_RADIO_ADDRESS   0x05
 
#define SYSLINK_PM   0x10
 
#define SYSLINK_PM_SOURCE   0x10
 
#define SYSLINK_PM_ONOFF_SWITCHOFF   0x11
 
#define SYSLINK_PM_BATTERY_VOLTAGE   0x12
 
#define SYSLINK_PM_BATTERY_STATE   0x13
 
#define SYSLINK_PM_BATTERY_AUTOUPDATE   0x14
 
#define SYSLINK_OW   0x20
 
#define SYSLINK_OW_SCAN   0x20
 
#define SYSLINK_OW_GETINFO   0x21
 
#define SYSLINK_OW_READ   0x22
 
#define SYSLINK_OW_WRITE   0x23
 
#define SYSLINK_MAX_DATA_LEN   32
 
#define SYSLINK_RADIO_RATE_250K   0
 
#define SYSLINK_RADIO_RATE_1M   1
 
#define SYSLINK_RADIO_RATE_2M   2
 

Enumerations

enum  syslink_state_t {
  SYSLINK_STATE_START = 0, SYSLINK_STATE_TYPE, SYSLINK_STATE_LENGTH, SYSLINK_STATE_DATA,
  SYSLINK_STATE_CKSUM
}
 

Functions

void syslink_parse_init (syslink_parse_state *state)
 Init syslink parser. More...
 
bool syslink_parse_char (syslink_parse_state *state, uint8_t c, syslink_message_t *msg)
 Parse one byte. More...
 
void syslink_compute_cksum (syslink_message_t *msg)
 Compute syslink checksum. More...
 

Variables

const char * syslink_stx
 

Detailed Description

Syslink protocol for communication with bitcraze/crazyflie NRF mcu.

based on PX4 implementation

Definition in file syslink.h.


Data Structure Documentation

struct syslink_message_t

Definition at line 66 of file syslink.h.

Data Fields
uint8_t cksum[2]
uint8_t data[SYSLINK_MAX_DATA_LEN]
uint8_t length
uint8_t type
struct syslink_parse_state

Definition at line 82 of file syslink.h.

Data Fields
int index
syslink_state_t state

Macro Definition Documentation

#define SYSLINK_GROUP   0xF0

Definition at line 35 of file syslink.h.

Referenced by handle_new_msg().

#define SYSLINK_MAX_DATA_LEN   32

Definition at line 59 of file syslink.h.

Referenced by syslink_parse_char().

#define SYSLINK_OW   0x20

Definition at line 52 of file syslink.h.

Referenced by handle_new_msg().

#define SYSLINK_OW_GETINFO   0x21

Definition at line 54 of file syslink.h.

#define SYSLINK_OW_READ   0x22

Definition at line 55 of file syslink.h.

#define SYSLINK_OW_SCAN   0x20

Definition at line 53 of file syslink.h.

#define SYSLINK_OW_WRITE   0x23

Definition at line 56 of file syslink.h.

#define SYSLINK_PM   0x10

Definition at line 45 of file syslink.h.

#define SYSLINK_PM_BATTERY_AUTOUPDATE   0x14

Definition at line 50 of file syslink.h.

#define SYSLINK_PM_BATTERY_STATE   0x13

Definition at line 49 of file syslink.h.

Referenced by handle_new_msg().

#define SYSLINK_PM_BATTERY_VOLTAGE   0x12

Definition at line 48 of file syslink.h.

#define SYSLINK_PM_ONOFF_SWITCHOFF   0x11

Definition at line 47 of file syslink.h.

Referenced by handle_new_msg().

#define SYSLINK_PM_SOURCE   0x10

Definition at line 46 of file syslink.h.

#define SYSLINK_RADIO   0x00

Definition at line 37 of file syslink.h.

Referenced by handle_new_msg().

#define SYSLINK_RADIO_ADDRESS   0x05

Definition at line 43 of file syslink.h.

Referenced by handle_radio().

#define SYSLINK_RADIO_CHANNEL   0x01

Definition at line 39 of file syslink.h.

Referenced by handle_radio().

#define SYSLINK_RADIO_CONTWAVE   0x03

Definition at line 41 of file syslink.h.

#define SYSLINK_RADIO_DATARATE   0x02

Definition at line 40 of file syslink.h.

Referenced by handle_radio().

#define SYSLINK_RADIO_RATE_1M   1

Definition at line 62 of file syslink.h.

#define SYSLINK_RADIO_RATE_250K   0

Definition at line 61 of file syslink.h.

#define SYSLINK_RADIO_RATE_2M   2

Definition at line 63 of file syslink.h.

#define SYSLINK_RADIO_RAW   0x00

Definition at line 38 of file syslink.h.

Referenced by handle_new_msg(), and handle_raw().

#define SYSLINK_RADIO_RSSI   0x04

Definition at line 42 of file syslink.h.

Referenced by handle_radio().

Enumeration Type Documentation

Enumerator
SYSLINK_STATE_START 
SYSLINK_STATE_TYPE 
SYSLINK_STATE_LENGTH 
SYSLINK_STATE_DATA 
SYSLINK_STATE_CKSUM 

Definition at line 74 of file syslink.h.

Function Documentation

void syslink_compute_cksum ( syslink_message_t msg)

Compute syslink checksum.

Parameters
msgpointer to message structure

Definition at line 112 of file syslink.c.

References syslink_message_t::cksum, and syslink_message_t::length.

Referenced by send_message(), and syslink_parse_char().

+ Here is the caller graph for this function:

bool syslink_parse_char ( syslink_parse_state state,
uint8_t  c,
syslink_message_t msg 
)

Parse one byte.

Parameters
statepointer to state structure
cnext byte to parse
msgpointer to message structure
Returns
true if a full message was parsed

Definition at line 39 of file syslink.c.

References syslink_message_t::cksum, syslink_message_t::data, syslink_parse_state::index, syslink_message_t::length, syslink_parse_state::state, syslink_compute_cksum(), SYSLINK_MAX_DATA_LEN, SYSLINK_STATE_CKSUM, SYSLINK_STATE_DATA, SYSLINK_STATE_LENGTH, SYSLINK_STATE_START, SYSLINK_STATE_TYPE, syslink_stx, and syslink_message_t::type.

Referenced by syslink_dl_event().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void syslink_parse_init ( syslink_parse_state state)

Init syslink parser.

Parameters
statepointer to state structure

Definition at line 33 of file syslink.c.

References syslink_parse_state::index, syslink_parse_state::state, and SYSLINK_STATE_START.

Referenced by syslink_dl_init().

+ Here is the caller graph for this function:

Variable Documentation

const char* syslink_stx

Definition at line 31 of file syslink.c.

Referenced by send_message(), and syslink_parse_char().