71 const std::uint8_t ctrl =
72 (
static_cast<std::uint8_t
>(m) << 7) |
73 static_cast<std::uint8_t
>((channel & 0b00000111) << 4)
76 const std::uint8_t byteCount = 3;
78 const std::uint8_t txData[byteCount] = {
84 std::uint8_t rxData[byteCount]{0};
86 const auto bytesTransferred = ::lgSpiXfer(
88 reinterpret_cast<const char*
>(txData),
89 reinterpret_cast<char*
>(rxData),
92 if(bytesTransferred != byteCount) {
93 throw std::runtime_error(
"spi transfer failed");
99 ((
static_cast<unsigned short>(rxData[1]) & 0b00000011) << 8) |
100 (
static_cast<unsigned short>(rxData[2]) & 0b11111111);