AP_SerialManager: added set_protocol_and_baud()

used by AP_Periph for rangefinders
This commit is contained in:
Andrew Tridgell 2019-10-28 11:30:58 +11:00
parent 529f7a4416
commit 2708c99bfb
2 changed files with 12 additions and 0 deletions

View File

@ -614,6 +614,15 @@ void AP_SerialManager::disable_passthru(void)
passthru_port2.set_and_notify(-1);
}
// accessor for AP_Periph to set baudrate and type
void AP_SerialManager::set_protocol_and_baud(uint8_t sernum, enum SerialProtocol protocol, uint32_t baudrate)
{
if (sernum <= ARRAY_SIZE(state)) {
state[sernum].protocol.set(protocol);
state[sernum].baud.set(baudrate);
}
}
namespace AP {

View File

@ -157,6 +157,9 @@ public:
// get Serial Port
AP_HAL::UARTDriver *get_serial_by_id(uint8_t id);
// accessors for AP_Periph to set baudrate and type
void set_protocol_and_baud(uint8_t sernum, enum SerialProtocol protocol, uint32_t baudrate);
// parameter var table
static const struct AP_Param::GroupInfo var_info[];