Async Comm
A library for asynchronous serial communication
Macros | Functions
serial_loopback.cpp File Reference
#include <async_comm/serial.h>
#include <cstdint>
#include <cstdio>
#include <chrono>
#include <thread>
Include dependency graph for serial_loopback.cpp:

Go to the source code of this file.

Macros

#define NUM_BYTES   64
 

Functions

void callback (const uint8_t *buf, size_t len)
 Callback function for the async_comm library. More...
 
int main (int argc, char **argv)
 

Detailed Description

Author
Daniel Koch danie.nosp@m.lpko.nosp@m.ch@gm.nosp@m.ail..nosp@m.com

This example is designed for use with a USB-to-UART adapter with the RX and TX pins connected together (loopback). Sends a series of bytes out and prints them to the console as they are received back.

Definition in file serial_loopback.cpp.

Function Documentation

◆ callback()

void callback ( const uint8_t *  buf,
size_t  len 
)

Callback function for the async_comm library.

Prints the received bytes to stdout.

Parameters
bufReceived bytes buffer
lenNumber of bytes received

Definition at line 60 of file serial_loopback.cpp.