/** * \file * * * \brief TMP123 Texas Intrument sensor temperature. * * \author Daniele Basile * */ #include "tmp123.h" #include "hw/hw_tmp123.h" #include #include #include #include // Macro and data type to manage celsius degree /** * Read temperature from TMP123 chip. */ deg_t tmp123_read(KFile *fd) { int16_t tmp; TMP123_HW_CS_EN(); kfile_read(fd, &tmp, sizeof(tmp)); tmp = be16_to_cpu(tmp); TMP123_HW_CS_DIS(); tmp >>= 3; return DIV_ROUND((tmp * 10), 16); } /** * Init module */ void tmp123_init(void) { TMP123_HW_INIT(); }