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