-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Tested]: Fport Rc decoding supported
- Loading branch information
Witty-Wizard
committed
Jul 1, 2024
1 parent
8e95961
commit 856b7ab
Showing
10 changed files
with
208 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/*! | ||
* @file fport_protocol.h | ||
* @brief Header file for the F.Port protocol implementation. | ||
*/ | ||
#pragma once | ||
|
||
#ifndef FPORT_PROTOCOL_H | ||
#define FPORT_PROTOCOL_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
#define PACKED __attribute__((packed)) | ||
#define FPORT_BAUDRATE 115200 ///< F.Port baudrate | ||
#define FPORT_MAX_PACKET_SIZE 29 ///< F.Port maximum packet length | ||
#define FPORT_END_BYTES 0x7E | ||
|
||
typedef enum { | ||
FPORT_FRAMETYPE_RC_CHANNELS_PACKED = 0x00, | ||
FPORT_FRAMETYPE_DOWNLINK = 0x01, | ||
FPORT_FRAMETYPE_UPLINK = 0x81, | ||
} fport_frame_type_e; | ||
|
||
typedef struct fport_channels_s { | ||
unsigned channel1 : 11; | ||
unsigned channel2 : 11; | ||
unsigned channel3 : 11; | ||
unsigned channel4 : 11; | ||
unsigned channel5 : 11; | ||
unsigned channel6 : 11; | ||
unsigned channel7 : 11; | ||
unsigned channel8 : 11; | ||
unsigned channel9 : 11; | ||
unsigned channel10 : 11; | ||
unsigned channel11 : 11; | ||
unsigned channel12 : 11; | ||
unsigned channel13 : 11; | ||
unsigned channel14 : 11; | ||
unsigned channel15 : 11; | ||
unsigned channel16 : 11; | ||
unsigned dummy : 4; | ||
unsigned failsafe : 1; | ||
unsigned framelost : 1; | ||
unsigned channel17 : 1; | ||
unsigned channel18 : 1; | ||
} PACKED fport_channels_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/*! | ||
* @file ibus_protocol.h | ||
* @brief Header file for the iBus protocol implementation. | ||
*/ | ||
#pragma once | ||
|
||
#ifndef IBUS_PROTOCOL_H | ||
#define IBUS_PROTOCOL_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
#define PACKED __attribute__((packed)) | ||
#define IBUS_MAX_PACKET_SIZE 32 ///< Maximum packet size for the IBUS protocol | ||
#define IBUS_BAUDRATE 115200 ///< Baud rate for IBUS communication | ||
#define IBUS_HEADER1 0x20 | ||
#define IBUS_HEADER2 0x40 | ||
|
||
typedef struct ibus_channels_s { | ||
unsigned header : 16; | ||
unsigned channel1 : 16; | ||
unsigned channel2 : 16; | ||
unsigned channel3 : 16; | ||
unsigned channel4 : 16; | ||
unsigned channel5 : 16; | ||
unsigned channel6 : 16; | ||
unsigned channel7 : 16; | ||
unsigned channel8 : 16; | ||
unsigned channel9 : 16; | ||
unsigned channel10 : 16; | ||
unsigned channel11 : 16; | ||
unsigned channel12 : 16; | ||
unsigned channel13 : 16; | ||
unsigned channel14 : 16; | ||
unsigned checksum : 16; | ||
} PACKED ibus_channels_t; | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/*! | ||
* @file sbus_protocol.h | ||
* @brief Header file for the SBus protocol implementation. | ||
*/ | ||
#pragma once | ||
|
||
#ifndef SBUS_PROTOCOL_H | ||
#define SBUS_PROTOCOL_H | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stdint.h> | ||
|
||
#define PACKED __attribute__((packed)) | ||
#define HEADER_SBUS 0x0F ///< SBus Header Byte | ||
#define FOOTER_SBUS 0x00 ///< SBus Footer Byte | ||
#define SBUS_BAUDRATE 100000 ///< SBus baudrate | ||
#define SBUS_MAX_PACKET_SIZE 25 ///< SBus packet length | ||
|
||
typedef struct sbus_channels_s { | ||
unsigned header : 8; | ||
unsigned channel1 : 11; | ||
unsigned channel2 : 11; | ||
unsigned channel3 : 11; | ||
unsigned channel4 : 11; | ||
unsigned channel5 : 11; | ||
unsigned channel6 : 11; | ||
unsigned channel7 : 11; | ||
unsigned channel8 : 11; | ||
unsigned channel9 : 11; | ||
unsigned channel10 : 11; | ||
unsigned channel11 : 11; | ||
unsigned channel12 : 11; | ||
unsigned channel13 : 11; | ||
unsigned channel14 : 11; | ||
unsigned channel15 : 11; | ||
unsigned channel16 : 11; | ||
unsigned dummy : 4; | ||
unsigned failsafe : 1; | ||
unsigned framelost : 1; | ||
unsigned channel17 : 1; | ||
unsigned channel18 : 1; | ||
unsigned footer : 8; | ||
} PACKED sbus_channels_t; | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif |