ecl_converters_lite Documentation

ecl_converters_lite

These are a very simple version of some of the functions in ecl_converters suitable for firmware development. That is, there is no use of new, templates or exceptions.

Introduction

Lightweight converter functions suitable for control firmware develompent.

Compiling & Linking

    Include the following at the top of any translation unit which
    requires this library:
// The converter functions

Since it is solely comprised of inline header functions, no linking is required if you are only using this class.

Usage

Byte Array Converters

These convert between integral types and character arrays. This is quite a common operation for control systems which are reading/writing to and from i/o character devices (e.g. serial port).

These functions do need some care as you're passing pointers which must be pointing to memory with at least the required number of bytes to do the conversion

ecl::int32 value;
char three_six_three[4] = { 0x6b, 0x01, 0x00, 0x00 };
ecl::from_byte_array(value,three_six_three);
std::cout << value << std::endl; // prints 363.
// ...also unsigned int/char variants.

Current List of Converters

The following are listed with the 'to' type on the left and 'from' types on the right.

Unit Tests

    - src/test/byte_array.cpp

ChangeLog

    - <b>Nar 11</b> : added from_byte_array functions.


ecl_converters_lite
Author(s): Daniel Stonier
autogenerated on Mon Feb 28 2022 22:16:10