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 MILLIVOLT_PER_VOLT 1000UL
65 #define MICROVOLT_PER_VOLT 1000000UL
66 #define NANOVOLT_PER_VOLT 1000000000ULL
67 
68 #define MILLIAMPER_PER_AMPER 1000UL
69 #define MICROAMPER_PER_MILLIAMPER 1000UL
70 #define MICROAMPER_PER_AMPER 1000000UL
71 #define NANOAMPER_PER_AMPER 1000000000ULL
72 
73 #define MILLIWATT_PER_WATT 1000UL
74 #define MICROWATT_PER_MILLIWATT 1000UL
75 #define MICROWATT_PER_WATT 1000000UL
76 
77 #define MILLIDEGREE_PER_DEGREE 1000UL
78 
79 /* Returns the given value converted from degree to rad */
80 #define DEGREE_TO_RAD(deg) (((deg) * 314159ULL + 9000000ULL) / 18000000ULL)
81 
82 /* Returns the given value converted from rad to degree */
83 #define RAD_TO_DEGREE(rad) \
84  (((rad) * 18000000ULL + 314159ULL / 2) / 314159ULL)
85 
86 /* Returns the given value converted from g to meter / second**2 */
87 #define G_TO_M_S_2(g) ((g) * 980665ULL / 100000ULL)
88 
89 /* Returns the given value converted from meter / second**2 to g */
90 #define M_S_2_TO_G(ms2) (((ms2) * 100000ULL + 980665ULL / 2) / 980665ULL)
91 
92 #endif // _NO_OS_UNITS_H_