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@8:e82e5b78dbbd, 2019-05-06 (annotated)
- Committer:
- gmfortier
- Date:
- Mon May 06 20:26:33 2019 +0000
- Revision:
- 8:e82e5b78dbbd
- Parent:
- 3:29925a0f88da
Second sensor added, can be toggled with blue button on Nucleo. The LD2 LED indicates which sensor configuration is used.; The configurations are not changeable and are meant to be used on the waterbench.
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(); |
gmfortier | 8:e82e5b78dbbd | 35 | void setStartingValue(); |
gmfortier | 8:e82e5b78dbbd | 36 | void resetCycle(); |
Blanglois | 0:265fff2cfb0a | 37 | |
Blanglois | 0:265fff2cfb0a | 38 | #endif |