B15F Board 15 Famulus Edition

Public Member Functions | List of all members
USART Class Reference

`#include <usart.h>`

## Public Member Functions
| USART ()=default
virtual | ~USART (void)
void | openDevice (std::string device)
void | closeDevice (void)
void | clearInputBuffer (void)
void | clearOutputBuffer (void)
void | flushOutputBuffer (void)
void | transmit (uint8_t *buffer, uint16_t offset, uint8_t len)
void | receive (uint8_t *buffer, uint16_t offset, uint8_t len)
uint32_t | getBaudrate (void)
uint8_t | getTimeout (void)
void | setBaudrate (uint32_t baudrate)
void | setTimeout (uint8_t timeout)

## Detailed Description

C++ Wrapper class for termios usart library.

Definition at line 15 of file usart.h.

## Constructor & Destructor Documentation

## ◆ USART()

USART::USART | ( |  | ) |
| explicit default

Standard-Konstruktor

## ◆ ~USART()

USART::~USART | ( | void |  | ) |
| virtual

Destructor, ruft automatisch closeDevice() auf

Definition at line 4 of file usart.cpp.

## Member Function Documentation

## ◆ clearInputBuffer()

void USART::clearInputBuffer | ( | void |  | ) |

Verwirft Daten, die bereits im Puffer liegen, aber noch nicht gelesen wurden

Exceptions

  USARTException |

Definition at line 54 of file usart.cpp.

## ◆ clearOutputBuffer()

void USART::clearOutputBuffer | ( | void |  | ) |

Verwirft Daten, die bereits im Puffer liegen, aber noch nicht gesendet wurden

Exceptions

  USARTException |

Definition at line 61 of file usart.cpp.

## ◆ closeDevice()

void USART::closeDevice | ( | void |  | ) |

Schließt die USART Schnittstelle

Exceptions

  USARTException |

Definition at line 43 of file usart.cpp.

## ◆ flushOutputBuffer()

void USART::flushOutputBuffer | ( | void |  | ) |

Schreibt Daten, die bereits im Puffer liegen, aber noch nicht gesendet wurden

Exceptions

  USARTException |

Definition at line 68 of file usart.cpp.

## ◆ getBaudrate()

uint32_t USART::getBaudrate | ( | void |  | ) |

Liefert die eingestellte Baudrate Änderungen werden erst nach einem open() wirksam

Definition at line 104 of file usart.cpp.

## ◆ getTimeout()

uint8_t USART::getTimeout | ( | void |  | ) |

Liefert den eingestellten Timeout (in Dezisekunden) Änderungen werden erst nach einem open() wirksam

Definition at line 109 of file usart.cpp.

## ◆ openDevice()

void USART::openDevice | ( | std::string | device | ) |

Öffnet die USART Schnittstelle

Parameters

  device | Linux-Gerätepfad

Exceptions

  USARTException |

Definition at line 9 of file usart.cpp.

## ◆ receive()

void USART::receive | ( | uint8_t * | buffer,
|  | uint16_t | offset,
|  | uint8_t | len
| ) |  |

Receives n bytes from USART and writes them into the buffer

Parameters

  buffer | target buffer
  offset | in buffer (mostly 0)
  len | count of bytes to receive

Exceptions

  USARTException |

Definition at line 75 of file usart.cpp.

## ◆ setBaudrate()

void USART::setBaudrate | ( | uint32_t | baudrate | ) |

Setzt die Baudrate Änderungen werden erst nach openDevice() wirksam

Definition at line 114 of file usart.cpp.

## ◆ setTimeout()

void USART::setTimeout | ( | uint8_t | timeout | ) |

Setzt den Timeout (in Dezisekunden) Änderungen werden erst nach openDevice() wirksam

Definition at line 119 of file usart.cpp.

## ◆ transmit()

void USART::transmit | ( | uint8_t * | buffer,
|  | uint16_t | offset,
|  | uint8_t | len
| ) |  |

Sends n bytes from the buffer over USART

Parameters

  buffer | target buffer
  offset | in buffer (mostly 0)
  len | count of bytes to send

Exceptions

  USARTException |

Definition at line 95 of file usart.cpp.

The documentation for this class was generated from the following files:

- drv/usart.h
- drv/usart.cpp