mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 16:23:56 -04:00
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:
parent
d35433b253
commit
5b2b4430b3
@ -9,7 +9,7 @@ using namespace HALSITL;
|
|||||||
|
|
||||||
extern const AP_HAL::HAL& hal;
|
extern const AP_HAL::HAL& hal;
|
||||||
|
|
||||||
ADCSource::ADCSource(SITL_State *sitlState, uint8_t pin) :
|
ADCSource::ADCSource(SITL_State *sitlState, int16_t pin) :
|
||||||
_sitlState(sitlState),
|
_sitlState(sitlState),
|
||||||
_pin(pin)
|
_pin(pin)
|
||||||
{}
|
{}
|
||||||
|
@ -9,7 +9,7 @@ class HALSITL::ADCSource : public AP_HAL::AnalogSource {
|
|||||||
public:
|
public:
|
||||||
friend class HALSITL::AnalogIn;
|
friend class HALSITL::AnalogIn;
|
||||||
/* pin designates the ADC input number */
|
/* pin designates the ADC input number */
|
||||||
ADCSource(SITL_State *sitlState, uint8_t pin);
|
ADCSource(SITL_State *sitlState, int16_t pin);
|
||||||
|
|
||||||
/* implement AnalogSource virtual api: */
|
/* implement AnalogSource virtual api: */
|
||||||
float read_average();
|
float read_average();
|
||||||
@ -25,16 +25,14 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
SITL_State *_sitlState;
|
SITL_State *_sitlState;
|
||||||
uint8_t _pin;
|
int16_t _pin;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* AnalogIn : a concrete class providing the implementations of the
|
/* AnalogIn : a concrete class providing the implementations of the
|
||||||
* timer event and the AP_HAL::AnalogIn interface */
|
* timer event and the AP_HAL::AnalogIn interface */
|
||||||
class HALSITL::AnalogIn : public AP_HAL::AnalogIn {
|
class HALSITL::AnalogIn : public AP_HAL::AnalogIn {
|
||||||
public:
|
public:
|
||||||
AnalogIn(SITL_State *sitlState) {
|
explicit AnalogIn(SITL_State *sitlState): _sitlState(sitlState) {}
|
||||||
_sitlState = sitlState;
|
|
||||||
}
|
|
||||||
void init();
|
void init();
|
||||||
AP_HAL::AnalogSource* channel(int16_t n);
|
AP_HAL::AnalogSource* channel(int16_t n);
|
||||||
float board_voltage(void) {
|
float board_voltage(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user