libtiepie-hw  1.1.6
Library initialization/deinitialization/version

Functions to initialize and exit the library and retrieve information from the library itself. More...

Collaboration diagram for Library initialization/deinitialization/version:

Data Structures

struct  tiepie_hw_version
 Structure with library version info. More...
 

Functions

TIEPIE_HW_API void tiepie_hw_init (void)
 Create and initialize internal resources used by the library. More...
 
TIEPIE_HW_API tiepie_hw_bool tiepie_hw_is_initialized (void)
 Check whether the library's internal resources are initialized. More...
 
TIEPIE_HW_API void tiepie_hw_fini (void)
 Clear and free internal resources used by the library. More...
 
TIEPIE_HW_API const tiepie_hw_versiontiepie_hw_get_version (void)
 Get library version info. More...
 
TIEPIE_HW_API uint32_t tiepie_hw_get_config (uint8_t *buffer, uint32_t length)
 Get the library configuration number. More...
 
TIEPIE_HW_API tiepie_hw_status tiepie_hw_get_last_status (void)
 Get the last status value. More...
 
TIEPIE_HW_API const char * tiepie_hw_get_last_status_str (void)
 Get the last status value as text. More...
 

Detailed Description

Functions to initialize and exit the library and retrieve information from the library itself.

After loading the library, it must be initialized first, before functions in the library can be used. Before closing the library, when the application using the library no longer requires it, tiepie_hw_fini() must be called, to clear and free resources used by the library.

The library has a version number and a configuration number that can be queried. These can be used when requesting support from TiePie engineering.

On each library function call a status flag is set, indicating how the function was executed. When a function call behaves different than expected, check the status for possible causes.

Function Documentation

◆ tiepie_hw_init()

TIEPIE_HW_API void tiepie_hw_init ( void  )

Create and initialize internal resources used by the library.

This function must be called after loading the library, before non library related functions in the library can be used. Calling non library related functions before the library is initialized will set the status flag to TIEPIE_HW_STATUS_LIBRARY_NOT_INITIALIZED.

Remarks
tiepie_hw_init() can be called multiple times, an internal reference counter is used to keep track of the number of times it is called. tiepie_hw_fini() must then be called equally often.
Status values
This function does not affect the status flag.
See also
tiepie_hw_is_initialized
tiepie_hw_fini
Since
1.0

◆ tiepie_hw_is_initialized()

TIEPIE_HW_API tiepie_hw_bool tiepie_hw_is_initialized ( void  )

Check whether the library's internal resources are initialized.

Returns
TIEPIE_HW_BOOL_TRUE if initialized, TIEPIE_HW_BOOL_FALSE otherwise.
Status values
This function does not affect the status flag.
See also
tiepie_hw_init
tiepie_hw_fini
Since
1.0

◆ tiepie_hw_fini()

TIEPIE_HW_API void tiepie_hw_fini ( void  )

Clear and free internal resources used by the library.

This function must be called before closing the library, when the application using the library no longer requires it.

Status values
This function does not affect the status flag.
See also
tiepie_hw_init
tiepie_hw_is_initialized
Since
1.0

◆ tiepie_hw_get_version()

TIEPIE_HW_API const tiepie_hw_version* tiepie_hw_get_version ( void  )

Get library version info.

Returns
Pointer to struct with version info.
Status values
This function does not affect the status flag.
Example
printf("libtiepie-hw v%u.%u.%u%s\n", version->major, version->minor, version->patch, version->extra);
TIEPIE_HW_API const tiepie_hw_version * tiepie_hw_get_version(void)
Get library version info.
Structure with library version info.
Definition: libtiepie-hw.h:1926
uint16_t minor
Minor version number.
Definition: libtiepie-hw.h:1928
uint16_t patch
Patch level.
Definition: libtiepie-hw.h:1929
uint16_t major
Major version number.
Definition: libtiepie-hw.h:1927
const char * extra
Additional version text.
Definition: libtiepie-hw.h:1931
Since
1.0

◆ tiepie_hw_get_config()

TIEPIE_HW_API uint32_t tiepie_hw_get_config ( uint8_t *  buffer,
uint32_t  length 
)

Get the library configuration number.

Parameters
[out]bufferA pointer to the buffer to write to.
[in]lengthThe length of the buffer, in bytes.
Returns
The library configuration number length in bytes.
Status values
This function does not affect the status flag.
Example
uint32_t length = tiepie_hw_get_config(NULL, 0);
uint8_t* buffer = malloc(sizeof(uint8_t) * length);
length = tiepie_hw_get_config(buffer, length);
printf("libtiepie-hw config: 0x");
for(uint32_t i = 0; i < length; i++)
printf("%02x", buffer[i]);
printf("\n");
free(buffer);
TIEPIE_HW_API uint32_t tiepie_hw_get_config(uint8_t *buffer, uint32_t length)
Get the library configuration number.
Since
1.0

◆ tiepie_hw_get_last_status()

TIEPIE_HW_API tiepie_hw_status tiepie_hw_get_last_status ( void  )

Get the last status value.

After each call to a library function, a status flag is set, indicating how the function was executed.

Returns
Status code.
Status values
This function does not affect the status flag.
See also
tiepie_hw_get_last_status_str
Since
1.0

◆ tiepie_hw_get_last_status_str()

TIEPIE_HW_API const char* tiepie_hw_get_last_status_str ( void  )

Get the last status value as text.

After each call to a library function, a status flag is set, indicating how the function was executed.

Returns
Status code as text.
Status values
This function does not affect the status flag.
See also
tiepie_hw_get_last_status
Example
printf("tiepie_hw_get_last_status_str = %s\n", tiepie_hw_get_last_status_str());
TIEPIE_HW_API const char * tiepie_hw_get_last_status_str(void)
Get the last status value as text.
Since
1.1