sakthi priya amirtharaj
/
BAE_vr2_1_3
i2c working with old hk
Fork of BAE_vr2_1_1 by
Diff: slave.cpp
- Revision:
- 1:b4bb78a9b92e
- Parent:
- 0:8b0d43fe6c05
- Child:
- 3:02b45de29c0f
diff -r 8b0d43fe6c05 -r b4bb78a9b92e slave.cpp --- a/slave.cpp Wed Sep 10 06:41:21 2014 +0000 +++ b/slave.cpp Tue Dec 02 04:38:19 2014 +0000 @@ -2,7 +2,7 @@ #include "HK.h" extern struct SensorData Sensor; -I2CSlave slave(A4,A5); //configuring pins p27, p28 as I2Cslave +I2CSlave slave(PTC9,PTC8); //configuring pins p27, p28 as I2Cslave Serial screen (USBTX,USBRX); void write_to_master(char send) //function to write data to master { @@ -41,6 +41,7 @@ //to read data from master if(slave.receive()==WriteGeneral) //checking if slave is addressed to write { + slave.stop(); Switch_Variable=slave.read(); //receiving data screen.printf("switch variable=%d\n",Switch_Variable); slave.stop(); //reset slave to default receiving state