diff --git a/libraries/RC_ChannelB/RC_ChannelB.cpp b/libraries/AP_RcChannel/AP_RcChannel.cpp similarity index 84% rename from libraries/RC_ChannelB/RC_ChannelB.cpp rename to libraries/AP_RcChannel/AP_RcChannel.cpp index 2cac7122c4..f73c25f021 100644 --- a/libraries/RC_ChannelB/RC_ChannelB.cpp +++ b/libraries/AP_RcChannel/AP_RcChannel.cpp @@ -1,5 +1,5 @@ /* - RC_ChannelB.cpp - Radio library for Arduino + AP_RcChannel.cpp - Radio library for Arduino Code by Jason Short, James Goppert. DIYDrones.com This library is free software; you can redistribute it and / or @@ -11,10 +11,10 @@ #include #include -#include "RC_ChannelB.h" +#include "AP_RcChannel.h" #include -void RC_ChannelB::readRadio(uint16_t pwmRadio) { +void AP_RcChannel::readRadio(uint16_t pwmRadio) { // apply reverse if(_reverse) _pwmRadio = (_pwmNeutral - pwmRadio) + _pwmNeutral; else _pwmRadio = pwmRadio; @@ -23,7 +23,7 @@ void RC_ChannelB::readRadio(uint16_t pwmRadio) { } void -RC_ChannelB::setPwm(uint16_t pwm) +AP_RcChannel::setPwm(uint16_t pwm) { //Serial.printf("reverse: %s\n", (_reverse)?"true":"false"); @@ -51,13 +51,13 @@ RC_ChannelB::setPwm(uint16_t pwm) } void -RC_ChannelB::setPosition(float position) +AP_RcChannel::setPosition(float position) { setPwm(_positionToPwm(position)); } void -RC_ChannelB::mixRadio(uint16_t infStart) +AP_RcChannel::mixRadio(uint16_t infStart) { float inf = abs( int16_t(_pwmRadio - _pwmNeutral) ); inf = min(inf, infStart); @@ -66,7 +66,7 @@ RC_ChannelB::mixRadio(uint16_t infStart) } uint16_t -RC_ChannelB::_positionToPwm(const float & position) +AP_RcChannel::_positionToPwm(const float & position) { uint16_t pwm; //Serial.printf("position: %f\n", position); @@ -79,7 +79,7 @@ RC_ChannelB::_positionToPwm(const float & position) } float -RC_ChannelB::_pwmToPosition(const uint16_t & pwm) +AP_RcChannel::_pwmToPosition(const uint16_t & pwm) { float position; if(pwm < _pwmNeutral) diff --git a/libraries/RC_ChannelB/RC_ChannelB.h b/libraries/AP_RcChannel/AP_RcChannel.h similarity index 85% rename from libraries/RC_ChannelB/RC_ChannelB.h rename to libraries/AP_RcChannel/AP_RcChannel.h index 6b414f25e8..94d73a671a 100644 --- a/libraries/RC_ChannelB/RC_ChannelB.h +++ b/libraries/AP_RcChannel/AP_RcChannel.h @@ -1,24 +1,24 @@ // -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: t -*- -/// @file RC_ChannelB.h -/// @brief RC_ChannelB manager +/// @file AP_RcChannel.h +/// @brief AP_RcChannel manager -#ifndef RC_ChannelB_h -#define RC_ChannelB_h +#ifndef AP_RcChannel_h +#define AP_RcChannel_h #include #include -/// @class RC_ChannelB +/// @class AP_RcChannel /// @brief Object managing one RC channel // -class RC_ChannelB{ +class AP_RcChannel{ public: /// Constructor /// - RC_ChannelB(const float & scale, const uint16_t & pwmMin, const uint16_t & pwmNeutral, + AP_RcChannel(const float & scale, const uint16_t & pwmMin, const uint16_t & pwmNeutral, const uint16_t & pwmMax, const uint16_t & pwmDeadZone, const bool & filter, const bool & reverse) : _scale(scale), diff --git a/libraries/RC_ChannelB/examples/RC_ChannelB/RC_ChannelB.pde b/libraries/AP_RcChannel/examples/AP_RcChannel/AP_RcChannel.pde similarity index 91% rename from libraries/RC_ChannelB/examples/RC_ChannelB/RC_ChannelB.pde rename to libraries/AP_RcChannel/examples/AP_RcChannel/AP_RcChannel.pde index 2c7cc70d04..e3ec93cc01 100644 --- a/libraries/RC_ChannelB/examples/RC_ChannelB/RC_ChannelB.pde +++ b/libraries/AP_RcChannel/examples/AP_RcChannel/AP_RcChannel.pde @@ -8,7 +8,7 @@ #include #include #include // ArduPilot Mega RC Library -#include // ArduPilot Mega RC Library +#include // ArduPilot Mega RC Library #include AP_EEPromVar scale(45.0,"RC1_SCALE"); @@ -25,9 +25,9 @@ AP_Var reverse(false,"RC1_REVERSE"); FastSerialPort0(Serial); -RC_ChannelB rc[] = +AP_RcChannel rc[] = { - RC_ChannelB(scale.get(),pwmMin.get(),pwmNeutral.get(),pwmMax.get(), + AP_RcChannel(scale.get(),pwmMin.get(),pwmNeutral.get(),pwmMax.get(), pwmDeadZone.get(),filter.get(),reverse.get()) };