Library for LoRa communication using MultiTech MDOT.
Fork of libmDot by
MTS-Utils/Utils.h@11:9938ba31d428, 2016-03-29 (annotated)
- Committer:
- Mike Fiore
- Date:
- Tue Mar 29 10:18:28 2016 -0500
- Revision:
- 11:9938ba31d428
- Parent:
- 9:ebf682e616d0
update to version 1.0.7 of mDot library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Mike Fiore |
1:9f30fbe9e9c1 | 1 | #ifndef UTILS_H |
Mike Fiore |
1:9f30fbe9e9c1 | 2 | #define UTILS_H |
Mike Fiore |
1:9f30fbe9e9c1 | 3 | |
Mike Fiore |
1:9f30fbe9e9c1 | 4 | #include <string> |
Mike Fiore |
1:9f30fbe9e9c1 | 5 | |
Mike Fiore |
1:9f30fbe9e9c1 | 6 | //Defines a max function that can be used. |
Mike Fiore |
1:9f30fbe9e9c1 | 7 | inline int mts_max(int a, int b) { return a > b ? a : b; } |
Mike Fiore |
1:9f30fbe9e9c1 | 8 | |
Mike Fiore |
1:9f30fbe9e9c1 | 9 | //Defines a min function that can be used. |
Mike Fiore |
1:9f30fbe9e9c1 | 10 | inline int mts_min(int a, int b) { return a < b ? a : b; } |
Mike Fiore |
1:9f30fbe9e9c1 | 11 | |
Mike Fiore |
1:9f30fbe9e9c1 | 12 | ///An enumeration for relational operators |
Mike Fiore |
1:9f30fbe9e9c1 | 13 | enum RelationalOperator { |
Mike Fiore |
1:9f30fbe9e9c1 | 14 | GREATER, LESS, EQUAL, GREATER_EQUAL, LESS_EQUAL |
Mike Fiore |
1:9f30fbe9e9c1 | 15 | }; |
Mike Fiore |
1:9f30fbe9e9c1 | 16 | |
Mike Fiore |
1:9f30fbe9e9c1 | 17 | /** A static method for getting a string representation for the RelationalOperator |
Mike Fiore |
1:9f30fbe9e9c1 | 18 | * enumeration. |
Mike Fiore |
1:9f30fbe9e9c1 | 19 | * |
Mike Fiore |
1:9f30fbe9e9c1 | 20 | * @param relationalOperator a RelationalOperator enumeration. |
Mike Fiore |
1:9f30fbe9e9c1 | 21 | * @returns the enumeration name as a string. |
Mike Fiore |
1:9f30fbe9e9c1 | 22 | */ |
Mike Fiore |
11:9938ba31d428 | 23 | static inline std::string getRelationalOperatorNames(RelationalOperator relationalOperator) |
Mike Fiore |
1:9f30fbe9e9c1 | 24 | { |
Mike Fiore |
1:9f30fbe9e9c1 | 25 | switch(relationalOperator) { |
Mike Fiore |
1:9f30fbe9e9c1 | 26 | case GREATER: |
Mike Fiore |
1:9f30fbe9e9c1 | 27 | return "GREATER"; |
Mike Fiore |
1:9f30fbe9e9c1 | 28 | case LESS: |
Mike Fiore |
1:9f30fbe9e9c1 | 29 | return "LESS"; |
Mike Fiore |
1:9f30fbe9e9c1 | 30 | case EQUAL: |
Mike Fiore |
1:9f30fbe9e9c1 | 31 | return "EQUAL"; |
Mike Fiore |
1:9f30fbe9e9c1 | 32 | case GREATER_EQUAL: |
Mike Fiore |
1:9f30fbe9e9c1 | 33 | return "GREATER_EQUAL"; |
Mike Fiore |
1:9f30fbe9e9c1 | 34 | case LESS_EQUAL: |
Mike Fiore |
1:9f30fbe9e9c1 | 35 | return "LESS_EQUAL"; |
Mike Fiore |
1:9f30fbe9e9c1 | 36 | default: |
Mike Fiore |
1:9f30fbe9e9c1 | 37 | return "UNKNOWN ENUM"; |
Mike Fiore |
1:9f30fbe9e9c1 | 38 | } |
Mike Fiore |
1:9f30fbe9e9c1 | 39 | } |
Mike Fiore |
1:9f30fbe9e9c1 | 40 | |
Mike Fiore |
1:9f30fbe9e9c1 | 41 | #endif |