Simple wrapper object for LTC2606 1CH 16Bit DAC. Instantiate DacLtc2606 object instance passing reference to mbed.I2C object instance. Call write() method on DacLtc2606 instance passing 16Bit integer (0 [Off] to 32767/-32768 [Half-On] to -1 [Full-On]) to set DAC output.
Diff: DacLtc2606.h
- Revision:
- 2:d101ca4ae85e
- Parent:
- 1:5924632f3344
--- a/DacLtc2606.h Thu Sep 13 23:10:35 2012 +0000 +++ b/DacLtc2606.h Fri Sep 14 17:23:05 2012 +0000 @@ -32,11 +32,11 @@ */ DacLtc2606(I2C i2c); - /** Set the DAC output to the specifed integer value + /** Set the DAC output to the specifed unsigned short integer value * - * @param value The 16 bit integer to write (0 to 32767 to -32768 to -1) + * @param value The 16 bit integer to write (0 to 65535) */ - bool write(int value); + bool write(unsigned short value); /** Set the DAC output to the specified percentage of max * @@ -44,10 +44,15 @@ */ bool write(double percent); + /** Retreives the unsigned short integer value currently assigned to the DAC output + */ + unsigned short getCurrentValue(); + private: static const char _slave = 0xE4; static const char _command = 0x30; I2C _i2c; + unsigned short _currentValue; }; #endif \ No newline at end of file