no-OS
no_os_units.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _NO_OS_UNITS_H_
40 #define _NO_OS_UNITS_H_
41 
42 /******************************************************************************/
43 /********************** Macros and Constants Definitions **********************/
44 /******************************************************************************/
45 #define PETA 1000000000000000ULL
46 #define TERA 1000000000000ULL
47 #define GIGA 1000000000UL
48 #define MEGA 1000000UL
49 #define KILO 1000UL
50 #define HECTO 100UL
51 #define DECA 10UL
52 #define DECI 10UL
53 #define CENTI 100UL
54 #define MILLI 1000UL
55 #define MICRO 1000000UL
56 #define NANO 1000000000UL
57 #define PICO 1000000000000ULL
58 #define FEMTO 1000000000000000ULL
59 
60 #define HZ_PER_KHZ 1000UL
61 #define KHZ_PER_MHZ 1000UL
62 #define HZ_PER_MHZ 1000000UL
63 
64 #define MILLIWATT_PER_WATT 1000UL
65 #define MICROWATT_PER_MILLIWATT 1000UL
66 #define MICROWATT_PER_WATT 1000000UL
67 
68 
69 /* Returns the given value converted from degree to rad */
70 #define DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
71 
72 /* Returns the given value converted from rad to degree */
73 #define RAD_TO_DEGREE(rad) \
74  (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL)
75 
76 /* Returns the given value converted from g to meter / second**2 */
77 #define G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
78 
79 /* Returns the given value converted from meter / second**2 to g */
80 #define IIO_M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL)
81 
82 #endif // _NO_OS_UNITS_H_