BeRTOS
tmp123.c
Go to the documentation of this file.
00001 
00039 #include "tmp123.h"
00040 
00041 #include "hw/hw_tmp123.h"
00042 
00043 #include <cfg/module.h>
00044 
00045 #include <cpu/byteorder.h>
00046 
00047 #include <io/kfile.h>
00048 
00049 #include <drv/ntc.h> // Macro and data type to manage celsius degree
00050 
00054 deg_t tmp123_read(KFile *fd)
00055 {
00056     int16_t tmp;
00057 
00058     TMP123_HW_CS_EN();
00059     kfile_read(fd, &tmp, sizeof(tmp));
00060     tmp = be16_to_cpu(tmp);
00061     TMP123_HW_CS_DIS();
00062 
00063     tmp >>= 3;
00064     return DIV_ROUND((tmp * 10), 16);
00065 }
00069 void tmp123_init(void)
00070 {
00071     TMP123_HW_INIT();
00072 }
00073 
00074