Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mDotEVBM2X MTDOT-EVBDemo-DRH MTDOT-BOX-EVB-Factory-Firmware-LIB-108 MTDOT-UDKDemo_Senet ... more
Diff: ISL29011.cpp
- Revision:
- 3:f46f74107f9e
- Parent:
- 2:71053376b55a
- Child:
- 4:c1d5f4999b9e
--- a/ISL29011.cpp Wed Oct 28 17:50:21 2015 +0000
+++ b/ISL29011.cpp Mon Dec 21 10:48:52 2015 -0600
@@ -39,7 +39,9 @@
{
uint8_t result = 0;
+ __disable_irq();
_i2c->frequency(400000);
+ __enable_irq();
// Reset all registers to POR values
result = ISL29011::writeRegister(COMMAND1, 0x00);
@@ -171,9 +173,9 @@
buf[0] = reg;
buf[1] = data;
-// __disable_irq(); // Tickers and other timebase events can jack up the I2C bus for some devices
+ __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
+ __enable_irq(); // Just need to block during the transaction
if(result != 0) {
debug("ISL29011:writeRegister failed\n\r");
@@ -188,18 +190,18 @@
char reg_out[1];
reg_out[0] = reg;
-// __disable_irq(); // Tickers and other timebase events can jack up the I2C bus for some devices
+ __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
+ __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
+ __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
+ __enable_irq(); // Just need to block during the transaction
if(result != 0) {
debug("ISL29011::readRegister failed read\n\r");