2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
5 * @addtogroup OpenPilotLibraries OpenPilot System Libraries
8 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
9 * @brief Private include file of the UAVTalk library
10 * @see The GNU Public License (GPL) Version 3
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef UAVTALK_PRIV_H
30 #define UAVTALK_PRIV_H
32 #include "uavobjectsinit.h"
34 // Private types and constants
36 // min header : sync(1), type (1), size(2), object ID(4), instance ID(2)
37 #define UAVTALK_MIN_HEADER_LENGTH 10
39 // max header : sync(1), type (1), size(2), object ID(4), instance ID(2), timestamp(2)
40 #define UAVTALK_MAX_HEADER_LENGTH 12
42 #define UAVTALK_CHECKSUM_LENGTH 1
44 #define UAVTALK_MAX_PAYLOAD_LENGTH (UAVOBJECTS_LARGEST + 1)
46 #define UAVTALK_MIN_PACKET_LENGTH UAVTALK_MAX_HEADER_LENGTH + UAVTALK_CHECKSUM_LENGTH
47 #define UAVTALK_MAX_PACKET_LENGTH UAVTALK_MIN_PACKET_LENGTH + UAVTALK_MAX_PAYLOAD_LENGTH
55 uint8_t timestampLength
;
60 uint16_t rxPacketLength
;
61 } UAVTalkInputProcessor
;
65 UAVTalkOutputStream outStream
;
66 xSemaphoreHandle lock
;
67 xSemaphoreHandle transLock
;
68 xSemaphoreHandle respSema
;
73 UAVTalkInputProcessor iproc
;
76 } UAVTalkConnectionData
;
78 #define UAVTALK_CANARI 0xCA
79 #define UAVTALK_SYNC_VAL 0x3C
81 #define UAVTALK_TYPE_MASK 0x78
82 #define UAVTALK_TYPE_VER 0x20
83 #define UAVTALK_TIMESTAMPED 0x80
84 #define UAVTALK_TYPE_OBJ (UAVTALK_TYPE_VER | 0x00)
85 #define UAVTALK_TYPE_OBJ_REQ (UAVTALK_TYPE_VER | 0x01)
86 #define UAVTALK_TYPE_OBJ_ACK (UAVTALK_TYPE_VER | 0x02)
87 #define UAVTALK_TYPE_ACK (UAVTALK_TYPE_VER | 0x03)
88 #define UAVTALK_TYPE_NACK (UAVTALK_TYPE_VER | 0x04)
89 #define UAVTALK_TYPE_OBJ_TS (UAVTALK_TIMESTAMPED | UAVTALK_TYPE_OBJ)
90 #define UAVTALK_TYPE_OBJ_ACK_TS (UAVTALK_TIMESTAMPED | UAVTALK_TYPE_OBJ_ACK)
93 #define CHECKCONHANDLE(handle, variable, failcommand) \
94 variable = (UAVTalkConnectionData *)handle; \
95 if (variable == NULL || variable->canari != UAVTALK_CANARI) { \
99 #endif // UAVTALK__PRIV_H