X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fdrv%2Flm75.h;h=e503b6cd977b0263df1c920e7ff9500c2b8b5358;hb=e8b0472be10fba4ca6baa62d8d483db90e28c06e;hp=8c7ee4e35b1cd18ba999323ad23ae66206958b70;hpb=2e82814c186e99b012b71ded1803889c9a1bca1f;p=bertos.git diff --git a/bertos/drv/lm75.h b/bertos/drv/lm75.h index 8c7ee4e3..e503b6cd 100644 --- a/bertos/drv/lm75.h +++ b/bertos/drv/lm75.h @@ -45,14 +45,31 @@ #include -#define LM75_ADDRESS_BYTE 0x91 -#define LM75_PAD_BYTE 0x0 +#include // Macro and data type to manage celsius degree +#include -typedef int16_t deci_celsius_t; -typedef uint8_t addr_t; +#include -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 */