Change Slave sends '0' during convert prozess on all DS18B20
[owSlave2.git] / common / I2C / MAX44009.c
index 8ec682d..426098e 100644 (file)
 #include "USI_TWI_Master.h"
 #include "MAX44009.h"
 
+uint8_t checkMAX44009(uint8_t nr) {
+       volatile uint8_t b1;
+       nr=(nr<<1)&0x02f;
+       
+       I2c_StartCondition();
+       I2c_WriteByte(0b10010100|nr);
+       I2c_WriteByte(0x03);
+       I2c_StartCondition();
+       I2c_WriteByte (0b10010101|nr);
+       b1 =I2c_ReadByte(NO_ACK);
+       I2c_StopCondition();
+       return b1!=0xFF;
+       
+}
+
+
 double MAX44009getlux(uint8_t nr)  {
        volatile uint8_t b1,b2;
        nr=(nr<<1)&0x02f;