2018-01-17 15:31:11 -04:00
|
|
|
/*
|
|
|
|
* This file is free software: you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
* See the GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2018-07-20 01:25:40 -03:00
|
|
|
*
|
2018-01-17 15:31:11 -04:00
|
|
|
* Code by Andrew Tridgell and Siddharth Bharat Purohit
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2023-05-03 10:08:00 -03:00
|
|
|
#include "AP_RCProtocol_config.h"
|
|
|
|
|
2023-05-15 22:55:57 -03:00
|
|
|
#if AP_RCPROTOCOL_PPMSUM_ENABLED
|
2023-05-03 10:08:00 -03:00
|
|
|
|
|
|
|
#include "AP_RCProtocol_Backend.h"
|
2018-01-17 15:31:11 -04:00
|
|
|
|
|
|
|
class AP_RCProtocol_PPMSum : public AP_RCProtocol_Backend {
|
|
|
|
public:
|
|
|
|
AP_RCProtocol_PPMSum(AP_RCProtocol &_frontend) : AP_RCProtocol_Backend(_frontend) {}
|
|
|
|
void process_pulse(uint32_t width_s0, uint32_t width_s1) override;
|
|
|
|
private:
|
|
|
|
// state of ppm decoder
|
|
|
|
struct {
|
|
|
|
int8_t _channel_counter;
|
|
|
|
uint16_t _pulse_capt[MAX_RCIN_CHANNELS];
|
|
|
|
} ppm_state;
|
2018-11-02 08:25:05 -03:00
|
|
|
};
|
2023-05-03 10:08:00 -03:00
|
|
|
|
2023-05-15 22:55:57 -03:00
|
|
|
#endif // AP_RCPROTOCOL_PPMSUM_ENABLED
|