.
Dependencies: L432KC_SPI_Pey_Lal
toolbox.cpp
- Committer:
- voltxd
- Date:
- 2022-05-18
- Revision:
- 115:156b8234f2de
- Parent:
- 113:2f8f255e99f2
File content as of revision 115:156b8234f2de:
#include "toolbox.hpp" double limitToInterval(double value, double min, double max) { if (value > max) return max; else if (value < min) return min; else return value; } float convertBytesToFloat(char *array, char startIndex) { float *fPtr = (float*)(array + startIndex); float f = *fPtr; return f; } void convertFloatToBytes(float *f, char *array, char startIndex) { char *fPtr = (char *)f; for (int i = 0; i < 4; i++) array[startIndex + i] = fPtr[i]; }