MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / slcanBitrateIndex

Function slcanBitrateIndex

app/src/IO/Drivers/SlcanBackend.cpp:44–51  ·  view source on GitHub ↗

* @brief Maps a bitrate in bits/s to its LAWICEL "Sn" index, or -1 when unsupported. */

Source from the content-addressed store, hash-verified

42 * @brief Maps a bitrate in bits/s to its LAWICEL "Sn" index, or -1 when unsupported.
43 */
44[[nodiscard]] static int slcanBitrateIndex(std::uint32_t bitrate)
45{
46 for (std::size_t i = 0; i < std::size(kSlcanBitrates); ++i)
47 if (kSlcanBitrates[i] == bitrate)
48 return static_cast<int>(i);
49
50 return -1;
51}
52
53/**
54 * @brief Decodes a single LAWICEL frame token (t/T/r/R) into a QCanBusFrame.

Callers 1

openMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected