|
Revision 12, 1.1 KB
(checked in by mlalondesvn, 15 months ago)
|
|
DS1624:
ADDED - Support for read/write to the EEPROM
ADDED - DS1624_USE_EEPROM Define in the config to enable eeprom functions
MODIF - Moved the start/stop conversion routine to the start/stopConversion() functions
DS1803 & DS1337:
FIXED - Removed r/w addresses and changed for single address
|
| Line | |
|---|
| 1 | #ifndef DS1803_H |
|---|
| 2 | #define DS1803_H |
|---|
| 3 | #include <inttypes.h> |
|---|
| 4 | #include "../configs/ds1803/ds1803.h" |
|---|
| 5 | |
|---|
| 6 | #ifdef DS1803_A0 |
|---|
| 7 | #define DS1803_A0 0 |
|---|
| 8 | #endif |
|---|
| 9 | #ifdef DS1803_A1 |
|---|
| 10 | #define DS1803_A1 0 |
|---|
| 11 | #endif |
|---|
| 12 | #ifdef DS1803_A2 |
|---|
| 13 | #define DS1803_A2 0 |
|---|
| 14 | #endif |
|---|
| 15 | |
|---|
| 16 | #define DS1803_BASE_ADDR B00101000 |
|---|
| 17 | #define DS1803_ADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100) |
|---|
| 18 | |
|---|
| 19 | /** |
|---|
| 20 | * The number of available potentiometer wipers |
|---|
| 21 | **/ |
|---|
| 22 | #define DS1803_NBR_WIPERS 0x02 |
|---|
| 23 | |
|---|
| 24 | /** |
|---|
| 25 | * Digital pot selection commands |
|---|
| 26 | **/ |
|---|
| 27 | #define DS1803_WIPERS B10101111 |
|---|
| 28 | #define DS1803_WIPER_0 B10101001 |
|---|
| 29 | #define DS1803_WIPER_1 B10101010 |
|---|
| 30 | |
|---|
| 31 | /** |
|---|
| 32 | * Macros |
|---|
| 33 | **/ |
|---|
| 34 | #define setWiper1(value) setWiper(value, DS1803_WIPER_0) |
|---|
| 35 | #define setWiper2(value) setWiper(value, DS1803_WIPER_1) |
|---|
| 36 | #define setWipers(value) setWiper(value, DS1803_WIPERS) |
|---|
| 37 | |
|---|
| 38 | /** |
|---|
| 39 | * DS1803 I2C Dual Digital Pot. |
|---|
| 40 | **/ |
|---|
| 41 | class DS1803 |
|---|
| 42 | { |
|---|
| 43 | public: |
|---|
| 44 | DS1803(); |
|---|
| 45 | void setWiper(uint8_t, uint8_t); |
|---|
| 46 | #ifdef DS1803_USE_GET_VALUE_FUNC |
|---|
| 47 | uint8_t getValue(); |
|---|
| 48 | #endif |
|---|
| 49 | }; |
|---|
| 50 | |
|---|
| 51 | /** |
|---|
| 52 | * Define the object's name |
|---|
| 53 | **/ |
|---|
| 54 | extern DS1803 DPOT; |
|---|
| 55 | |
|---|
| 56 | #endif |
|---|