Skip to content

Commit

Permalink
Remove unneeded code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jburhenn committed Nov 18, 2017
1 parent 95688aa commit ea72b34
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions src/CayenneVCNL4000.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
The MIT License(MIT)
Cayenne Arduino Client Library
Copyright © 2016 myDevices
Copyright © 2016 myDevices
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files(the "Software"), to deal in the Software without restriction, including without limitation
Expand Down Expand Up @@ -161,24 +161,13 @@ class VCNL4000
uint8_t data;

Wire.beginTransmission(VCNL4000_ADDRESS);
#if ARDUINO >= 100
Wire.write(address);
#else
Wire.send(address);
#endif
Wire.endTransmission();

delayMicroseconds(170); // delay required

Wire.requestFrom(VCNL4000_ADDRESS, 1);
unsigned int start = millis();
while (!Wire.available() && (millis() - start < TIMEOUT));

#if ARDUINO >= 100
return Wire.read();
#else
return Wire.receive();
#endif
}


Expand All @@ -188,29 +177,13 @@ class VCNL4000
uint16_t data;

Wire.beginTransmission(VCNL4000_ADDRESS);
#if ARDUINO >= 100
Wire.write(address);
#else
Wire.send(address);
#endif
Wire.endTransmission();

Wire.requestFrom(VCNL4000_ADDRESS, 2);
unsigned int start = millis();
while (!Wire.available() && (millis() - start < TIMEOUT));
#if ARDUINO >= 100
data = Wire.read();
data <<= 8;
start = millis();
while (!Wire.available() && (millis() - start < TIMEOUT));
data |= Wire.read();
#else
data = Wire.receive();
data <<= 8;
start = millis();
while (!Wire.available() && (millis() - start < TIMEOUT));
data |= Wire.receive();
#endif

return data;
}
Expand All @@ -219,13 +192,8 @@ class VCNL4000
void write8(uint8_t address, uint8_t data)
{
Wire.beginTransmission(VCNL4000_ADDRESS);
#if ARDUINO >= 100
Wire.write(address);
Wire.write(data);
#else
Wire.send(address);
Wire.send(data);
#endif
Wire.endTransmission();
}

Expand Down

0 comments on commit ea72b34

Please sign in to comment.