Devices Library

Provides drivers for USART, USB, 2-3 wire motors, time functions on AVR / STM32 / x86.

Build

Set up the build following an example from cmake-helpers project.

x86

PseudoTTY

The class creates two serial devices using socat utility. PseudoTTY is useful for testing serial client or server. The unit tests for Usart class use it for similating serial ports.

Usart

The class provides an interface for communication over serial connection. Each read/write is configured to time out if the operation doesn’t complete within a specified window. The code uses Boost ASIO library.

usart_test.cpp contains unit tests for Usart class.

Usart Termios

Class functionality is similar to Usart but using termios library.

usart_termios_test.cpp contains unit tests for Usart class.

STM32

Usb

The class provides an interface to transfer data over USB connection.

Usart

The class provides an interface for communication over serial connection.

PwmMotor3Wire

The class can drive a motor that uses three wires for direction and speed control.

PwmMotor2Wire

The class can drive a motor that uses two wires for direction and speed control.

AVR

PwmMotor3Wire

The class can drive a motor that uses three wires for direction and speed control.

Common Code

MaxSonarLvEx

The class calculates range in millimeters from an ADC sample of MaxSonar ultrasonic range finder.

WheelEncoder

The class counts the number of clicks that a virtual wheel moved forward and backward.