Skip to content

Commit 517f408

Browse files
author
Witty-Wizard
committed
Added: some minute details that can go wrong
1 parent 9544863 commit 517f408

File tree

6 files changed

+125
-77
lines changed

6 files changed

+125
-77
lines changed

Docs/source/fport.rst

Lines changed: 0 additions & 38 deletions
This file was deleted.

Docs/source/index.rst

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,6 @@
22
sphinx-quickstart on Sat Mar 29 19:38:49 2025.
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
5-
.. toctree::
6-
:maxdepth: 2
7-
:caption: Contents:
8-
:hidden:
9-
10-
installation
11-
tutorial
12-
example
13-
contributing
14-
sbus
15-
fport
16-
apidocumentation
175
186
SerialIO
197
======================
@@ -22,20 +10,16 @@ SerialIO
2210

2311
SerialIO is a common library designed to simplify the implementation of RC protocol decoding in Arduino projects. It provides a modular and extensible architecture that allows for easy integration of various RC protocols.
2412

25-
Supported Protocols
26-
--------------------
27-
28-
- `Futaba SBus protocol <sbus.html>`_
29-
- `Crossfire RC protocol <https://github.com/crsf-wg/crsf/wiki>`_
30-
- `Flysky IBus protocol <https://basejunction.wordpress.com/2015/08/23/en-flysky-i6-14-channels-part1/>`_
31-
- `FrSky F.Port <fport.html>`_
32-
33-
Getting Started
34-
----------------
13+
.. toctree::
14+
:maxdepth: 1
15+
:caption: Contents:
3516

36-
- `Installation <installation.html>`_
37-
- `Tutorial <tutorial.html>`_
38-
- `Examples <example.html>`_
17+
supportedprotocols
18+
installation
19+
tutorial
20+
example
21+
contributing
22+
apidocumentation
3923

4024
License
4125
-------

Docs/source/installation.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ Installation
55

66
Arduino Installation
77
--------------------
8+
SerialIO is available on the Arduino library manager or,
89

9-
To use the SerialIO library in your Arduino projects, follow these installation steps:
10+
you can install it manually by downloading the library from the GitHub repository:
1011

1112
1. Download the SerialIO library from the `GitHub repository <https://github.com/Witty-Wizard/SerialIO>`_.
1213
2. Extract the downloaded ZIP file.
@@ -17,7 +18,7 @@ To use the SerialIO library in your Arduino projects, follow these installation
1718
PlatformIO Installation
1819
-----------------------
1920

20-
If you are using PlatformIO, you can install the SerialIO library directly from the PlatformIO Library Manager. Add the following line to your `platformio.ini` file:
21+
If you are using PlatformIO, you can install the SerialIO library directly from the PlatformIO Library Manager. Add the following line to your ``platformio.ini`` file:
2122

2223
.. code-block:: ini
2324
Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
Supported Protocols
2+
####################
3+
4+
- `Futaba SBus protocol <#futabasbus>`_
5+
- `Crossfire RC protocol <https://github.com/crsf-wg/crsf/wiki>`_
6+
- `Flysky IBus protocol <https://basejunction.wordpress.com/2015/08/23/en-flysky-i6-14-channels-part1/>`_
7+
- `FrSky F.Port <#frskyfport>`_
8+
19
.. _futabasbus:
210

311
Futaba SBus
@@ -8,12 +16,6 @@ The Futaba S.Bus protocol was introduced around 2009. It was developed by Futaba
816
.. image:: _static/sbus.png
917
:width: 700cm
1018

11-
Specifications
12-
--------------
13-
14-
- `Physical Layer`_
15-
- `Message Format`_
16-
1719
.. _physical_sbus:
1820

1921
Physical Layer
@@ -31,7 +33,7 @@ The configuration of the UART communication for SBus uses the following format:
3133
- **2 stop bits**: Following the data bits and the parity bit, there are 2 stop bits. Stop bits indicate the end of a data frame and provide timing for the receiving device to process the data.
3234

3335
Inversion
34-
^^^^^^^^^
36+
^^^^^^^^^^^^^^^^^^
3537

3638
For using SBus with a microcontroller, an inverter is typically required for the inverted UART logic level. This inversion is necessary because traditional UART operates with an active high level, while SBus uses inverted UART with an active low level.
3739

@@ -60,4 +62,37 @@ The SBus protocol uses a specific message format for transmitting control data f
6062

6163
These bits provide information about the status of channels 17 and 18, as well as indications of frame loss and failsafe activation.
6264

