SerialIO
Loading...
Searching...
No Matches
crsf.h
Go to the documentation of this file.
1
7#pragma once
8#ifndef CRSF_H
9#define CRSF_H
10
11#include "../SerialIO.h" // Include header file for the serial IO class
12#include "crsf_protocol.h"
13
14#define CRC8_POLY_D5 0xD5
15
19class crsf : public SerialIO {
20private:
21 crsf_channels_t _channelData;
22 uint8_t _rxData[CRSF_MAX_PACKET_SIZE]={0};
23 bool _headerDetected; // Flag indicating whether a header has been detected in
24 // the incoming data.
25 uint8_t _rxIndex; // Index for the receive_buffer.
26 uint8_t _buffer;
27
28public:
37 explicit crsf(Stream *rxPort, int rxPin = -1, int txPin = -1,
38 bool inverted = false);
39
43 void begin() override;
44
48 void processIncoming() override;
49
55 void getChannel(rc_channels_t *channelData) override;
56
57 uint8_t crc8(uint8_t *data, uint8_t len);
58};
59
60#endif // CRSF_H
Header file for serial input/output (IO) functionality.
Class that stores state and functions for initialising and decoding rc protocol.
Definition SerialIO.h:36
A class for handling CRSF protocol communication.
Definition crsf.h:19
crsf(Stream *rxPort, int rxPin=-1, int txPin=-1, bool inverted=false)
Constructor for the CRSF class.
Definition crsf.cpp:3
void begin() override
Initializes the CRSF communication.
Definition crsf.cpp:6
void processIncoming() override
Processes incoming CRSF data.
Definition crsf.cpp:21
void getChannel(rc_channels_t *channelData) override
Retrieves the decoded RC channels from the received CRSF data.
Definition crsf.cpp:54
Header file for the CRSF protocol implementation.
#define CRSF_MAX_PACKET_SIZE
max declared len is 62+DEST+LEN on top of that = 64
Definition crsf_protocol.h:29
Definition crsf_protocol.h:109
Definition SerialIO.h:11