2 void USART::writeByte(uint8_t b)
4 int sent = write(file_desc, &b, 1);
7 std::cout <<
"WARNUNG: Fehler beim Senden (" << sent <<
"): writeByte(), wiederhole..." << std::endl;
9 sent = write(file_desc, &b, 1);
16 void USART::writeInt(uint16_t d)
18 int sent = write(file_desc, reinterpret_cast<char *>(&d), 2);
23 void USART::writeU32(uint32_t w)
25 int sent = write(file_desc, reinterpret_cast<char *>(&w), 4);
30 uint8_t USART::readByte(
void)
33 auto start = std::chrono::steady_clock::now();
36 while (elapsed < timeout * 100)
38 int code = read(file_desc, &b, 1);
40 return static_cast<uint8_t>(b);
42 end = std::chrono::steady_clock::now();
43 elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end - start).count();
49 uint16_t USART::readInt(
void)
51 return readByte() | readByte() << 8;