MCPcopy Create free account
hub / github.com/OpenHD/OpenHD / valid_uart_baudrates

Function valid_uart_baudrates

OpenHD/ohd_telemetry/src/endpoints/SerialEndpoint.cpp:342–357  ·  view source on GitHub ↗

based on mavsdk and what linux allows setting if a value is in the map, we allow the user to set it

Source from the content-addressed store, hash-verified

340// based on mavsdk and what linux allows setting
341// if a value is in the map, we allow the user to set it
342static std::map<int, void*> valid_uart_baudrates() {
343 std::map<int, void*> ret;
344 ret[9600] = nullptr;
345 ret[19200] = nullptr;
346 ret[38400] = nullptr;
347 ret[57600] = nullptr;
348 ret[115200] = nullptr;
349 ret[230400] = nullptr;
350 ret[460800] = nullptr;
351 ret[500000] = nullptr;
352 ret[576000] = nullptr;
353 ret[921600] = nullptr;
354 ret[1000000] = nullptr;
355 // I think it is sane to stop here, I doubt anything higher makes sense
356 return ret;
357}
358
359bool SerialEndpoint::is_valid_linux_baudrate(int baudrate) {
360 const auto supported = valid_uart_baudrates();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected