-
Notifications
You must be signed in to change notification settings - Fork 3
/
DataConversion.h
36 lines (29 loc) · 1.16 KB
/
DataConversion.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <stdint.h>
class DataConversion
{
public:
/***************************************
Function: floatTofixed()
Purpose: Converts a 5.23 float value to 5-byte HEX and stores it to a buffer
Inputs: float value; Value to convert
uint8_t *buffer; Buffer to store the converted data to
Returns: None
***************************************/
static void floatToFixed(float value, uint8_t* buffer);
/***************************************
Function: intToFixed()
Purpose: Converts a 28.0 integer value to 5-byte HEX and stores it to a buffer
Inputs: int32_t value; Value to convert
uint8_t *buffer; Buffer to store the converted data to
Returns: None
***************************************/
static void intToFixed(int32_t value, uint8_t* buffer);
/***************************************
Function: floatToInt()
Purpose: Converts a 5.23 float value to int 28.0
Inputs: float value; Value to convert
Returns: int32_t; Converted value
***************************************/
static int32_t floatToInt(float value);
};