Paparazzi UAS  v5.18.0_stable
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
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);
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
smartPortCheckQueueEmptyFn
bool smartPortCheckQueueEmptyFn(void)
Definition: cc2500_smartport.h:83
FSSP_START_STOP
@ FSSP_START_STOP
Definition: cc2500_smartport.h:57
uint16_t
unsigned short uint16_t
Definition: types.h:16
smartPortDataReceive
smartPortPayload_t * smartPortDataReceive(uint16_t c, bool *clearToSend, smartPortCheckQueueEmptyFn *checkQueueEmpty, bool withChecksum)
Definition: cc2500_smartport.c:238
smartPortPayload_s
Definition: cc2500_smartport.h:76
smartPortDownlinkFn
bool smartPortDownlinkFn(uint32_t *data)
Definition: cc2500_smartport.h:8
FSSP_SENSOR_ID2
@ FSSP_SENSOR_ID2
Definition: cc2500_smartport.h:69
processSmartPortTelemetry
void processSmartPortTelemetry(smartPortPayload_t *payload, volatile bool *hasRequest, const uint32_t *requestTimeout)
Definition: cc2500_smartport.c:533
uint32_t
unsigned long uint32_t
Definition: types.h:18
FSSP_MSPC_FRAME_SMARTPORT
@ FSSP_MSPC_FRAME_SMARTPORT
Definition: cc2500_smartport.h:63
smartPortDownlink
smartPortDownlinkFn * smartPortDownlink
Definition: cc2500_smartport.c:22
FSSP_MSPC_FRAME_FPORT
@ FSSP_MSPC_FRAME_FPORT
Definition: cc2500_smartport.h:64
FSSP_SENSOR_ID1
@ FSSP_SENSOR_ID1
Definition: cc2500_smartport.h:68
uint8_t
unsigned char uint8_t
Definition: types.h:14
smartPortUplink
smartPortUplinkFn * smartPortUplink
Definition: cc2500_smartport.c:23
smartPortPayload_s::data
uint32_t data
Definition: cc2500_smartport.h:79
smartPortPayload_s::valueId
uint16_t valueId
Definition: cc2500_smartport.h:78
smartPortPayload_s::frameId
uint8_t frameId
Definition: cc2500_smartport.h:77
FSSP_SENSOR_ID3
@ FSSP_SENSOR_ID3
Definition: cc2500_smartport.h:70
smartPortPayload_t
struct smartPortPayload_s smartPortPayload_t
FSSP_DATA_FRAME
@ FSSP_DATA_FRAME
Definition: cc2500_smartport.h:62
FSSP_DLE_XOR
@ FSSP_DLE_XOR
Definition: cc2500_smartport.h:60
FSSP_MSPS_FRAME
@ FSSP_MSPS_FRAME
Definition: cc2500_smartport.h:65
FSSP_DLE
@ FSSP_DLE
Definition: cc2500_smartport.h:59
smartPortWriteFrameFn
void smartPortWriteFrameFn(const smartPortPayload_t *payload)
Definition: cc2500_smartport.h:82
FSSP_SENSOR_ID4
@ FSSP_SENSOR_ID4
Definition: cc2500_smartport.h:71
smartPortUplinkFn
void smartPortUplinkFn(struct smartPortPayload_s *payload)
Definition: cc2500_smartport.h:15
cc2500_compat.h
initSmartPortTelemetryExternal
bool initSmartPortTelemetryExternal(smartPortWriteFrameFn *smartPortWriteFrameExternal)
Definition: cc2500_smartport.c:480