HALFRED
0.4.0
|
Introduction.
The TXTDevice interface is used for sending and receiving textual data through IODevices (see IODevice interface) such as UART.
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) |
void TXTDEV_WriteString | ( | IODevice | device, |
const char * | str | ||
) |
Writes a NULL-terminated string to an IODevice.
device | IODevice to write to |
str | NULL-terminated string to write |
References IODEV_Write().
Referenced by TXTDEV_WriteData().
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.
device | IODevice to write to |
value | signed 32bit integer value to write |
base | conversion base (10 for decimal number, 16 for hex etc.) |
References IODEV_Write(), and TXTDEV_WriteUINT32().
Referenced by TXTDEV_WriteFLOAT().
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.
device | IODevice to write to |
value | unsigned 32bit integer value to write |
base | conversion base (10 for decimal number, 16 for hex etc.) |
References IODEV_Write().
Referenced by TXTDEV_WriteData(), TXTDEV_WriteDate(), TXTDEV_WriteFLOAT(), TXTDEV_WriteINT32(), and TXTDEV_WriteTime().
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.
device | IODevice to write to |
value | signed 64bit integer value to write |
base | conversion base (10 for decimal number, 16 for hex etc.) |
References IODEV_Write(), and TXTDEV_WriteUINT64().
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.
device | IODevice to write to |
value | unsigned 64bit integer value to write |
base | conversion base (10 for decimal number, 16 for hex etc.) |
References IODEV_Write().
Referenced by TXTDEV_WriteINT64().
void TXTDEV_WriteFLOAT | ( | IODevice | device, |
float | value, | ||
int | precision | ||
) |
Converts a float number to a string and writes the result to the provided IODevice.
device | IODevice to write to |
value | float value to write |
precision | number of digits after the dot |
References IODEV_Write(), TXTDEV_WriteINT32(), and TXTDEV_WriteUINT32().
void TXTDEV_WriteNL | ( | IODevice | device | ) |
Writes new line terminator to a specified IODevice.
device | IODevice to write to |
References IODEV_Write().
void TXTDEV_WriteDate | ( | IODevice | device, |
uint16_t | year, | ||
uint8_t | month, | ||
uint8_t | day | ||
) |
Writes data in YYYY-MM-DD format.
device | IODevice to write to |
year | year |
month | month (1..12) |
day | day (1..31) |
References IODEV_Write(), and TXTDEV_WriteUINT32().
void TXTDEV_WriteTime | ( | IODevice | device, |
uint8_t | hours, | ||
uint8_t | minutes, | ||
uint8_t | seconds | ||
) |
Writes time in HH:MM:SS format.
device | IODevice to write to |
hours | hours (0..23) |
minutes | minutes (0..59) |
seconds | seconds (0..59) |
References IODEV_Write(), and TXTDEV_WriteUINT32().
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.
device | IODevice to write to |
data | data buffer |
size | size of the data buffer |
base | a base for integer to string conversion |
spacing | number of bytes after which a space string should be inserted |
space | space string or NULL |
References IODEV_Write(), TXTDEV_WriteString(), and TXTDEV_WriteUINT32().
void TXTDEV_ReadString | ( | IODevice | input_device, |
IODevice | mirror_device, | ||
char * | str, | ||
size_t | max_len | ||
) |
Reads a string from input IODevice.
input_device | input IODevice |
mirror_device | an optional device that will receive the characters that are received by input_device |
str | destination buffer for the string |
max_len | maximum size of the read string |
References IODEV_Read(), and IODEV_Write().