mirror of
https://github.com/ArduPilot/ardupilot.git
synced 2026-10-21 20:53:52 +08:00
AP_WheelEncoder: add singleton
This commit is contained in:
@@ -151,6 +151,8 @@ const AP_Param::GroupInfo AP_WheelEncoder::var_info[] = {
|
||||
|
||||
AP_WheelEncoder::AP_WheelEncoder(void)
|
||||
{
|
||||
_singleton = this;
|
||||
|
||||
AP_Param::setup_object_defaults(this, var_info);
|
||||
}
|
||||
|
||||
@@ -347,3 +349,15 @@ uint32_t AP_WheelEncoder::get_last_reading_ms(uint8_t instance) const
|
||||
}
|
||||
return state[instance].last_reading_ms;
|
||||
}
|
||||
|
||||
// singleton instance
|
||||
AP_WheelEncoder *AP_WheelEncoder::_singleton;
|
||||
|
||||
namespace AP {
|
||||
|
||||
AP_WheelEncoder *wheelencoder()
|
||||
{
|
||||
return AP_WheelEncoder::get_singleton();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user