You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
730 B
45 lines
730 B
17 years ago
|
#ifndef DS1803_H
|
||
|
#define DS1803_H
|
||
|
|
||
|
#include <inttypes.h>
|
||
|
|
||
|
#define DPOT_WADDR 0x28
|
||
|
#define DPOT_RADDR DPOT_WADDR | 0x01
|
||
|
|
||
|
/**
|
||
|
* The number of available potentiometer wipers
|
||
|
**/
|
||
|
#define DPOT_NBR_WIPERS 0x02
|
||
|
|
||
|
/**
|
||
|
* Digital pot selection commands
|
||
|
**/
|
||
|
#define DPOT_WIPERS B10101111
|
||
|
#define DPOT_WIPER_0 B10101001
|
||
|
#define DPOT_WIPER_1 B10101010
|
||
|
|
||
|
/**
|
||
|
* Macros
|
||
|
**/
|
||
|
#define setWiper1(value) setWiper(value, DPOT_WIPER_0)
|
||
|
#define setWiper2(value) setWiper(value, DPOT_WIPER_1)
|
||
|
#define setWipers(value) setWiper(value, DPOT_WIPERS)
|
||
|
|
||
|
/**
|
||
|
* DS1803 I2C Dual Digital Pot.
|
||
|
**/
|
||
|
class DS1803
|
||
|
{
|
||
|
public:
|
||
|
DS1803();
|
||
|
void setWiper(uint8_t, uint8_t);
|
||
|
//uint8_t getValue();
|
||
|
};
|
||
|
|
||
|
/**
|
||
|
* Define the object's name
|
||
|
**/
|
||
|
extern DS1803 DPOT;
|
||
|
|
||
|
#endif
|