Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
I2CSlaveComm.h@3:29925a0f88da, 2018-11-01 (annotated)
- Committer:
- Blanglois
- Date:
- Thu Nov 01 17:43:10 2018 +0000
- Revision:
- 3:29925a0f88da
- Parent:
- 2:d0308b3aaf69
- Child:
- 8:e82e5b78dbbd
Beta version
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Blanglois | 0:265fff2cfb0a | 1 | #ifndef __I2C_SLAVE_COMM__ |
Blanglois | 0:265fff2cfb0a | 2 | #define __I2C_SLAVE_COMM__ |
Blanglois | 0:265fff2cfb0a | 3 | |
Blanglois | 0:265fff2cfb0a | 4 | #define MAX_WRITE_SIZE 8 |
Blanglois | 0:265fff2cfb0a | 5 | #include "mbed.h" |
Blanglois | 0:265fff2cfb0a | 6 | |
Blanglois | 0:265fff2cfb0a | 7 | |
Blanglois | 0:265fff2cfb0a | 8 | class I2CSlaveCustom : public I2CSlave |
Blanglois | 0:265fff2cfb0a | 9 | { |
Blanglois | 0:265fff2cfb0a | 10 | public: |
Blanglois | 0:265fff2cfb0a | 11 | |
Blanglois | 0:265fff2cfb0a | 12 | I2CSlaveCustom(PinName sda, PinName scl) : I2CSlave(sda, scl) |
Blanglois | 0:265fff2cfb0a | 13 | { |
Blanglois | 0:265fff2cfb0a | 14 | |
Blanglois | 0:265fff2cfb0a | 15 | } |
Blanglois | 0:265fff2cfb0a | 16 | |
Blanglois | 0:265fff2cfb0a | 17 | int getCount() |
Blanglois | 0:265fff2cfb0a | 18 | { |
eboily1 | 1:85afd4bd4651 | 19 | int result = _i2c.i2c.handle.XferSize; |
eboily1 | 1:85afd4bd4651 | 20 | if (result > MAX_WRITE_SIZE || result < 0) |
Blanglois | 0:265fff2cfb0a | 21 | return 0; |
Blanglois | 0:265fff2cfb0a | 22 | return result; |
Blanglois | 0:265fff2cfb0a | 23 | } |
Blanglois | 0:265fff2cfb0a | 24 | |
Blanglois | 0:265fff2cfb0a | 25 | |
Blanglois | 0:265fff2cfb0a | 26 | }; |
Blanglois | 0:265fff2cfb0a | 27 | |
Blanglois | 0:265fff2cfb0a | 28 | |
Blanglois | 0:265fff2cfb0a | 29 | void InitI2CSlaveComm(); |
Blanglois | 0:265fff2cfb0a | 30 | void I2CSlaveProcess(); |
eboily1 | 2:d0308b3aaf69 | 31 | void setTension(double value); |
Blanglois | 3:29925a0f88da | 32 | void flow(); |
Blanglois | 3:29925a0f88da | 33 | void cycle(); |
Blanglois | 3:29925a0f88da | 34 | void commandselect(); |
Blanglois | 0:265fff2cfb0a | 35 | |
Blanglois | 0:265fff2cfb0a | 36 | #endif |