Revision 334
added more docs
utils.h | ||
---|---|---|
1 | 1 |
#ifndef UTILS_H_INCLUDED |
2 | 2 |
#define UTILS_H_INCLUDED |
3 | 3 |
|
4 |
#define BCD_FIRST(n) (n >> 4) /** @brief Get first digit (leftmost digit) of 8-bit BCD */ |
|
5 |
#define BCD_SECOND(n) (n & 0x0F) /** @brief Get second digit (rightmost digit) of 8-bit BCD */ |
|
4 |
/** |
|
5 |
* @defgroup utils utils |
|
6 |
* @brief Utilities module. |
|
7 |
* |
|
8 |
* @{ |
|
9 |
*/ |
|
6 | 10 |
|
11 |
/** @brief Get first digit (leftmost digit) of 8-bit BCD */ |
|
12 |
#define BCD_FIRST(n) (n >> 4) |
|
13 |
/** @brief Get second digit (rightmost digit) of 8-bit BCD */ |
|
14 |
#define BCD_SECOND(n) (n & 0x0F) |
|
15 |
|
|
7 | 16 |
/** |
8 | 17 |
* @brief Gets the least significant byte of a 16-bit variable |
9 | 18 |
* @param val 16-bit variable |
... | ... | |
58 | 67 |
int32_t max32(int32_t a, int32_t b); |
59 | 68 |
double dmax (double a, double b); |
60 | 69 |
|
70 |
/** |
|
71 |
* @brief Get the absolute value of a double. |
|
72 |
* @param a Argument |
|
73 |
* @return Absolute value of a |
|
74 |
*/ |
|
61 | 75 |
double dabs(double a); |
62 | 76 |
|
77 |
/** |
|
78 |
* @brief Compare if two doubles are approximately equal (within 1e-10). |
|
79 |
* @param a First value |
|
80 |
* @param b Second value |
|
81 |
* @return true if the two numbers are approximately equal, false otherwise |
|
82 |
*/ |
|
63 | 83 |
int deq(double a, double b); |
64 | 84 |
|
85 |
/** |
|
86 |
* @} |
|
87 |
*/ |
|
88 |
|
|
65 | 89 |
#endif //UTILS_H_INCLUDED |
Also available in: Unified diff