Line data Source code
1 : #pragma once 2 : 3 : #include "AP_RCMapper_config.h" 4 : 5 : #if AP_RCMAPPER_ENABLED 6 : 7 : #include <inttypes.h> 8 : #include <AP_Common/AP_Common.h> 9 : #include <AP_Param/AP_Param.h> 10 : 11 : class RCMapper { 12 : public: 13 : RCMapper(); 14 : 15 : /* Do not allow copies */ 16 : CLASS_NO_COPY(RCMapper); 17 : 18 : // get singleton instance 19 313971 : static RCMapper *get_singleton() 20 : { 21 313971 : return _singleton; 22 : } 23 : 24 : /// roll - return input channel number for roll / aileron input 25 77247 : uint8_t roll() const { return _ch_roll; } 26 : 27 : /// pitch - return input channel number for pitch / elevator input 28 64129 : uint8_t pitch() const { return _ch_pitch; } 29 : 30 : /// throttle - return input channel number for throttle input 31 95490 : uint8_t throttle() const { return _ch_throttle; } 32 : 33 : /// yaw - return input channel number for yaw / rudder input 34 76939 : uint8_t yaw() const { return _ch_yaw; } 35 : 36 : /// forward - return input channel number for forward input 37 83 : uint8_t forward() const { return _ch_forward; } 38 : 39 : /// lateral - return input channel number for lateral input 40 83 : uint8_t lateral() const { return _ch_lateral; } 41 : 42 : static const struct AP_Param::GroupInfo var_info[]; 43 : 44 : private: 45 : // channel mappings 46 : AP_Int8 _ch_roll; 47 : AP_Int8 _ch_pitch; 48 : AP_Int8 _ch_yaw; 49 : AP_Int8 _ch_throttle; 50 : AP_Int8 _ch_forward; 51 : AP_Int8 _ch_lateral; 52 : static RCMapper *_singleton; 53 : }; 54 : 55 : namespace AP 56 : { 57 : RCMapper *rcmap(); 58 : }; 59 : 60 : #endif // AP_RCMAPPER_ENABLED