- Timestamp:
- 10/17/07 18:30:26 (15 months ago)
- Location:
- ds1803
- Files:
-
- 2 modified
-
ds1803.cpp (modified) (3 diffs)
-
ds1803.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ds1803/ds1803.cpp
r6 r7 4 4 5 5 #include "../global.h" 6 #include "../configs/ds1803/ds1803.h" 6 7 #include "ds1803.h" 7 8 … … 31 32 Wire.endTransmission(); 32 33 } 33 /* 34 35 #ifdef DS1803_USE_GET_VALUE_FUNC 34 36 uint8_t DS1803::getValue() 35 37 { … … 44 46 return 0; 45 47 } 46 */ 48 #endif -
ds1803/ds1803.h
r6 r7 1 1 #ifndef DS1803_H 2 2 #define DS1803_H 3 #include <inttypes.h> 4 #include "../configs/ds1803/ds1803.h" 3 5 4 #include <inttypes.h> 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 5 15 6 /** 7 * Address byte selection 8 * Select 0 for low and 1 for high 9 **/ 10 #define DS1803_A0 0 11 #define DS1803_A1 0 12 #define DS1803_A2 0 16 #define DS1803_BASE_ADDR B00101000 17 #define DS1803_WADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100) 18 #define DS1803_RADDR DS1803_WADDR | 0x01 13 19 14 #define DS1803_BASE_ADDR B00101000 15 #define DS1803_WADDR DS1803_BASE_ADDR | (DS1803_A0 * B00000001) | (DS1803_A1 * B00000010) | (DS1803_A2 * B00000100) 16 #define DS1803_RADDR DS1803_WADDR | 0x01 20 /** 21 * The number of available potentiometer wipers 22 **/ 23 #define DS1803_NBR_WIPERS 0x02 17 24 18 /** 19 * The number of available potentiometer wipers 20 **/ 21 #define DS1803_NBR_WIPERS 0x02 25 /** 26 * Digital pot selection commands 27 **/ 28 #define DS1803_WIPERS B10101111 29 #define DS1803_WIPER_0 B10101001 30 #define DS1803_WIPER_1 B10101010 22 31 23 /**24 * Digital pot selection commands25 **/26 #define DS1803_WIPERS B10101111 27 #define DS1803_WIPER_0 B10101001 28 #define DS1803_WIPER_1 B10101010 32 /** 33 * Macros 34 **/ 35 #define setWiper1(value) setWiper(value, DS1803_WIPER_0) 36 #define setWiper2(value) setWiper(value, DS1803_WIPER_1) 37 #define setWipers(value) setWiper(value, DS1803_WIPERS) 29 38 30 /** 31 * Macros 32 **/ 33 #define setWiper1(value) setWiper(value, DS1803_WIPER_0) 34 #define setWiper2(value) setWiper(value, DS1803_WIPER_1) 35 #define setWipers(value) setWiper(value, DS1803_WIPERS) 39 /** 40 * DS1803 I2C Dual Digital Pot. 41 **/ 42 class DS1803 43 { 44 public: 45 DS1803(); 46 void setWiper(uint8_t, uint8_t); 47 #ifdef DS1803_USE_GET_VALUE_FUNC 48 uint8_t getValue(); 49 #endif 50 }; 36 51 37 /** 38 * DS1803 I2C Dual Digital Pot. 39 **/ 40 class DS1803 41 { 42 public: 43 DS1803(); 44 void setWiper(uint8_t, uint8_t); 45 //uint8_t getValue(); 46 }; 47 48 /** 49 * Define the object's name 50 **/ 51 extern DS1803 DPOT; 52 /** 53 * Define the object's name 54 **/ 55 extern DS1803 DPOT; 52 56 53 57 #endif