Class module for ISL29011 Ambient Light Sensor
Dependents: mDotEVBM2X MTDOT-EVBDemo-DRH MTDOT-BOX-EVB-Factory-Firmware-LIB-108 MTDOT-UDKDemo_Senet ... more
Diff: ISL29011.cpp
- Revision:
- 4:c1d5f4999b9e
- Parent:
- 3:f46f74107f9e
- Child:
- 5:953adca17438
--- a/ISL29011.cpp Mon Dec 21 10:48:52 2015 -0600 +++ b/ISL29011.cpp Thu Oct 06 14:35:26 2016 +0000 @@ -39,9 +39,7 @@ { uint8_t result = 0; - __disable_irq(); _i2c->frequency(400000); - __enable_irq(); // Reset all registers to POR values result = ISL29011::writeRegister(COMMAND1, 0x00); @@ -173,9 +171,7 @@ buf[0] = reg; buf[1] = data; - __disable_irq(); // Tickers and other timebase events can jack up the I2C bus for some devices result |= _i2c->write(_i2c_addr, buf, 2); - __enable_irq(); // Just need to block during the transaction if(result != 0) { debug("ISL29011:writeRegister failed\n\r"); @@ -190,18 +186,14 @@ char reg_out[1]; reg_out[0] = reg; - __disable_irq(); // Tickers and other timebase events can jack up the I2C bus for some devices result |= _i2c->write(_i2c_addr,reg_out,1,true); - __enable_irq(); // Just need to block during the transaction if(result != 0) { debug("ISL29011::readRegister failed write\n\r"); return result; } - __disable_irq(); // Tickers and other timebase events can jack up the I2C bus for some devices result |= _i2c->read(_i2c_addr,data,count,false); - __enable_irq(); // Just need to block during the transaction if(result != 0) { debug("ISL29011::readRegister failed read\n\r");