Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
cc2500_smartport.h
Go to the documentation of this file.
1 #include "cc2500_compat.h"
2 
3 /* SmartPort downlink hook
4  * Called from smartport telemetry loop.
5  * Write telemetry stream to 'data'.
6  * Return 'true' if data is written.
7  */
8 typedef bool smartPortDownlinkFn(uint32_t *data);
10 
11 /* SmartPort uplink hook
12  * Called from processSmartPortTelemetry
13  */
14 struct smartPortPayload_s;
15 typedef void smartPortUplinkFn(struct smartPortPayload_s *payload);
17 
18 // CAUTION: LARGE PARTS OF THIS FILE ARE COMMENTED OUT!
19 // betaflight/src/main/telemetry/smartport.h @ 41492e1
20 /*
21  * This file is part of Cleanflight and Betaflight.
22  *
23  * Cleanflight and Betaflight are free software. You can redistribute
24  * this software and/or modify this software under the terms of the
25  * GNU General Public License as published by the Free Software
26  * Foundation, either version 3 of the License, or (at your option)
27  * any later version.
28  *
29  * Cleanflight and Betaflight are distributed in the hope that they
30  * will be useful, but WITHOUT ANY WARRANTY; without even the implied
31  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
32  * See the GNU General Public License for more details.
33  *
34  * You should have received a copy of the GNU General Public License
35  * along with this software.
36  *
37  * If not, see <http://www.gnu.org/licenses/>.
38  */
39 
40 /*
41  * smartport.h
42  *
43  * Created on: 25 October 2014
44  * Author: Frank26080115
45  */
46 
47 #pragma once
48 
49 #include <stdbool.h>
50 #include <stdint.h>
51 
52 //#define SMARTPORT_MSP_TX_BUF_SIZE 256
53 //#define SMARTPORT_MSP_RX_BUF_SIZE 64
54 
55 enum
56 {
58 
59  FSSP_DLE = 0x7D,
60  FSSP_DLE_XOR = 0x20,
61 
63  FSSP_MSPC_FRAME_SMARTPORT = 0x30, // MSP client frame
64  FSSP_MSPC_FRAME_FPORT = 0x31, // MSP client frame
65  FSSP_MSPS_FRAME = 0x32, // MSP server frame
66 
67  // ID of sensor. Must be something that is polled by FrSky RX
71  FSSP_SENSOR_ID4 = 0x67
72  // there are 32 ID's polled by smartport master
73  // remaining 3 bits are crc (according to comments in openTx code)
74 };
75 
76 typedef struct smartPortPayload_s {
80 } __attribute__((packed)) smartPortPayload_t;
81 
82 typedef void smartPortWriteFrameFn(const smartPortPayload_t *payload);
83 typedef bool smartPortCheckQueueEmptyFn(void);
84 
85 //bool initSmartPortTelemetry(void);
86 //void checkSmartPortTelemetryState(void);
87 bool initSmartPortTelemetryExternal(smartPortWriteFrameFn *smartPortWriteFrameExternal);
88 
89 //void handleSmartPortTelemetry(void);
90 void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *hasRequest, const uint32_t *requestTimeout);
91 
92 smartPortPayload_t *smartPortDataReceive(uint16_t c, bool *clearToSend, smartPortCheckQueueEmptyFn *checkQueueEmpty, bool withChecksum);
93 
94 //struct serialPort_s;
95 //void smartPortWriteFrameSerial(const smartPortPayload_t *payload, struct serialPort_s *port, uint16_t checksum);
96 //void smartPortSendByte(uint8_t c, uint16_t *checksum, struct serialPort_s *port);
97 //bool smartPortPayloadContainsMSP(const smartPortPayload_t *payload);
void smartPortWriteFrameFn(const smartPortPayload_t *payload)
bool initSmartPortTelemetryExternal(smartPortWriteFrameFn *smartPortWriteFrameExternal)
void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *hasRequest, const uint32_t *requestTimeout)
smartPortPayload_t * smartPortDataReceive(uint16_t c, bool *clearToSend, smartPortCheckQueueEmptyFn *checkQueueEmpty, bool withChecksum)
bool smartPortDownlinkFn(uint32_t *data)
smartPortUplinkFn * smartPortUplink
smartPortDownlinkFn * smartPortDownlink
@ FSSP_DLE_XOR
@ FSSP_SENSOR_ID1
@ FSSP_SENSOR_ID2
@ FSSP_MSPC_FRAME_FPORT
@ FSSP_MSPC_FRAME_SMARTPORT
@ FSSP_SENSOR_ID3
@ FSSP_SENSOR_ID4
@ FSSP_DLE
@ FSSP_DATA_FRAME
@ FSSP_START_STOP
@ FSSP_MSPS_FRAME
struct smartPortPayload_s smartPortPayload_t
void smartPortUplinkFn(struct smartPortPayload_s *payload)
bool smartPortCheckQueueEmptyFn(void)
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition: vl53l1_types.h:88
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
Definition: vl53l1_types.h:78
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition: vl53l1_types.h:98