#include #include // DS2438 1-wire commands #define DS2438_READSP 0xBE #define DS2438_WRITESP 0x4E #define DS2438_COPYSP 0x48 #define DS2438_RECALL 0xB8 #define DS2438_CONV_T 0x44 #define DS2438_CONV_V 0xB4 // DS2438 configuration flags // IAD: Enable current-measurement ADC #define DS2438_CONF_IAD 0x01 // CA: Enable current accumulator #define DS2438_CONF_CA 0x02 // EE: Store current accumulator in EEPROM #define DS2438_CONF_EE 0x04 // AD: 0 = measure VAD, 1 = measure VDD #define DS2438_CONF_AD 0x08 // TB: Temperature conversion in progress #define DS2438_CONF_TB 0x10 // NVB: EEPROM write in progress #define DS2438_CONF_NVB 0x20 // ADB: Voltage conversion in progress #define DS2438_CONF_ADB 0x40 bool ds2438_readsp(const struct owaddr *addr, int page, unsigned char *buf); bool ds2438_writesp(const struct owaddr *addr, int page, const unsigned char *buf); bool ds2438_config(const struct owaddr *addr, unsigned char config); float ds2438_temperature(const struct owaddr *addr); float ds2438_humidity(const struct owaddr *addr);