|
Revision 12, 0.8 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 | extern "C" { |
|---|
| 2 | #include <Wire/Wire.h> |
|---|
| 3 | } |
|---|
| 4 | |
|---|
| 5 | #include "../global.h" |
|---|
| 6 | #include "../configs/ds1803/ds1803.h" |
|---|
| 7 | #include "ds1803.h" |
|---|
| 8 | |
|---|
| 9 | DS1803::DS1803() |
|---|
| 10 | { |
|---|
| 11 | #ifdef WIRE_LIB_SCAN_MOD |
|---|
| 12 | /*if (!Wire.isStarted())*/ Wire.begin(); |
|---|
| 13 | #else |
|---|
| 14 | Wire.begin(); |
|---|
| 15 | #endif |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | /** |
|---|
| 19 | * Instantiate the object |
|---|
| 20 | **/ |
|---|
| 21 | DS1803 DPOT = DS1803(); |
|---|
| 22 | |
|---|
| 23 | void DS1803::setWiper(uint8_t value, uint8_t wiperAddr) |
|---|
| 24 | { |
|---|
| 25 | if (!Wire.checkAddress(DS1803_ADDR)) return; |
|---|
| 26 | |
|---|
| 27 | Wire.beginTransmission(DS1803_ADDR); |
|---|
| 28 | Wire.send(wiperAddr); // Send the wiper address |
|---|
| 29 | |
|---|
| 30 | Wire.send(value); |
|---|
| 31 | |
|---|
| 32 | Wire.endTransmission(); |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | #ifdef DS1803_USE_GET_VALUE_FUNC |
|---|
| 36 | uint8_t DS1803::getValue() |
|---|
| 37 | { |
|---|
| 38 | if (!Wire.checkAddress(DS1803_ADDR)) return; |
|---|
| 39 | |
|---|
| 40 | Wire.requestFrom(DS1803_ADDR, 2); |
|---|
| 41 | |
|---|
| 42 | while (Wire.available()) { |
|---|
| 43 | Serial.println((uint8_t)Wire.receive(), DEC); |
|---|
| 44 | } |
|---|
| 45 | |
|---|
| 46 | return 0; |
|---|
| 47 | } |
|---|
| 48 | #endif |
|---|