mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-09-19 16:46:11 -04:00
0.4.0 AD524X
This commit is contained in:
parent
2587cf8cc7
commit
57f21c3b66
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: AD524X.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.3.6
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: I2C digital potentiometer AD5241 AD5242
|
||||
// DATE: 2013-10-12
|
||||
// URL: https://github.com/RobTillaart/AD524X
|
||||
@ -138,10 +138,10 @@ uint8_t AD524X::read(const uint8_t rdac)
|
||||
|
||||
uint8_t AD524X::readBackRegister()
|
||||
{
|
||||
Wire.beginTransmission(_address);
|
||||
Wire.endTransmission();
|
||||
Wire.requestFrom(_address, (uint8_t)1);
|
||||
return Wire.read();
|
||||
_wire->beginTransmission(_address);
|
||||
_wire->endTransmission();
|
||||
_wire->requestFrom(_address, (uint8_t)1);
|
||||
return _wire->read();
|
||||
}
|
||||
|
||||
|
||||
@ -177,10 +177,10 @@ uint8_t AD524X::pmCount()
|
||||
//
|
||||
uint8_t AD524X::send(const uint8_t cmd, const uint8_t value)
|
||||
{
|
||||
Wire.beginTransmission(_address);
|
||||
Wire.write(cmd);
|
||||
Wire.write(value);
|
||||
return Wire.endTransmission();
|
||||
_wire->beginTransmission(_address);
|
||||
_wire->write(cmd);
|
||||
_wire->write(value);
|
||||
return _wire->endTransmission();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: AD524X.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.3.6
|
||||
// VERSION: 0.4.0
|
||||
// PURPOSE: I2C digital PotentioMeter AD5241 AD5242
|
||||
// DATE: 2013-10-12
|
||||
// URL: https://github.com/RobTillaart/AD524X
|
||||
@ -12,7 +12,7 @@
|
||||
#include "Wire.h"
|
||||
|
||||
|
||||
#define AD524X_LIB_VERSION (F("0.3.6"))
|
||||
#define AD524X_LIB_VERSION (F("0.4.0"))
|
||||
|
||||
|
||||
#define AD524X_OK 0
|
||||
@ -92,5 +92,5 @@ public:
|
||||
};
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.4.0] - 2023-02-03
|
||||
- fix #18 support Wire2 (RP2040 etc)
|
||||
|
||||
|
||||
----
|
||||
|
||||
## [0.3.6] - 2023-01-11
|
||||
- update GitHub actions
|
||||
- update license
|
||||
|
@ -29,14 +29,14 @@ To be used to set to defined mid point.
|
||||
|
||||
#### Related libraries
|
||||
|
||||
This library is related to
|
||||
This library is related to
|
||||
- https://github.com/RobTillaart/AD5245 single port digital potentiometer.
|
||||
- https://github.com/RobTillaart/AD520X multi port digital potentiometer.
|
||||
|
||||
|
||||
## I2C address
|
||||
|
||||
The AD524X has two address lines to configure the I2C address. 0x2C - 0x2F
|
||||
The AD524X has two address lines to configure the I2C address. 0x2C - 0x2F
|
||||
|
||||
| Addr(dec)| Addr(Hex) | AD0 | AD1 |
|
||||
|:--------:|:---------:|:-----:|:-----:|
|
||||
@ -54,9 +54,9 @@ One can get / set the value of (both) the potentiometer(s), and the O1 and O2 ou
|
||||
|
||||
#### Constructors
|
||||
|
||||
- **AD524X(uint8_t address, TwoWire \*wire = &Wire)** constructor base class,
|
||||
- **AD524X(uint8_t address, TwoWire \*wire = &Wire)** constructor base class,
|
||||
creates an instance with 2 potentiometer.
|
||||
This class does not distinguish between AD5241 and AD5242.
|
||||
This class does not distinguish between AD5241 and AD5242.
|
||||
The developer is responsible for handling this correctly.
|
||||
- **AD5241(uint8_t address, TwoWire \*wire = &Wire)** create an instance with 1 potentiometer.
|
||||
- **AD5242(uint8_t address, TwoWire \*wire = &Wire)** create an instance with 2 potentiometer.
|
||||
@ -118,6 +118,10 @@ The examples show the basic working of the functions.
|
||||
|
||||
#### Could
|
||||
|
||||
- consider adding write(value) with default PM == 0 ? (wrapper)
|
||||
- see issue #16 / #17
|
||||
|
||||
#### Wont
|
||||
|
||||
- make midpoint 128
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/AD524X"
|
||||
},
|
||||
"version": "0.3.6",
|
||||
"version": "0.4.0",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=AD524X
|
||||
version=0.3.6
|
||||
version=0.4.0
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino Library for AD524X
|
||||
|
@ -1,7 +1,6 @@
|
||||
//
|
||||
// FILE: unit_test_001.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.3.0
|
||||
// DATE: 2020-12-03
|
||||
// PURPOSE: unit tests for I2C digital PotentioMeter AD5241 AD5242
|
||||
// https://github.com/RobTillaart/AD524X
|
||||
@ -20,6 +19,7 @@
|
||||
// assertFalse(actual)
|
||||
// assertNull(actual)
|
||||
|
||||
|
||||
#include <ArduinoUnitTests.h>
|
||||
|
||||
#include "AD524X.h"
|
||||
@ -139,4 +139,5 @@ unittest(test_constants)
|
||||
|
||||
unittest_main()
|
||||
|
||||
// --------
|
||||
|
||||
// -- END OF FILE --
|
||||
|
Loading…
Reference in New Issue
Block a user