AP_HAL_SITL: AnalogIn minor fixes

change pin to int16_t to match real implementation and prevent casting.
make constructor explicit
This commit is contained in:
Pierre Kancir 2017-01-09 13:22:43 +01:00 committed by Francisco Ferreira
parent d35433b253
commit 5b2b4430b3
2 changed files with 4 additions and 6 deletions

View File

@ -9,7 +9,7 @@ using namespace HALSITL;
extern const AP_HAL::HAL& hal;
ADCSource::ADCSource(SITL_State *sitlState, uint8_t pin) :
ADCSource::ADCSource(SITL_State *sitlState, int16_t pin) :
_sitlState(sitlState),
_pin(pin)
{}

View File

@ -9,7 +9,7 @@ class HALSITL::ADCSource : public AP_HAL::AnalogSource {
public:
friend class HALSITL::AnalogIn;
/* pin designates the ADC input number */
ADCSource(SITL_State *sitlState, uint8_t pin);
ADCSource(SITL_State *sitlState, int16_t pin);
/* implement AnalogSource virtual api: */
float read_average();
@ -25,16 +25,14 @@ public:
private:
SITL_State *_sitlState;
uint8_t _pin;
int16_t _pin;
};
/* AnalogIn : a concrete class providing the implementations of the
* timer event and the AP_HAL::AnalogIn interface */
class HALSITL::AnalogIn : public AP_HAL::AnalogIn {
public:
AnalogIn(SITL_State *sitlState) {
_sitlState = sitlState;
}
explicit AnalogIn(SITL_State *sitlState): _sitlState(sitlState) {}
void init();
AP_HAL::AnalogSource* channel(int16_t n);
float board_voltage(void) {