63-
- **Byte[24]**: SBUS footer (0x00): The message concludes with a footer byte, marking the end of the S.Bus frame.
65+
- **Byte[24]**: SBUS footer (0x00): The message concludes with a footer byte, marking the end of the S.Bus frame.
66+
67+
.. _frskyfport:
68+
69+
FrSky F.Port
70+
============
71+
72+
FrSky F.Port is a protocol developed by FrSky Electronic Co., Ltd., designed for communication between receivers and connected devices like servos or sensors. It is a one-line bus system that supports both control and data transmission, operating at a higher speed (115200 baud per second) compared to its predecessor, S.Port.
73+
74+
.. _physical_fport:
75+
76+
Physical Layer
77+
--------------
78+
79+
The physical layer of the FrSky F.Port protocol utilizes UART (Universal Asynchronous Receiver-Transmitter) communication at a baud rate of 115200.
80+
81+
UART Configuration
82+
^^^^^^^^^^^^^^^^^^
83+
84+
The configuration of the UART communication for F.Port uses the following format:
85+
86+
- **8 bits of data**: Each data frame consists of 8 bits, representing the information being transmitted.
87+
- **No parity**: It does not use a parity bit. Instead, it uses a checksum at the end of the whole packet for error detection.
88+
- **1 stop bit**: Following the data bits, there is 1 stop bit. Stop bits indicate the end of a data frame and provide timing for the receiving device to process the data.
89+
90+
.. _format_fport:
91+
92+
Message Format
93+
--------------
94+
95+
For the data format and more details, refer to the official documentation at the following link:
96+
97+
- `F.Port Protocol Specification (BetaFlight V2.1, 2017.11.21) <https://github.com/betaflight/betaflight/files/1491056/F.Port.protocol.betaFlight.V2.1.2017.11.21.pdf>`_
98+

Docs/source/tutorial.rst

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
.. _tutorial:
22

33
Tutorial
4-
========
4+
##########
5+
6+
General usage
7+
==========================
58

69
To use the library for decoding RC protocols in your Arduino project, follow these steps:
710

@@ -49,6 +52,61 @@ To instantiate a SerialIO object for receiving data only:
4952
5053
receiver->getChannel(&channelData);
5154
55+
Using software serial
56+
==========================
57+
If you are using a board that does not have hardware serial ports, you can use the SoftwareSerial library to create a software serial port.
58+
The SerialIO class can accept a SoftwareSerial object, but the begin method does not support software serial, so after creating the object, you need to
59+
manually initiate the software serial port.
60+
61+
.. note::
62+
63+
On AVR boards, only ibus, and fport protocols are supported (fport required an external inverter circuit), this is because sbus and crsf use unusual baudrate that are not supported by the hardware serial.
64+
sbus can be used, by using a software serial library, but it is not recommended.
65+
66+
Sbus
67+
^^^^^^
68+
69+
.. code-block:: cpp
70+
71+
#include <SoftwareSerial.h>
72+
#include <SerialIO.h>
73+
74+
#define pinRX 2
75+
#define pinTX 3
76+
#define SBUS_BAUDRATE 100000
77+
78+
/** SoftwareSerial(pinRX, pinTX, true);
79+
* ^^^^
80+
* set to true because sbus uses inverted uart
81+
*/
82+
83+
SoftwareSerial *mySerial = new SoftwareSerial(pinRX, pinTX, true);
84+
mySerial.begin(SBUS_BAUDRATE);
85+
SerialIO *receiver = new sbus(mySerial);
86+
87+
Crossfire
88+
^^^^^^^^^
89+
90+
.. note::
91+
92+
Crossfire uses a rather high baudrate of `420000`, which is not supported by hardware serial and for software serial,
93+
it is not recommended to use it, because the software serial library is not optimized for high baudrate. The following code
94+
is not tested. Best alternative would be to use a better microcontroller or if you are using ELRS receivers, then reduce the
95+
baudrate to `115200`, which is supported by hardware and software serial.
96+
97+
.. code-block:: cpp
98+
99+
#include <SoftwareSerial.h>
100+
#include <SerialIO.h>
101+
102+
#define pinRX 2
103+
#define pinTX 3
104+
#define CRSF_BAUDRATE 100000
105+
106+
SoftwareSerial *mySerial = new SoftwareSerial(pinRX, pinTX);
107+
mySerial.begin(CRSF_BAUDRATE);
108+
SerialIO *receiver = new crsf(mySerial);
109+
52110
See Also
53111
^^^^^^^^
54112
- :cpp:class:`SerialIO`

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,18 @@
55
<a href="https://www.gnu.org/licenses/gpl-3.0.en.html"><img src="https://img.shields.io/github/license/Witty-Wizard/SerialIO" alt="GitHub License"></a>
66
</p>
77

8-
# SerialIO Library
8+
# SerialIO
99

10-
A versatile Arduino library that provides support for decoding multiple RC protocols such as SBUS and CRSF.
10+
An arduino library for parsing almost any RC protocol.
1111

12-
# Overview
12+
## Overview
1313

1414
SerialIO is a common library designed to simplify the implementation of RC protocol decoding in Arduino projects. It provides a modular and extensible architecture that allows for easy integration of various RC protocols.
15+
16+
## How to use?
17+
18+
The examples and the tutorial are available on [this link](https://serialio.wittywizard.in)
19+
20+
## Contributing to the library
21+
22+
You see a bug or any feature that you require, please feel free to open an issue or if you have fixed the issue then please create a PR on github.

0 commit comments

Comments
 (0)