AP_SerialManager: adding Volz Support
and make AP_SerialManager a singleton
This commit is contained in:
parent
65032919e2
commit
2442f3fb06
@ -129,9 +129,13 @@ const AP_Param::GroupInfo AP_SerialManager::var_info[] = {
|
||||
AP_GROUPEND
|
||||
};
|
||||
|
||||
// singleton instance
|
||||
AP_SerialManager *AP_SerialManager::_instance;
|
||||
|
||||
// Constructor
|
||||
AP_SerialManager::AP_SerialManager()
|
||||
{
|
||||
_instance = this;
|
||||
// setup parameter defaults
|
||||
AP_Param::setup_object_defaults(this, var_info);
|
||||
}
|
||||
@ -221,6 +225,14 @@ void AP_SerialManager::init()
|
||||
AP_SERIALMANAGER_ULANDING_BUFSIZE_RX,
|
||||
AP_SERIALMANAGER_ULANDING_BUFSIZE_TX);
|
||||
break;
|
||||
|
||||
case SerialProtocol_Volz:
|
||||
// Note baudrate is hardcoded to 115200
|
||||
state[i].baud = AP_SERIALMANAGER_VOLZ_BAUD; // update baud param in case user looks at it
|
||||
state[i].uart->begin(map_baudrate(state[i].baud),
|
||||
AP_SERIALMANAGER_VOLZ_BUFSIZE_RX,
|
||||
AP_SERIALMANAGER_VOLZ_BUFSIZE_TX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -69,6 +69,10 @@
|
||||
#define AP_SERIALMANAGER_ULANDING_BUFSIZE_RX 128
|
||||
#define AP_SERIALMANAGER_ULANDING_BUFSIZE_TX 128
|
||||
|
||||
#define AP_SERIALMANAGER_VOLZ_BAUD 115
|
||||
#define AP_SERIALMANAGER_VOLZ_BUFSIZE_RX 128
|
||||
#define AP_SERIALMANAGER_VOLZ_BUFSIZE_TX 128
|
||||
|
||||
|
||||
class AP_SerialManager {
|
||||
public:
|
||||
@ -87,9 +91,15 @@ public:
|
||||
SerialProtocol_FrSky_SPort_Passthrough = 10, // FrSky SPort Passthrough (OpenTX) protocol (X-receivers)
|
||||
SerialProtocol_Lidar360 = 11, // Lightware SF40C, TeraRanger Tower or RPLidarA2
|
||||
SerialProtocol_Aerotenna_uLanding = 12, // Ulanding support
|
||||
SerialProtocol_Beacon = 13
|
||||
SerialProtocol_Beacon = 13,
|
||||
SerialProtocol_Volz = 14, // Volz servo protocol
|
||||
};
|
||||
|
||||
// get singleton instance
|
||||
static AP_SerialManager *get_instance(void) {
|
||||
return _instance;
|
||||
}
|
||||
|
||||
static AP_SerialManager create() { return AP_SerialManager{}; }
|
||||
|
||||
constexpr AP_SerialManager(AP_SerialManager &&other) = default;
|
||||
@ -135,6 +145,8 @@ public:
|
||||
private:
|
||||
AP_SerialManager();
|
||||
|
||||
static AP_SerialManager *_instance;
|
||||
|
||||
// array of uart info
|
||||
struct {
|
||||
AP_Int8 protocol;
|
||||
|
Loading…
Reference in New Issue
Block a user