X-Git-Url: https://git.smho.de/gw/?p=owSlave2.git;a=blobdiff_plain;f=common%2FI2C%2FMAX44009.c;h=426098e84afd0ab4172916f54eedd48aa905204c;hp=8ec682d5cef1ee0cf6011d6d465be84d58921737;hb=4df4c7ba2c95a48e95873b1f3a93d62ed9727eba;hpb=28c2911a7459ae2977c0cb0228c0ca2af1c345bf diff --git a/common/I2C/MAX44009.c b/common/I2C/MAX44009.c index 8ec682d..426098e 100644 --- a/common/I2C/MAX44009.c +++ b/common/I2C/MAX44009.c @@ -38,6 +38,22 @@ #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;