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.
57 lines
1.1 KiB
57 lines
1.1 KiB
#ifndef DS1803_H
|
|
#define DS1803_H
|
|
#include <inttypes.h>
|
|
#include "../configs/ds1803/ds1803.h"
|
|
|
|
#ifdef DS1803_A0
|
|
#define DS1803_A0 0
|
|
#endif
|
|
#ifdef DS1803_A1
|
|
#define DS1803_A1 0
|
|
#endif
|
|
#ifdef DS1803_A2
|
|
#define DS1803_A2 0
|
|
#endif
|
|
|
|
#define DS1803_BASE_ADDR B00101000
|
|
#define DS1803_ADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100)
|
|
|
|
/**
|
|
* The number of available potentiometer wipers
|
|
**/
|
|
#define DS1803_NBR_WIPERS 0x02
|
|
|
|
/**
|
|
* Digital pot selection commands
|
|
**/
|
|
#define DS1803_WIPERS B10101111
|
|
#define DS1803_WIPER_0 B10101001
|
|
#define DS1803_WIPER_1 B10101010
|
|
|
|
/**
|
|
* Macros
|
|
**/
|
|
#define setWiper1(value) setWiper(value, DS1803_WIPER_0)
|
|
#define setWiper2(value) setWiper(value, DS1803_WIPER_1)
|
|
#define setWipers(value) setWiper(value, DS1803_WIPERS)
|
|
|
|
/**
|
|
* DS1803 I2C Dual Digital Pot.
|
|
**/
|
|
class DS1803
|
|
{
|
|
public:
|
|
DS1803();
|
|
void setWiper(uint8_t, uint8_t);
|
|
#ifdef DS1803_USE_GET_VALUE_FUNC
|
|
uint8_t getValue();
|
|
#endif
|
|
};
|
|
|
|
/**
|
|
* Define the object's name
|
|
**/
|
|
extern DS1803 DPOT;
|
|
|
|
#endif
|