enhancing Multitech's library for some accelerometer

Fork of MMA845x by Multi-Hackers

Revision:
4:4ff1650da84c
Parent:
3:7c2fbf79f607
Child:
5:d662a7003b6f
--- a/MMA845x.cpp	Mon Dec 21 10:49:15 2015 -0600
+++ b/MMA845x.cpp	Mon Oct 17 08:38:38 2016 -0500
@@ -50,9 +50,7 @@
     uint8_t i = 0;
     char reg_val[1];
 
-    __disable_irq();
     _i2c->frequency(100000);
-    __enable_irq();
     _who_am_i = 0x00;
 
     // Reset all registers to POR values
@@ -290,9 +288,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("MMA845x:writeRegister failed r-%d\n\r",result);
@@ -307,18 +303,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("MMA845x::readRegister failed write r- %d\n\r", result);
         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("MMA845x::readRegister failed read r-%d\n\r",result);