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
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 {
70  uint8_t cksum[2];
71 } __attribute__((packed)) syslink_message_t;
72 
73 
74 typedef enum {
81 
82 typedef struct {
84  int index;
86 
87 extern const char *syslink_stx;
88 
89 #ifdef __cplusplus
90 extern "C" {
91 #endif
92 
98 
107 
112  extern void syslink_compute_cksum(syslink_message_t *msg);
113 
114 #ifdef __cplusplus
115 }
116 #endif
117 
118 #endif
119 
unsigned char uint8_t
Definition: types.h:14
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
struct State state
Definition: state.c:36