50 if (!uart_->
receive(buf_.data(), buf_.size(), 0)) {
54 for (
size_t i = 0; i < 8; ++i) {
55 if (buf_[i] == 0x80) {
58 for (
size_t j = i; j < 8; ++j) {
59 buf_[j - i] = buf_[j];
61 if (!uart_->
receive(buf_.data() + 8 - i, i, 0)) {
66 for (
size_t i = 1; i < 7; ++i) {
70 if ((checksum & 0x7F) == buf_[7]) {
71 keys_ = (buf_[1] << 8) | buf_[2];
72 if ((keys_ & 0x03) == 0x03) {
76 if ((keys_ & 0x0C) == 0x0C) {
80 for (
size_t i = 0; i < 4; ++i) {
81 axes_[i] = (
static_cast<float>(buf_[i + 3]) - 64) / 64;