mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 08:13: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;
|
||||
|
||||
ADCSource::ADCSource(SITL_State *sitlState, uint8_t pin) :
|
||||
ADCSource::ADCSource(SITL_State *sitlState, int16_t pin) :
|
||||
_sitlState(sitlState),
|
||||
_pin(pin)
|
||||
{}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user