Add handy functions for handling non recurrent timeouts.
[bertos.git] / bertos / drv / lm75.h
index 8c7ee4e35b1cd18ba999323ad23ae66206958b70..e503b6cd977b0263df1c920e7ff9500c2b8b5358 100644 (file)
 
 #include <cpu/types.h>
 
-#define LM75_ADDRESS_BYTE    0x91
-#define LM75_PAD_BYTE        0x0
+#include <drv/ntc.h> // Macro and data type to manage celsius degree
+#include <drv/i2c.h>
 
-typedef int16_t deci_celsius_t;
-typedef uint8_t addr_t;
+#include <cpu/attr.h>
 
-deci_celsius_t lm75_read(addr_t sens_addr);
+#define I2C_READBIT BV(0)
 
-void lm75_init(void);
+#if COMPILER_C99
+       #define lm75_read(...)        PP_CAT(lm75_read ## _, COUNT_PARMS(__VA_ARGS__)) (__VA_ARGS__)
+#else
+       /**
+        * Read temperature from LM75 sensor.
+        *
+        * \note: Do not call this function faster than once every ~200ms, otherwise
+        *        the sensor will not have time to perform conversions and will
+        *        always return the same temperature value.
+        */
+       #define lm75_read(args...)    PP_CAT(lm75_read ## _, COUNT_PARMS(args)) (args)
+#endif
+
+#if !CONFIG_I2C_DISABLE_OLD_API
+
+DEPRECATED deg_t lm75_read_1(uint8_t sens_addr);
+#endif /* !CONFIG_I2C_DISABLE_OLD_API */
+
+deg_t lm75_read_2(I2c *i2c, uint8_t sens_addr);
 
 #endif /* DRV_LM75_H */