Skip to content

Commit a30da7e

Browse files
author
deepikabhavnani
committed
I2CReset is not required as I2C driver does the recovery before init
1 parent ccb08a3 commit a30da7e

File tree

2 files changed

+2
-32
lines changed

2 files changed

+2
-32
lines changed

components/802.15.4_RF/atmel-rf-driver/source/at24mac.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,9 @@
2929
#define EUI64_LEN 8
3030
#define EUI48_LEN 6
3131

32-
AT24Mac::I2CReset::I2CReset(PinName sda, PinName scl)
33-
{
34-
mbed::DigitalInOut pin_sda(sda, PIN_OUTPUT, PullUp, 1);
35-
mbed::DigitalInOut pin_scl(scl, PIN_OUTPUT, PullUp, 0);
36-
//generate 9 clocks for worst-case scenario
37-
for (int i = 0; i < 10; ++i) {
38-
pin_scl = 1;
39-
wait_us(5);
40-
pin_scl = 0;
41-
wait_us(5);
42-
}
43-
//generate a STOP condition
44-
pin_sda = 0;
45-
wait_us(5);
46-
pin_scl = 1;
47-
wait_us(5);
48-
pin_sda = 1;
49-
wait_us(5);
50-
}
32+
using namespace mbed;
5133

52-
/*I2C needs to be reset before constructing the I2C object (in case I2C is stuck)
53-
because they use the same pins, therefore i2c_reset has to be before _i2c
54-
in the initializer list*/
55-
AT24Mac::AT24Mac(PinName sda, PinName scl) : i2c_reset(sda, scl), _i2c(sda, scl)
34+
AT24Mac::AT24Mac(PinName sda, PinName scl) : _i2c(sda , scl)
5635
{
5736
// Do nothing
5837
}

components/802.15.4_RF/atmel-rf-driver/source/at24mac.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ class AT24Mac {
5959
int read_eui48(void *buf);
6060

6161
private:
62-
/*
63-
* Dummy class to allow us to reset I2C before the I2C constructor is called in
64-
* the initializer list of AT24Mac's constructor
65-
*/
66-
class I2CReset {
67-
public:
68-
I2CReset(PinName sda, PinName scl);
69-
};
70-
I2CReset i2c_reset;
7162
mbed::I2C _i2c;
7263
};
7364

0 commit comments

Comments
 (0)