BeRTOS
mpxx6115a.h
Go to the documentation of this file.
00001 
00046 #ifndef DRV_MPXX6115A_H
00047 #define DRV_MPXX6115A_H
00048 
00049 #include <drv/adc.h>
00050 
00051 #define MPXX6115A_DIV_CONST    0.009f
00052 #define MPXX6115A_ADD_CONST    0.095f
00053 
00054 
00070 INLINE int16_t mpxx6115a_press(adcread_t vout,  adcread_t vref)
00071 {
00072     float tmp;
00073 
00074     tmp = (float)vout/(float)vref  + MPXX6115A_ADD_CONST;
00075 
00076     // To return hpascal we should multiply by 10 because the ratio is in kpascal
00077     return (int16_t)(tmp / MPXX6115A_DIV_CONST * 10);
00078 }
00079 
00080 #endif /* DRV_MPXX6115A_H */