based on mavsdk and what linux allows setting if a value is in the map, we allow the user to set it
| 340 | // based on mavsdk and what linux allows setting |
| 341 | // if a value is in the map, we allow the user to set it |
| 342 | static 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 | |
| 359 | bool SerialEndpoint::is_valid_linux_baudrate(int baudrate) { |
| 360 | const auto supported = valid_uart_baudrates(); |
no outgoing calls
no test coverage detected