hadif azli
/
TEST123
BLYNK TEST
I2Cdev.h@2:6cd3b0947188, 2016-06-15 (annotated)
- Committer:
- lixianyu
- Date:
- Wed Jun 15 03:08:40 2016 +0000
- Revision:
- 2:6cd3b0947188
- Child:
- 3:4cd9171ba989
PM2.5????????5V??????????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lixianyu | 2:6cd3b0947188 | 1 | #ifndef _I2CDEV_H_ |
lixianyu | 2:6cd3b0947188 | 2 | #define _I2CDEV_H_ |
lixianyu | 2:6cd3b0947188 | 3 | #include "mbed.h" |
lixianyu | 2:6cd3b0947188 | 4 | |
lixianyu | 2:6cd3b0947188 | 5 | #define I2CDEV_DEFAULT_READ_TIMEOUT 1000 |
lixianyu | 2:6cd3b0947188 | 6 | class I2Cdev { |
lixianyu | 2:6cd3b0947188 | 7 | public: |
lixianyu | 2:6cd3b0947188 | 8 | I2Cdev(); |
lixianyu | 2:6cd3b0947188 | 9 | |
lixianyu | 2:6cd3b0947188 | 10 | static void init(); |
lixianyu | 2:6cd3b0947188 | 11 | static int8_t readBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 12 | static int8_t readBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 13 | static int8_t readBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 14 | static int8_t readBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 15 | static int8_t readByte(uint8_t devAddr, uint8_t regAddr, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 16 | static int8_t readWord(uint8_t devAddr, uint8_t regAddr, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 17 | static int8_t readBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 18 | static int8_t readBytesOnly(uint8_t devAddr, uint8_t length, uint8_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 19 | static int8_t readWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data, uint16_t timeout=I2Cdev::readTimeout); |
lixianyu | 2:6cd3b0947188 | 20 | |
lixianyu | 2:6cd3b0947188 | 21 | static bool writeBit(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint8_t data); |
lixianyu | 2:6cd3b0947188 | 22 | static bool writeBitW(uint8_t devAddr, uint8_t regAddr, uint8_t bitNum, uint16_t data); |
lixianyu | 2:6cd3b0947188 | 23 | static bool writeBits(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint8_t data); |
lixianyu | 2:6cd3b0947188 | 24 | static bool writeBitsW(uint8_t devAddr, uint8_t regAddr, uint8_t bitStart, uint8_t length, uint16_t data); |
lixianyu | 2:6cd3b0947188 | 25 | static bool writeByte(uint8_t devAddr, uint8_t regAddr, uint8_t data); |
lixianyu | 2:6cd3b0947188 | 26 | static bool writeWord(uint8_t devAddr, uint8_t regAddr, uint16_t data); |
lixianyu | 2:6cd3b0947188 | 27 | static bool writeBytes(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint8_t *data); |
lixianyu | 2:6cd3b0947188 | 28 | static bool writeWords(uint8_t devAddr, uint8_t regAddr, uint8_t length, uint16_t *data); |
lixianyu | 2:6cd3b0947188 | 29 | |
lixianyu | 2:6cd3b0947188 | 30 | static uint16_t readTimeout; |
lixianyu | 2:6cd3b0947188 | 31 | }; |
lixianyu | 2:6cd3b0947188 | 32 | |
lixianyu | 2:6cd3b0947188 | 33 | #endif /* _I2CDEV_H_ */ |