Microchip® Advanced Software Framework

constants.h File Reference

ASF Sensor API Physics Constants.

This module defines commonly used physical constants and conversions in standard units.

Todo:

Investigate replacing numerical library, including constants in this header, with the GNU Scientific Library (GSL) and select pieces of the Boost C++ math and numerics libraries for feature rich application layer code.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

Macros

Physical Constants
#define CONST_AIR_MOLAR_MASS   (0.0289644)
 molar mass of dry air \(\frac{kg}{mol}\) More...
 
#define CONST_BOLTZMANN   (1.2806503e-23)
 Boltzmann constant \(\frac{m^{2} kg}{s^{2} K}\). More...
 
#define CONST_STANDARD_ATM   (1.01325e5)
 standard atmospheric pressure \(\frac{N}{m^{2}}\) More...
 
#define CONST_REAL_GAS   (287.04)
 dry atmospheric air gas constant \(\frac{m^{2}}{s^{2} K}\) More...
 
#define CONST_STANDARD_GRAVITY   (9.80665)
 standard gravity \(\frac{m}{s^{2}}\) More...
 
#define CONST_UNIVERSAL_GAS   (8.31447215)
 ideal gas constant \(\frac{J}{K mol}\) More...
 
#define CONST_UNIVERSAL_GRAVITY   (6.673e-11)
 universal gravitational constant \(\frac{m^{3}}{s^{2} kg}\) More...
 
General Purpose Conversion Constants
#define M_PI   (3.14159265358979323846264338327)
 
#define RAD_TO_DEG   (180 / M_PI)
 radians to degrees More...
 
#define DEG_TO_RAD   (M_PI / 180)
 degrees to radians More...
 
#define GAUSS_TO_MICRO_TESLA   (100)
 \(1 Gauss = 100 \mu T\) More...
 
#define KELVIN_TO_CELSIUS(K)   ((K)-273.15)
 
#define CELSIUS_TO_KELVIN(C)   ((C)+273.15)
 
#define FAHRENHEIT_TO_CELSIUS(F)   (((5 * ((F)-32)) / 9) + 0.5)
 
#define CELSIUS_TO_FAHRENHEIT(C)   ((((9 * (C)) / 5) + 32) + 0.5)
 

#define CELSIUS_TO_FAHRENHEIT (   C)    ((((9 * (C)) / 5) + 32) + 0.5)
#define CELSIUS_TO_KELVIN (   C)    ((C)+273.15)
#define CONST_AIR_MOLAR_MASS   (0.0289644)

molar mass of dry air \(\frac{kg}{mol}\)

#define CONST_BOLTZMANN   (1.2806503e-23)

Boltzmann constant \(\frac{m^{2} kg}{s^{2} K}\).

#define CONST_REAL_GAS   (287.04)

dry atmospheric air gas constant \(\frac{m^{2}}{s^{2} K}\)

#define CONST_STANDARD_ATM   (1.01325e5)

standard atmospheric pressure \(\frac{N}{m^{2}}\)

#define CONST_STANDARD_GRAVITY   (9.80665)

standard gravity \(\frac{m}{s^{2}}\)

#define CONST_UNIVERSAL_GAS   (8.31447215)

ideal gas constant \(\frac{J}{K mol}\)

#define CONST_UNIVERSAL_GRAVITY   (6.673e-11)

universal gravitational constant \(\frac{m^{3}}{s^{2} kg}\)

#define DEG_TO_RAD   (M_PI / 180)

degrees to radians

#define FAHRENHEIT_TO_CELSIUS (   F)    (((5 * ((F)-32)) / 9) + 0.5)
#define GAUSS_TO_MICRO_TESLA   (100)

\(1 Gauss = 100 \mu T\)

Referenced by hmc5883l_get_field(), and hmc5883l_get_heading().

#define KELVIN_TO_CELSIUS (   K)    ((K)-273.15)
#define M_PI   (3.14159265358979323846264338327)
#define RAD_TO_DEG   (180 / M_PI)

radians to degrees