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.

CompilingLinking

Include the following at the top of any translation unit which requires this library:

        #include <ecl/converters_lite.hpp>

        // The converter functions
        using ecl::from_byte_array;

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.

unitTests

ChangeLog



ecl_converters_lite
Author(s): Daniel Stonier
autogenerated on Thu Jun 6 2019 18:53:22