hw_ntc.h
Go to the documentation of this file.00001
00091 #ifndef HW_NTC_H
00092 #define HW_NTC_H
00093
00094 #include "ntc_map.h"
00095
00096 #include <cfg/debug.h>
00097
00098 #include <drv/ntc.h>
00099 #include <drv/adc.h>
00100
00101 #warning TODO:This is an example implementation, you must implement it!
00102
00103 extern const res_t NTC_RSER[NTC_CNT];
00104 extern const res_t NTC_RPAR[NTC_CNT];
00105 extern const amp_t NTC_AMP[NTC_CNT];
00106 extern const NtcHwInfo* NTC_INFO[NTC_CNT];
00107
00108
00113 INLINE res_t ntc_hw_read(NtcDev dev)
00114 {
00115 ASSERT(dev < NTC_CNT);
00116
00117 adcread_t adcval = adc_read((uint16_t)dev);
00118 float rp = (adcval * NTC_RSER[dev] ) / ((1 << adc_bits()) * NTC_AMP[dev] - adcval);
00119
00120
00121
00122 return ( (NTC_RPAR[dev] * rp) / (NTC_RPAR[dev] - rp) );
00123 }
00124
00125
00129 INLINE const NtcHwInfo* ntc_hw_getInfo(NtcDev dev)
00130 {
00131 return NTC_INFO[dev];
00132 }
00133
00134 #define NTC_HW_INIT do { } while(0)
00135
00136 #endif