0.2.0 AD5246

This commit is contained in:
Rob Tillaart 2023-12-06 15:53:56 +01:00
parent fece68bb45
commit 0f04b5ba8c
10 changed files with 35 additions and 37 deletions

View File

@ -1,7 +1,7 @@
//
// FILE: AD5246.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.2.0
// PURPOSE: Arduino Library for AD5246, I2C 128 step rheostat.
// DATE: 2023-08-02
// URL: https://github.com/RobTillaart/AD5246
@ -14,29 +14,13 @@ AD5246::AD5246(TwoWire *wire)
{
// fixed address 0x2E.
_wire = wire;
_lastValue = AD5246_MIDPOINT; // power on reset => mid position
// power on reset => mid position
_lastValue = AD5246_MIDPOINT;
}
#if defined (ESP8266) || defined(ESP32)
bool AD5246::begin(uint8_t dataPin, uint8_t clockPin)
{
if ((dataPin < 255) && (clockPin < 255))
{
_wire->begin(dataPin, clockPin);
} else {
_wire->begin();
}
if (! isConnected()) return false;
reset();
return true;
}
#endif
bool AD5246::begin()
{
_wire->begin();
if (! isConnected()) return false;
reset();
return true;

View File

@ -2,7 +2,7 @@
//
// FILE: AD5246.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.1
// VERSION: 0.2.0
// PURPOSE: Arduino Library for AD5246, I2C 128 step rheostat.
// DATE: 2023-08-02
// URL: https://github.com/RobTillaart/AD5246
@ -14,7 +14,7 @@
#include "Wire.h"
#define AD5246_LIB_VERSION (F("0.1.1"))
#define AD5246_LIB_VERSION (F("0.2.0"))
#define AD5246_OK 0
@ -28,9 +28,6 @@ class AD5246
public:
explicit AD5246(TwoWire *wire = &Wire);
#if defined (ESP8266) || defined(ESP32)
bool begin(uint8_t sda, uint8_t scl);
#endif
bool begin();
bool isConnected();

View File

@ -6,11 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.2.0] - 2023-12-06
- refactor API, begin()
- update readme.md
----
## [0.1.1] - 2023-09-21
- add Wire1 support for ESP32
- update readme.md
## [0.1.0] - 2023-08-02
- initial version

View File

@ -35,15 +35,28 @@ An important property is that the device defaults to the mid-scale position at s
One can use **AD5246_MIDPOINT** == 64 to reset to the mid-scale position.
#### 0.2.0 Breaking change
Version 0.2.0 introduced a breaking change.
You cannot set the pins in **begin()** any more.
This reduces the dependency of processor dependent Wire implementations.
The user has to call **Wire.begin()** and can optionally set the Wire pins
before calling **begin()**.
#### Related
This library is based upon the AD5245 library.
- https://www.analog.com/en/products/ad5246.html
- https://github.com/RobTillaart/AD520X/
- https://github.com/RobTillaart/AD524X/
- https://github.com/RobTillaart/AD5245/
- https://github.com/RobTillaart/AD5246/
- https://github.com/RobTillaart/AD520x
- https://github.com/RobTillaart/AD524X
- https://github.com/RobTillaart/AD5245
- https://github.com/RobTillaart/AD5144A
- https://github.com/RobTillaart/AD5245
- https://github.com/RobTillaart/AD5263
- https://github.com/RobTillaart/X9C10X
- https://github.com/RobTillaart/AD5246/ rheostat
## I2C address
@ -65,7 +78,6 @@ The library has a number of functions which are all quite straightforward.
One can get / set the value of the rheostat.
- **AD5246(TwoWire \*wire = &Wire)** constructor
- **bool begin(uint8_t sda, uint8_t scl)** ESP32 a.o initializing of Wire.
- **bool begin()** for UNO.
- **bool isConnected()** See if address set in constructor is on the bus.
- **uint8_t reset()** sets rheostat to midpoint = 64. (startup default)

View File

@ -17,7 +17,7 @@ void setup()
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.println();
Serial.print("AD5246_LIB_VERSION: ");
Serial.println(AD5246_LIB_VERSION);
Wire.begin();

View File

@ -17,7 +17,7 @@ void setup()
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.println();
Serial.print("AD5246_LIB_VERSION: ");
Serial.println(AD5246_LIB_VERSION);
Wire.begin();

View File

@ -17,7 +17,7 @@ void setup()
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.println();
Serial.print("AD5246_LIB_VERSION: ");
Serial.println(AD5246_LIB_VERSION);
Wire.begin();
@ -29,7 +29,6 @@ void setup()
}
void loop()
{
for (int val = 0; val < 128; val++)

View File

@ -17,7 +17,7 @@ void setup()
Serial.begin(115200);
Serial.println();
Serial.println(__FILE__);
Serial.println();
Serial.print("AD5246_LIB_VERSION: ");
Serial.println(AD5246_LIB_VERSION);
Wire.begin();

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/AD5246.git"
},
"version": "0.1.1",
"version": "0.2.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=AD5246
version=0.1.1
version=0.2.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino Library for AD5246, I2C 128 step rheostat.