analogSequence repaired

This commit is contained in:
Tristan Krause 2019-06-06 12:10:17 +02:00
parent ff84de538a
commit bff5ff42e9
85 changed files with 1180 additions and 287 deletions

View file

@ -72,6 +72,15 @@ void USART::flushOutputBuffer()
throw USARTException("Fehler beim Versenden des Ausgangspuffers");
}
void USART::transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
{
int code = write(file_desc, buffer + offset, len);
if (code != len)
throw USARTException(
std::string(__FUNCTION__) + " failed: " + std::string(__FILE__) + "#" + std::to_string(__LINE__) +
", " + strerror(code) + " (code " + std::to_string(code) + " / " + std::to_string(len) + ")");
}
void USART::receive(uint8_t *buffer, uint16_t offset, uint8_t len)
{
int bytes_avail, code;
@ -102,13 +111,11 @@ void USART::receive(uint8_t *buffer, uint16_t offset, uint8_t len)
", " + strerror(code) + " (code " + std::to_string(code) + " / " + std::to_string(len) + ")");
}
void USART::transmit(uint8_t *buffer, uint16_t offset, uint8_t len)
void USART::drop(uint8_t len)
{
int code = write(file_desc, buffer + offset, len);
if (code != len)
throw USARTException(
std::string(__FUNCTION__) + " failed: " + std::string(__FILE__) + "#" + std::to_string(__LINE__) +
", " + strerror(code) + " (code " + std::to_string(code) + " / " + std::to_string(len) + ")");
// Kann bestimmt noch eleganter gelöst werden
uint8_t dummy[len];
receive(&dummy[0], 0, len);
}
uint32_t USART::getBaudrate()