Plese use this class with my "i2cslave" class.
Dependents: 2016_mother_3 WRS2019_master WRS2020_mecanum_node WRS2021_mecanum_driver
Diff: i2cmaster.h
- Revision:
- 1:f5811e90881f
- Parent:
- 0:8c3f6ccf349c
diff -r 8c3f6ccf349c -r f5811e90881f i2cmaster.h --- a/i2cmaster.h Sat Apr 16 04:23:13 2016 +0000 +++ b/i2cmaster.h Sat Apr 16 04:43:42 2016 +0000 @@ -3,10 +3,27 @@ #include "mbed.h" -class i2c : public I2C//,DigitalOut +/*example********************************** +* #include "mbed.h" +* #include "i2cmaster.h" +* +* int main() +* { +* i2c myi2c(p9, p10); +* while(1) +* { +* myi2c.put(0xa0, 1 20, 1); +* wait(0.1); +* myi2c.put(0xa0, 1 0, 1); +* wait(0.1); +* } +* } +********************************************/ + +class i2c : public I2C { public: - i2c(PinName p1,PinName p2); + i2c(PinName sda,PinName scl); bool put(char addr,char reg, char data ,int size); };