-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCanUtility.h
More file actions
44 lines (39 loc) · 1.08 KB
/
Copy pathCanUtility.h
File metadata and controls
44 lines (39 loc) · 1.08 KB
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
37
38
39
40
41
42
43
44
/****************************************************************************************
*
* File:
* CanUtility.h
*
* Purpose:
*
* Developer Notes:
* Created by dkarlsso on 2018-04-12
*
***************************************************************************************/
#ifndef SAILINGROBOT_UTILITY_H
#define SAILINGROBOT_UTILITY_H
#include <stdint.h>
class CanUtility {
public:
/*
* To map
* [A, B] --> [a, b]
*
* use this formula
* (val - A)*(b-a)/(B-A) + a
*
* Note: This function has to be kept identical to the corresponding
* Arduino-function (also, it has no bracketing but is essentially a linear
* projection)
*/
static float mapInterval(float val, float fromMin, float fromMax, float toMin, float toMax);
/**
* Calculates maxvalue of a no of bytes.
*
* Eg. 1 byte --> 256 and so on (should be 255?)
*
* @param noOfBytes
* @return The maximum value of the given no of bytes
*/
static uint64_t calcSizeOfBytes(int noOfBytes);
};
#endif // SAILINGROBOT_UTILITY_H