AP_RCProtocol_PPMSum.h 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * This file is free software: you can redistribute it and/or modify it
  3. * under the terms of the GNU General Public License as published by the
  4. * Free Software Foundation, either version 3 of the License, or
  5. * (at your option) any later version.
  6. *
  7. * This file is distributed in the hope that it will be useful, but
  8. * WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. * See the GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License along
  13. * with this program. If not, see <http://www.gnu.org/licenses/>.
  14. *
  15. * Code by Andrew Tridgell and Siddharth Bharat Purohit
  16. */
  17. #pragma once
  18. #include "AP_RCProtocol.h"
  19. class AP_RCProtocol_PPMSum : public AP_RCProtocol_Backend {
  20. public:
  21. AP_RCProtocol_PPMSum(AP_RCProtocol &_frontend) : AP_RCProtocol_Backend(_frontend) {}
  22. void process_pulse(uint32_t width_s0, uint32_t width_s1) override;
  23. private:
  24. // state of ppm decoder
  25. struct {
  26. int8_t _channel_counter;
  27. uint16_t _pulse_capt[MAX_RCIN_CHANNELS];
  28. } ppm_state;
  29. };