Interface to Analog devices AD5258 digital I2C potentiometer
Diff: AD5258.h
- Revision:
- 0:8920c7d857d8
- Child:
- 1:64570234d7b5
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AD5258.h Mon Nov 11 11:00:35 2013 +0000 @@ -0,0 +1,35 @@ +#include "mbed.h" + +#ifndef MBED_AD5258_H +#define MBED_AD5258_H + +// Interface to the AD5258 I2C 6-Bit digital Potentiometer + +class AD5258 { +public: + /** Create an instance of the AD5258 connected to specfied I2C pins, with the specified address. + * + * @param sda The I2C data pin + * @param scl The I2C clock pin + * @param address The I2C address for this AD5258 + */ + AD5258(PinName sda, PinName scl, int address); + + /** Read the RDAC value + * + * @return The 6-bit value read + */ + int read(); + + /** Write to the IO pins + * + * @param data The 6-bits value: 0x00 to 0x3F to write to the pots RDAC + */ + void write(int data); + +private: + I2C _i2c; + int _address; +}; + +#endif \ No newline at end of file