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#include "crsf_protocol.h"
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 void processIncoming() override;
45
51 void getChannel(rc_channels_t *channelData) override;
52
53 uint8_t crc8(uint8_t *data, uint8_t len);
54};
55
56#endif
Header file for serial input/output (IO) functionality.
Class that stores state and functions for initialising and decoding rc protocol.
Definition SerialIO.h:37
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
decode the incoming serial data.
Definition crsf.cpp:23
void getChannel(rc_channels_t *channelData) override
Retrieves the decoded RC channels from the received CRSF data.
Definition crsf.cpp:50
Definition crsf_protocol.h:105
Definition SerialIO.h:12