123456789101112131415161718192021222324252627282930313233343536373839404142 |
- #pragma once
- #define IBUS_FRAME_SIZE 32
- #define IBUS_INPUT_CHANNELS 14
- #include "AP_RCProtocol.h"
- #include "SoftSerial.h"
- class AP_RCProtocol_IBUS : public AP_RCProtocol_Backend
- {
- public:
- AP_RCProtocol_IBUS(AP_RCProtocol &_frontend);
- void process_pulse(uint32_t width_s0, uint32_t width_s1) override;
- void process_byte(uint8_t byte, uint32_t baudrate) override;
- private:
- void _process_byte(uint32_t timestamp_us, uint8_t byte);
- bool ibus_decode(const uint8_t frame[IBUS_FRAME_SIZE], uint16_t *values, bool *ibus_failsafe);
- SoftSerial ss{115200, SoftSerial::SERIAL_CONFIG_8N1};
- struct {
- uint8_t buf[IBUS_FRAME_SIZE];
- uint8_t ofs;
- uint32_t last_byte_us;
- } byte_input;
- };
|