Add handy functions for handling non recurrent timeouts.
[bertos.git] / bertos / drv / lm75.h
index 62e25c7be9cb30f8ed9e92f975908b4cfcb5f9b7..e503b6cd977b0263df1c920e7ff9500c2b8b5358 100644 (file)
 #include <cpu/types.h>
 
 #include <drv/ntc.h> // Macro and data type to manage celsius degree
+#include <drv/i2c.h>
 
-#define LM75_ADDRESS_BYTE    0x91
-#define LM75_PAD_BYTE        0x0
+#include <cpu/attr.h>
 
-deg_t lm75_read(uint8_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 */