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

Function seeedBitrateCode

app/src/IO/Drivers/SeeedCanBackend.cpp:58–82  ·  view source on GitHub ↗

* @brief Maps a bitrate in bits/s to the analyzer's configuration code, or 0 when unsupported. */

Source from the content-addressed store, hash-verified

56 * @brief Maps a bitrate in bits/s to the analyzer's configuration code, or 0 when unsupported.
57 */
58[[nodiscard]] static std::uint8_t seeedBitrateCode(std::uint32_t bitrate)
59{
60 switch (bitrate) {
61 case 1000000:
62 return 0x01;
63 case 800000:
64 return 0x02;
65 case 500000:
66 return 0x03;
67 case 250000:
68 return 0x05;
69 case 125000:
70 return 0x07;
71 case 100000:
72 return 0x08;
73 case 50000:
74 return 0x09;
75 case 20000:
76 return 0x0a;
77 case 10000:
78 return 0x0b;
79 default:
80 return 0x00;
81 }
82}
83
84/**
85 * @brief Decodes one variable-length packet at the front of @p buf (which must start with 0xAA).

Callers 2

openMethod · 0.85
sendInitFrameMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected