Library initialization functions

The library contains a series of functions useful for the creation of your own programs, but in order to be used, it is necessary to perform the correct initialisation.

eLibInit

uint8_t eLibInit(void);

This function initializes the library, it must be executed before other library functions can be executed. The function has no parameters. The function returns indication on the outcome of the execution.

0: Ok
1: Library error already initialized
2: Error reading configuration
3: Security error
4: Unique ID hardware creation error

eGetLibVersion

char_t* eGetLibVersion(void);

The function has no parameters and returns a library version definition string.

Examples

How to use the examples.
The library is initialized and the version is returned. In the event of an initialisation error, the error code is returned.

CodeLite (Ptp174)
// *****************************************************************************
// PROGRAM "LibraryInit.cpp"
// *****************************************************************************
// An example how to initialize the library.
// -----------------------------------------------------------------------------

#include <stdio.h>
#include <Library.h>
using namespace Elsist; //Defines namespace

// -----------------------------------------------------------------------------
// PROGRAM EXECUTION
// -----------------------------------------------------------------------------

bool LibraryInit(void)
{
    // -------------------------------------------------------------------------
    // LOCAL VARIABLES
    // -------------------------------------------------------------------------
    // Define variables.

    int8_t Result; //Function result

    // -------------------------------------------------------------------------
    // LIBRARY INITIALIZATION
    // -------------------------------------------------------------------------
    // Initialize the library, this must be done before use any function.
    // Function returns 0 if Ok or the error code.

    if ((Result=eLibInit()) != 0) {printf("eLibInit error %d\n", Result); return(false);}
    
    // The library version is displayed.

    printf("Library version:%s\n", eGetLibVersion());
    return(true);
}
// [End of file]
Was this article helpful?