Docs

You are here:
TXTDevice interface

Functions

void TXTDEV_WriteString (IODevice device, const char *str)
 
void TXTDEV_WriteINT32 (IODevice device, int32_t value, uint8_t base)
 
void TXTDEV_WriteUINT32 (IODevice device, uint32_t value, uint8_t base)
 
void TXTDEV_WriteINT64 (IODevice device, int64_t value, uint8_t base)
 
void TXTDEV_WriteUINT64 (IODevice device, uint64_t value, uint8_t base)
 
void TXTDEV_WriteFLOAT (IODevice device, float value, int precision)
 
void TXTDEV_WriteNL (IODevice device)
 
void TXTDEV_WriteDate (IODevice device, uint16_t year, uint8_t month, uint8_t day)
 
void TXTDEV_WriteTime (IODevice device, uint8_t hours, uint8_t minutes, uint8_t seconds)
 
void TXTDEV_WriteData (IODevice device, const uint8_t *data, size_t size, int base, int spacing, const char *space)
 
void TXTDEV_ReadString (IODevice input_device, IODevice mirror_device, char *str, size_t max_len)
 

Detailed Description

Introduction.

The TXTDevice interface is used for sending and receiving textual data through IODevices (see IODevice interface) such as UART.

Function Documentation

void TXTDEV_ReadString ( IODevice  input_device,
IODevice  mirror_device,
char *  str,
size_t  max_len 
)

Reads a string from input IODevice.

Parameters
input_deviceinput IODevice
mirror_devicean optional device that will receive the characters that are received by input_device
strdestination buffer for the string
max_lenmaximum size of the read string
void TXTDEV_WriteData ( IODevice  device,
const uint8_t *  data,
size_t  size,
int  base,
int  spacing,
const char *  space 
)

Writes contents of a data buffer.

Parameters
deviceIODevice to write to
datadata buffer
sizesize of the data buffer
basea base for integer to string conversion
spacingnumber of bytes after which a space string should be inserted
spacespace string or NULL
void TXTDEV_WriteDate ( IODevice  device,
uint16_t  year,
uint8_t  month,
uint8_t  day 
)

Writes data in YYYY-MM-DD format.

Parameters
deviceIODevice to write to
yearyear
monthmonth (1..12)
dayday (1..31)
void TXTDEV_WriteFLOAT ( IODevice  device,
float  value,
int  precision 
)

Converts a float number to a string and writes the result to the provided IODevice.

Parameters
deviceIODevice to write to
valuefloat value to write
precisionnumber of digits after the dot
void TXTDEV_WriteINT32 ( IODevice  device,
int32_t  value,
uint8_t  base 
)

Converts a 32bit signed integer to string using specified base, and writes the result to the provided IODevice.

Parameters
deviceIODevice to write to
valuesigned 32bit integer value to write
baseconversion base (10 for decimal number, 16 for hex etc.)
void TXTDEV_WriteINT64 ( IODevice  device,
int64_t  value,
uint8_t  base 
)

Converts a 64bit signed integer to string using specified base, and writes the result to the provided IODevice.

Parameters
deviceIODevice to write to
valuesigned 64bit integer value to write
baseconversion base (10 for decimal number, 16 for hex etc.)
void TXTDEV_WriteNL ( IODevice  device)

Writes new line terminator to a specified IODevice.

Parameters
deviceIODevice to write to
void TXTDEV_WriteString ( IODevice  device,
const char *  str 
)

Writes a NULL-terminated string to an IODevice.

Parameters
deviceIODevice to write to
strNULL-terminated string to write
void TXTDEV_WriteTime ( IODevice  device,
uint8_t  hours,
uint8_t  minutes,
uint8_t  seconds 
)

Writes time in HH:MM:SS format.

Parameters
deviceIODevice to write to
hourshours (0..23)
minutesminutes (0..59)
secondsseconds (0..59)
void TXTDEV_WriteUINT32 ( IODevice  device,
uint32_t  value,
uint8_t  base 
)

Converts a 32bit unsigned integer to string using specified base, and writes the result to the provided IODevice.

Parameters
deviceIODevice to write to
valueunsigned 32bit integer value to write
baseconversion base (10 for decimal number, 16 for hex etc.)
void TXTDEV_WriteUINT64 ( IODevice  device,
uint64_t  value,
uint8_t  base 
)

Converts a 64bit unsigned integer to string using specified base, and writes the result to the provided IODevice.

Parameters
deviceIODevice to write to
valueunsigned 64bit integer value to write
baseconversion base (10 for decimal number, 16 for hex etc.)
Go to Top