123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
-
- #ifndef MBED_I2C_SLAVE_H
- #define MBED_I2C_SLAVE_H
-
- #include "platform.h"
-
- #if DEVICE_I2CSLAVE
-
- #include "i2c_api.h"
-
- namespace mbed {
-
-
- class I2CSlave {
-
- public:
- enum RxStatus {
- NoData = 0,
- ReadAddressed = 1,
- WriteGeneral = 2,
- WriteAddressed = 3
- };
-
-
-
- I2CSlave(PinName sda, PinName scl);
-
-
-
- void frequency(int hz);
-
-
-
- int receive(void);
-
-
-
- int read(char *data, int length);
-
-
-
- int read(void);
-
-
-
- int write(const char *data, int length);
-
-
-
- int write(int data);
-
-
-
- void address(int address);
-
-
-
- void stop(void);
-
- protected:
- i2c_t _i2c;
- };
-
- }
-
- #endif
-
- #endif
|