Plese use this class with my "i2cslave" class.

Dependents:   2016_mother_3 WRS2019_master WRS2020_mecanum_node WRS2021_mecanum_driver

Committer:
sgrsn
Date:
Sat Apr 16 04:43:42 2016 +0000
Revision:
1:f5811e90881f
Parent:
0:8c3f6ccf349c
I2C_Master class
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sgrsn 0:8c3f6ccf349c 1 #ifndef MBED_I2CMASTER_H
sgrsn 0:8c3f6ccf349c 2 #define MBED_I2CMASTER_H
sgrsn 0:8c3f6ccf349c 3
sgrsn 0:8c3f6ccf349c 4 #include "mbed.h"
sgrsn 0:8c3f6ccf349c 5
sgrsn 1:f5811e90881f 6 /*example**********************************
sgrsn 1:f5811e90881f 7 * #include "mbed.h"
sgrsn 1:f5811e90881f 8 * #include "i2cmaster.h"
sgrsn 1:f5811e90881f 9 *
sgrsn 1:f5811e90881f 10 * int main()
sgrsn 1:f5811e90881f 11 * {
sgrsn 1:f5811e90881f 12 * i2c myi2c(p9, p10);
sgrsn 1:f5811e90881f 13 * while(1)
sgrsn 1:f5811e90881f 14 * {
sgrsn 1:f5811e90881f 15 * myi2c.put(0xa0, 1 20, 1);
sgrsn 1:f5811e90881f 16 * wait(0.1);
sgrsn 1:f5811e90881f 17 * myi2c.put(0xa0, 1 0, 1);
sgrsn 1:f5811e90881f 18 * wait(0.1);
sgrsn 1:f5811e90881f 19 * }
sgrsn 1:f5811e90881f 20 * }
sgrsn 1:f5811e90881f 21 ********************************************/
sgrsn 1:f5811e90881f 22
sgrsn 1:f5811e90881f 23 class i2c : public I2C
sgrsn 0:8c3f6ccf349c 24 {
sgrsn 0:8c3f6ccf349c 25 public:
sgrsn 1:f5811e90881f 26 i2c(PinName sda,PinName scl);
sgrsn 0:8c3f6ccf349c 27
sgrsn 0:8c3f6ccf349c 28 bool put(char addr,char reg, char data ,int size);
sgrsn 0:8c3f6ccf349c 29 };
sgrsn 0:8c3f6ccf349c 30
sgrsn 0:8c3f6ccf349c 31 #endif