Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
utilities.cpp File Reference
Copyright (C) 2014 ST MicroElectronics. More...
Go to the source code of this file.
Functions | |
| int32_t | roundFloatToInt (float_t floatVal) |
| This function round a float value to an integer value. | |
| int32_t | unPackBytes (int32_t data, uint8_t *byteArray, int32_t size) |
| This function unpacks an integer to a given array of bytes. | |
| uint32_t | packBytes (uint8_t *byteArray, uint32_t size) |
| This function packs an attay of bytes to a given integer. | |
| int32_t | array2HexCString (uint8_t *byteArray, char *str, uint32_t count) |
| This function converts a given array of bytes to a string in hex format. | |
| uint32_t | encodeTo9_7_Format (float_t value) |
| Method to encode a float to 9:7 format and return as an unsigned int. | |
| float_t | decodeFrom9_7_Format (uint32_t value) |
| Method to decode a 9:7 formatted data word into a float. | |
| uint32_t | encodeTo4_4_Format (float_t value) |
| Method to encode a float to 4:4 format and return as an unsigned int. | |
| float_t | decodeFrom4_4_Format (uint32_t value) |
| Method to decode a 4:4 formatted data word into a float. | |
Detailed Description
Copyright (C) 2014 ST MicroElectronics.
Utilities module definition.
Definition in file utilities.cpp.
Function Documentation
This function converts a given array of bytes to a string in hex format.
To be used when it is desired to display loose bytes as a short, int, long long etc.
If a valid length parameter is supplied only this number of bytes will be converted. A count of 0 will be ignored.
Definition at line 89 of file utilities.cpp.
Method to decode a 4:4 formatted data word into a float.
The data word is shifted 4 bits to the right and converted to float.
Definition at line 137 of file utilities.cpp.
Method to decode a 9:7 formatted data word into a float.
The data word is shifted 7 bits to the right and converted to float.
Definition at line 118 of file utilities.cpp.
Method to encode a float to 4:4 format and return as an unsigned int.
This is performed by shifting the float 4 bits to the left and then converting to unsigned int.
Definition at line 125 of file utilities.cpp.
Method to encode a float to 9:7 format and return as an unsigned int.
This is performed by shifting the float 7 bits to the left and then converting to unsigned int.
Definition at line 106 of file utilities.cpp.
This function packs an attay of bytes to a given integer.
Definition at line 66 of file utilities.cpp.
This function round a float value to an integer value.
Definition at line 43 of file utilities.cpp.
Generated on Tue Jul 12 2022 22:19:50 by
1.7.2