Interface to Analog devices AD5258 digital I2C potentiometer

AD5258.h

Committer:
RodColeman
Date:
2013-11-11
Revision:
0:8920c7d857d8
Child:
1:64570234d7b5

File content as of revision 0:8920c7d857d8:

#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