Paparazzi UAS
v6.1.0_stable
Paparazzi is a free software Unmanned Aircraft System.
syslink.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2019 Gautier Hattenberger <gautier.hattenberger@enac.fr>
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, see
18
* <http://www.gnu.org/licenses/>.
19
*/
20
29
#ifndef SYSLINK_H
30
#define SYSLINK_H
31
32
#include <stdint.h>
33
#include <stdbool.h>
34
35
#define SYSLINK_GROUP 0xF0
36
37
#define SYSLINK_RADIO 0x00
38
#define SYSLINK_RADIO_RAW 0x00
39
#define SYSLINK_RADIO_CHANNEL 0x01
40
#define SYSLINK_RADIO_DATARATE 0x02
41
#define SYSLINK_RADIO_CONTWAVE 0x03
42
#define SYSLINK_RADIO_RSSI 0x04
43
#define SYSLINK_RADIO_ADDRESS 0x05
44
45
#define SYSLINK_PM 0x10
46
#define SYSLINK_PM_SOURCE 0x10
47
#define SYSLINK_PM_ONOFF_SWITCHOFF 0x11
48
#define SYSLINK_PM_BATTERY_VOLTAGE 0x12
49
#define SYSLINK_PM_BATTERY_STATE 0x13
50
#define SYSLINK_PM_BATTERY_AUTOUPDATE 0x14
51
52
#define SYSLINK_OW 0x20
53
#define SYSLINK_OW_SCAN 0x20
54
#define SYSLINK_OW_GETINFO 0x21
55
#define SYSLINK_OW_READ 0x22
56
#define SYSLINK_OW_WRITE 0x23
57
58
// Limited by the CRTP packet which is limited by the ESB protocol used by the NRF
59
#define SYSLINK_MAX_DATA_LEN 32
60
61
#define SYSLINK_RADIO_RATE_250K 0
62
#define SYSLINK_RADIO_RATE_1M 1
63
#define SYSLINK_RADIO_RATE_2M 2
64
65
66
typedef
struct
{
67
uint8_t
type
;
68
uint8_t
length
;
69
uint8_t
data[
SYSLINK_MAX_DATA_LEN
];
70
uint8_t
cksum[2];
71
} __attribute__((packed))
syslink_message_t
;
72
73
74
typedef
enum
{
75
SYSLINK_STATE_START
= 0,
76
SYSLINK_STATE_TYPE
,
77
SYSLINK_STATE_LENGTH
,
78
SYSLINK_STATE_DATA
,
79
SYSLINK_STATE_CKSUM
80
}
syslink_state_t
;
81
82
typedef
struct
{
83
syslink_state_t
state
;
84
int
index
;
85
}
syslink_parse_state
;
86
87
extern
const
char
*
syslink_stx
;
88
89
#ifdef __cplusplus
90
extern
"C"
{
91
#endif
92
97
extern
void
syslink_parse_init
(
syslink_parse_state
*
state
);
98
106
extern
bool
syslink_parse_char
(
syslink_parse_state
*
state
,
uint8_t
c,
syslink_message_t
*
msg
);
107
112
extern
void
syslink_compute_cksum
(
syslink_message_t
*
msg
);
113
114
#ifdef __cplusplus
115
}
116
#endif
117
118
#endif
119
syslink_state_t
syslink_state_t
Definition:
syslink.h:74
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition:
vl53l1_types.h:98
SYSLINK_MAX_DATA_LEN
#define SYSLINK_MAX_DATA_LEN
Definition:
syslink.h:59
SYSLINK_STATE_CKSUM
@ SYSLINK_STATE_CKSUM
Definition:
syslink.h:79
syslink_message_t::type
uint8_t type
Definition:
syslink.h:67
syslink_parse_state::state
syslink_state_t state
Definition:
syslink.h:83
syslink_parse_init
void syslink_parse_init(syslink_parse_state *state)
Init syslink parser.
Definition:
syslink.c:33
syslink_parse_state::index
int index
Definition:
syslink.h:84
msg
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
Definition:
high_speed_logger_direct_memory.c:134
SYSLINK_STATE_LENGTH
@ SYSLINK_STATE_LENGTH
Definition:
syslink.h:77
SYSLINK_STATE_DATA
@ SYSLINK_STATE_DATA
Definition:
syslink.h:78
syslink_message_t
Definition:
syslink.h:66
syslink_parse_state
Definition:
syslink.h:82
syslink_parse_char
bool syslink_parse_char(syslink_parse_state *state, uint8_t c, syslink_message_t *msg)
Parse one byte.
Definition:
syslink.c:39
syslink_stx
const char * syslink_stx
Definition:
syslink.c:31
syslink_compute_cksum
void syslink_compute_cksum(syslink_message_t *msg)
Compute syslink checksum.
Definition:
syslink.c:112
SYSLINK_STATE_START
@ SYSLINK_STATE_START
Definition:
syslink.h:75
state
struct State state
Definition:
state.c:36
syslink_message_t::length
uint8_t length
Definition:
syslink.h:68
SYSLINK_STATE_TYPE
@ SYSLINK_STATE_TYPE
Definition:
syslink.h:76
sw
airborne
modules
datalink
bitcraze
syslink.h
Generated on Tue Feb 1 2022 13:08:44 for Paparazzi UAS by
1.8.17