mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.8 AD5144A
This commit is contained in:
parent
f38eb9bcbc
commit
d119696082
@ -1,3 +1,18 @@
|
||||
platforms:
|
||||
rpipico:
|
||||
board: rp2040:rp2040:rpipico
|
||||
package: rp2040:rp2040
|
||||
gcc:
|
||||
features:
|
||||
defines:
|
||||
- ARDUINO_ARCH_RP2040
|
||||
warnings:
|
||||
flags:
|
||||
|
||||
packages:
|
||||
rp2040:rp2040:
|
||||
url: https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
|
||||
|
||||
compile:
|
||||
# Choosing to run compilation tests on 2 different Arduino platforms
|
||||
platforms:
|
||||
@ -8,4 +23,6 @@ compile:
|
||||
- m4
|
||||
- esp32
|
||||
# - esp8266
|
||||
# - mega2560
|
||||
# - mega2560
|
||||
- rpipico
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
//
|
||||
// FILE: AD5144A.cpp
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.6
|
||||
// VERSION: 0.1.8
|
||||
// PURPOSE: I2C digital potentiometer AD5144A
|
||||
// DATE: 2021-04-30
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
@ -63,15 +63,15 @@ bool AD51XX::isConnected()
|
||||
|
||||
uint8_t AD51XX::reset()
|
||||
{
|
||||
// COMMAND 14 - page 29
|
||||
return send(0xB0, 0x00); // to be tested
|
||||
// COMMAND 14 - page 29
|
||||
return send(0xB0, 0x00); // to be tested
|
||||
}
|
||||
|
||||
|
||||
uint8_t AD51XX::writeAll(const uint8_t value)
|
||||
{
|
||||
if (value > _maxValue) return AD51XXA_INVALID_VALUE;
|
||||
// COMMAND 1 - page 29
|
||||
// COMMAND 1 - page 29
|
||||
for (uint8_t pm = 0; pm < _potCount; pm++)
|
||||
{
|
||||
_lastValue[pm] = value;
|
||||
@ -83,7 +83,7 @@ uint8_t AD51XX::writeAll(const uint8_t value)
|
||||
|
||||
uint8_t AD51XX::write(const uint8_t rdac, const uint8_t value)
|
||||
{
|
||||
// COMMAND 1 - page 29
|
||||
// COMMAND 1 - page 29
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
if (value > _maxValue) return AD51XXA_INVALID_VALUE;
|
||||
_lastValue[rdac] = value;
|
||||
@ -94,7 +94,7 @@ uint8_t AD51XX::write(const uint8_t rdac, const uint8_t value)
|
||||
|
||||
uint8_t AD51XX::storeEEPROM(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 9 - page 29
|
||||
// COMMAND 9 - page 29
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x70 | rdac;
|
||||
return send(cmd, 0x01);
|
||||
@ -103,7 +103,7 @@ uint8_t AD51XX::storeEEPROM(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::recallEEPROM(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 10 - page 29
|
||||
// COMMAND 10 - page 29
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
_lastValue[rdac] = readBackEEPROM(rdac);
|
||||
uint8_t cmd = 0x70 | rdac;
|
||||
@ -113,7 +113,7 @@ uint8_t AD51XX::recallEEPROM(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::storeEEPROM(const uint8_t rdac, const uint8_t value)
|
||||
{
|
||||
// COMMAND 11 - page 29
|
||||
// COMMAND 11 - page 29
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
if (value > _maxValue) return AD51XXA_INVALID_VALUE;
|
||||
uint8_t cmd = 0x80 | rdac;
|
||||
@ -151,7 +151,7 @@ uint8_t AD51XX::setTopScaleAll()
|
||||
|
||||
uint8_t AD51XX::clrTopScaleAll()
|
||||
{
|
||||
// COMMAND 12
|
||||
// COMMAND 12
|
||||
uint8_t cmd = 0x98;
|
||||
return send(cmd, 0x80);
|
||||
}
|
||||
@ -159,7 +159,7 @@ uint8_t AD51XX::clrTopScaleAll()
|
||||
|
||||
uint8_t AD51XX::setBottomScale(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 13
|
||||
// COMMAND 13
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x90 | rdac;
|
||||
return send(cmd, 0x01);
|
||||
@ -167,7 +167,7 @@ uint8_t AD51XX::setBottomScale(const uint8_t rdac)
|
||||
|
||||
|
||||
uint8_t AD51XX::clrBottomScale(const uint8_t rdac)
|
||||
{
|
||||
{
|
||||
// COMMAND 13
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x90 | rdac;
|
||||
@ -177,7 +177,7 @@ uint8_t AD51XX::clrBottomScale(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::setBottomScaleAll()
|
||||
{
|
||||
// COMMAND 13
|
||||
// COMMAND 13
|
||||
uint8_t cmd = 0x98;
|
||||
return send(cmd, 0x01);
|
||||
}
|
||||
@ -185,7 +185,7 @@ uint8_t AD51XX::setBottomScaleAll()
|
||||
|
||||
uint8_t AD51XX::clrBottomScaleAll()
|
||||
{
|
||||
// COMMAND 13
|
||||
// COMMAND 13
|
||||
uint8_t cmd = 0x98;
|
||||
return send(cmd, 0x00);
|
||||
}
|
||||
@ -195,9 +195,9 @@ uint8_t AD51XX::clrBottomScaleAll()
|
||||
|
||||
uint8_t AD51XX::setLinearMode(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 3
|
||||
// COMMAND 3
|
||||
uint8_t mask = readBack(rdac, 0x02);
|
||||
// COMMAND 16 - page 29
|
||||
// COMMAND 16 - page 29
|
||||
uint8_t cmd = 0xD0;
|
||||
return send(cmd, mask | 0x04);
|
||||
}
|
||||
@ -205,9 +205,9 @@ uint8_t AD51XX::setLinearMode(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::setPotentiometerMode(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 3
|
||||
// COMMAND 3
|
||||
uint8_t mask = readBack(rdac, 0x02);
|
||||
// COMMAND 16 - page 29
|
||||
// COMMAND 16 - page 29
|
||||
uint8_t cmd = 0xD0;
|
||||
return send(cmd, mask & (~0x04));
|
||||
}
|
||||
@ -222,7 +222,7 @@ uint8_t AD51XX::getOperationalMode(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::incrementLinear(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 4
|
||||
// COMMAND 4
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x40 | rdac;
|
||||
return send(cmd, 0x01);
|
||||
@ -231,7 +231,7 @@ uint8_t AD51XX::incrementLinear(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::incrementLinearAll()
|
||||
{
|
||||
// COMMAND 4
|
||||
// COMMAND 4
|
||||
uint8_t cmd = 0x48;
|
||||
return send(cmd, 0x01);
|
||||
}
|
||||
@ -239,7 +239,7 @@ uint8_t AD51XX::incrementLinearAll()
|
||||
|
||||
uint8_t AD51XX::decrementLineair(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 4
|
||||
// COMMAND 4
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x40 | rdac;
|
||||
return send(cmd, 0x00);
|
||||
@ -248,7 +248,7 @@ uint8_t AD51XX::decrementLineair(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::decrementLineairAll()
|
||||
{
|
||||
// COMMAND 4
|
||||
// COMMAND 4
|
||||
uint8_t cmd = 0x48;
|
||||
return send(cmd, 0x00);
|
||||
}
|
||||
@ -256,7 +256,7 @@ uint8_t AD51XX::decrementLineairAll()
|
||||
|
||||
uint8_t AD51XX::increment6dB(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 5
|
||||
// COMMAND 5
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x50 | rdac;
|
||||
return send(cmd, 0x01);
|
||||
@ -265,7 +265,7 @@ uint8_t AD51XX::increment6dB(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::increment6dBAll()
|
||||
{
|
||||
// COMMAND 5
|
||||
// COMMAND 5
|
||||
uint8_t cmd = 0x58;
|
||||
return send(cmd, 0x01);
|
||||
}
|
||||
@ -273,7 +273,7 @@ uint8_t AD51XX::increment6dBAll()
|
||||
|
||||
uint8_t AD51XX::decrement6dB(const uint8_t rdac)
|
||||
{
|
||||
// COMMAND 5
|
||||
// COMMAND 5
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
uint8_t cmd = 0x50 | rdac;
|
||||
return send(cmd, 0x00);
|
||||
@ -282,7 +282,7 @@ uint8_t AD51XX::decrement6dB(const uint8_t rdac)
|
||||
|
||||
uint8_t AD51XX::decrement6dBAll()
|
||||
{
|
||||
// COMMAND 5
|
||||
// COMMAND 5
|
||||
uint8_t cmd = 0x58;
|
||||
return send(cmd, 0x00);
|
||||
}
|
||||
@ -292,7 +292,7 @@ uint8_t AD51XX::decrement6dBAll()
|
||||
|
||||
uint8_t AD51XX::preload(const uint8_t rdac, const uint8_t value)
|
||||
{
|
||||
// COMMAND 2 - page 29
|
||||
// COMMAND 2 - page 29
|
||||
if (rdac >= _potCount) return AD51XXA_INVALID_POT;
|
||||
if (value > _maxValue) return AD51XXA_INVALID_VALUE;
|
||||
uint8_t cmd = 0x20 | rdac;
|
||||
@ -303,7 +303,7 @@ uint8_t AD51XX::preload(const uint8_t rdac, const uint8_t value)
|
||||
uint8_t AD51XX::preloadAll(const uint8_t value)
|
||||
{
|
||||
if (value > _maxValue) return AD51XXA_INVALID_VALUE;
|
||||
// COMMAND 2 - page 29
|
||||
// COMMAND 2 - page 29
|
||||
uint8_t cmd = 0x28;
|
||||
return send(cmd, value);
|
||||
}
|
||||
@ -311,10 +311,10 @@ uint8_t AD51XX::preloadAll(const uint8_t value)
|
||||
|
||||
uint8_t AD51XX::sync(const uint8_t mask)
|
||||
{
|
||||
// COMMAND 8 - page 29
|
||||
// COMMAND 8 - page 29
|
||||
uint8_t cmd = 0x60 | mask;
|
||||
return send(cmd, 0x00);
|
||||
// keep cache correct.
|
||||
// keep cache correct.
|
||||
uint8_t m = 0x01;
|
||||
for (uint8_t rdac = 0; rdac < _potCount; rdac++)
|
||||
{
|
||||
@ -337,7 +337,7 @@ uint8_t AD51XX::shutDown()
|
||||
|
||||
uint8_t AD51XX::writeControlRegister(uint8_t mask)
|
||||
{
|
||||
// COMMAND 16 - page 29
|
||||
// COMMAND 16 - page 29
|
||||
uint8_t cmd = 0xD0;
|
||||
return send(cmd, mask);
|
||||
}
|
||||
@ -345,7 +345,7 @@ uint8_t AD51XX::writeControlRegister(uint8_t mask)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// PRIVATE
|
||||
// PRIVATE
|
||||
//
|
||||
//
|
||||
// _wire->endTransmission
|
||||
@ -358,7 +358,7 @@ uint8_t AD51XX::writeControlRegister(uint8_t mask)
|
||||
//
|
||||
uint8_t AD51XX::send(const uint8_t cmd, const uint8_t value)
|
||||
{
|
||||
// COMMAND 1 - page 20
|
||||
// COMMAND 1 - page 20
|
||||
_wire->beginTransmission(_address); // returns nothing.
|
||||
_wire->write(cmd); // returns bytes written
|
||||
_wire->write(value); // returns bytes written
|
||||
@ -368,7 +368,7 @@ uint8_t AD51XX::send(const uint8_t cmd, const uint8_t value)
|
||||
|
||||
uint8_t AD51XX::readBack(const uint8_t rdac, const uint8_t mask)
|
||||
{
|
||||
// COMMAND 3 - page 20
|
||||
// COMMAND 3 - page 20
|
||||
_wire->beginTransmission(_address);
|
||||
_wire->write(0x30 | rdac);
|
||||
_wire->write(mask);
|
||||
|
@ -2,7 +2,7 @@
|
||||
//
|
||||
// FILE: AD5144A.h
|
||||
// AUTHOR: Rob Tillaart
|
||||
// VERSION: 0.1.7
|
||||
// VERSION: 0.1.8
|
||||
// PURPOSE: I2C digital PotentioMeter AD5144A
|
||||
// DATE: 2021-04-30
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
@ -13,7 +13,7 @@
|
||||
#include "Wire.h"
|
||||
|
||||
|
||||
#define AD51XXA_VERSION (F("0.1.7"))
|
||||
#define AD51XXA_VERSION (F("0.1.8"))
|
||||
|
||||
|
||||
#define AD51XXA_OK 0
|
||||
|
@ -5,89 +5,52 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
## [0.1.7] - 2022-06-21
|
||||
## [0.1.8] - 2022-10-25
|
||||
- add rp2040 to build
|
||||
- redo comments
|
||||
- clean up examples
|
||||
|
||||
|
||||
## [0.1.7] - 2022-06-21
|
||||
- fix ESP32 Wire.begin datatype
|
||||
|
||||
|
||||
## [0.1.6] - 2022-04-25
|
||||
|
||||
### Added
|
||||
- extra comments on **sync()**
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
- fixed issue #14, preloading values should not change cached values
|
||||
|
||||
|
||||
## [0.1.5] - 2022-03-14
|
||||
|
||||
### Added
|
||||
- CHANGELOG.md: moved history from AD5144A.cpp to this file.
|
||||
- fix #12 always call reset in begin().
|
||||
- add flag to **begin(bool doReset = true)** to explcitly disable the reset
|
||||
- add flag to **begin(bool doReset = true)** to explicitly disable the reset
|
||||
call. The default is true ==> backwards compatibility / normal use.
|
||||
|
||||
### Changed
|
||||
- updated readme.md
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
## [0.1.4] - 2021-12-10
|
||||
|
||||
### Added
|
||||
- add check for maxValue in code.
|
||||
|
||||
### Changed
|
||||
- remove experimental from version string.
|
||||
- add headers to library.json,
|
||||
- minor edits readme, license,
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
## [0.1.3] - 2021-10-17
|
||||
|
||||
### Added
|
||||
|
||||
### Changed
|
||||
- update build-ci
|
||||
- improve readme.md
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
## [0.1.2] - 2021-05-12
|
||||
|
||||
### Added
|
||||
- add increment()
|
||||
- add decrement()
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
## [0.1.1] - 2021-05-12
|
||||
|
||||
### Added
|
||||
- add topScale()
|
||||
- add bottomScale()
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
## [0.1.0] - 2021-04-30
|
||||
|
||||
### Added
|
||||
- initial version
|
||||
|
||||
### Changed
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
|
@ -45,7 +45,7 @@ See Future below.
|
||||
|
||||
### Type AD51xy decomposition
|
||||
|
||||
- x = 2 => range = 0..127
|
||||
- x = 2 => range = 0..127
|
||||
- x = 4 => range = 0..255
|
||||
- y = 1 => 1 potentiometer
|
||||
- y = 2 => 2 potentiometers
|
||||
@ -56,6 +56,7 @@ See Future below.
|
||||
## I2C
|
||||
|
||||
For the selection of the address, see table 12 / 13 datasheet.
|
||||
Typical 0x28, 0x2A or 0x2B.
|
||||
|
||||
The AD5144A devices support standard 100 kHz, and fast 400 kHz, data transfer modes.
|
||||
|
||||
@ -87,7 +88,6 @@ The developer is responsible for handling these differences correctly when using
|
||||
- **AD5141(uint8_t address, TwoWire \*wire = &Wire)**
|
||||
|
||||
|
||||
|
||||
### I2C / device initialization
|
||||
|
||||
- **bool begin(int dataPin, int clockPin, bool doReset = true)** ESP32 a.o initializing of the I2C data and clock pins.
|
||||
@ -105,7 +105,6 @@ This loads the last values stored in EEPROM in the RDAC's.
|
||||
Factory default is **midScale()** check datasheet for details.
|
||||
|
||||
|
||||
|
||||
### Basic IO
|
||||
|
||||
Used to set one channel at the time.
|
||||
@ -221,13 +220,16 @@ The examples show the basic working of the functions.
|
||||
|
||||
## Future
|
||||
|
||||
**must**
|
||||
#### must
|
||||
|
||||
- update documentation
|
||||
- some functions can be performance optimized
|
||||
- writing a value is not needed if last value is the same?
|
||||
|
||||
**could**
|
||||
#### could
|
||||
|
||||
- improve unit testing CI
|
||||
- **stereo**, write one value to two channels.
|
||||
- more testing with hardware.
|
||||
- SPI based version of the library ?
|
||||
|
||||
|
@ -2,12 +2,10 @@
|
||||
// FILE: AD5144A_low_level.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: test low level IO
|
||||
// DATE: 2021-05-04
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
// THIS IS A LOW LEVEL WRITE TEST FOR AD5144A
|
||||
// IT DOES NOT USE THE LIBRARY
|
||||
// THIS IS A LOW LEVEL WRITE TEST FOR AD5144A
|
||||
// IT DOES NOT USE THE LIBRARY
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_EEPROM.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: test EEPROM functions
|
||||
// DATE: 2021-05-04
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
@ -25,7 +24,7 @@ void setup()
|
||||
return;
|
||||
}
|
||||
|
||||
// values should be same after start
|
||||
// values should be same after start
|
||||
for (int ch = 0; ch < AD.pmCount(); ch++)
|
||||
{
|
||||
Serial.print(ch);
|
||||
@ -36,7 +35,7 @@ void setup()
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
// update values for after next (full) power up.
|
||||
// update values for after next (full) power up.
|
||||
for (int ch = 0; ch < AD.pmCount(); ch++)
|
||||
{
|
||||
uint8_t val = AD.recallEEPROM(ch);
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_control_register.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: read CONTROL REGISTER functions
|
||||
// DATE: 2021-05-04
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_isConnected.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: check isConnected()
|
||||
// DATE: 2021-05-04
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address if needed
|
||||
// select the right type
|
||||
// adjust address if needed
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
@ -41,3 +40,4 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_performance.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: indication performance methods of the class
|
||||
// DATE: 2021-04-30
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
uint32_t start, stop;
|
||||
@ -106,7 +105,7 @@ void test_midScaleAll()
|
||||
}
|
||||
|
||||
|
||||
void test_zeroAll() // todo test
|
||||
void test_zeroAll() // todo test
|
||||
{
|
||||
Serial.println();
|
||||
Serial.println(__FUNCTION__);
|
||||
|
@ -6,14 +6,14 @@
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
// connect the AD5144A to a multichannel scope
|
||||
// to verify the potentiometers change at the same time
|
||||
// connect the AD5144A to a multichannel scope
|
||||
// to verify the potentiometers change at the same time
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_speed.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// DATE: 2021-04-30
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_write.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// DATE: 2021-04-30
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
@ -25,8 +24,8 @@ void setup()
|
||||
return;
|
||||
}
|
||||
|
||||
// will generate 20+ lines
|
||||
// decrease step 50 to 1 to test all
|
||||
// will generate 20+ lines
|
||||
// decrease step 50 to 1 to test all
|
||||
for (int val = 0; val < 256; val+= 50)
|
||||
{
|
||||
for (int p = 0; p < AD.pmCount(); p++)
|
||||
@ -53,3 +52,4 @@ void loop()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -2,14 +2,13 @@
|
||||
// FILE: AD5144A_test_writeAll.ino
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: test writeAll + wrappers
|
||||
// DATE: 2021-05-04
|
||||
// URL: https://github.com/RobTillaart/AD5144A
|
||||
|
||||
|
||||
#include "AD5144A.h"
|
||||
|
||||
// select the right type
|
||||
// adjust address
|
||||
// select the right type
|
||||
// adjust address
|
||||
AD5144A AD(0x77);
|
||||
|
||||
|
||||
@ -118,3 +117,4 @@ void test_maxAll()
|
||||
|
||||
|
||||
// -- END OF FILE --
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
"type": "git",
|
||||
"url": "https://github.com/RobTillaart/AD5144A.git"
|
||||
},
|
||||
"version": "0.1.7",
|
||||
"version": "0.1.8",
|
||||
"license": "MIT",
|
||||
"frameworks": "arduino",
|
||||
"platforms": "*",
|
||||
|
@ -1,5 +1,5 @@
|
||||
name=AD5144A
|
||||
version=0.1.7
|
||||
version=0.1.8
|
||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||
sentence=Arduino Library for AD5144A 4 Channel digital potentiometer
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
unittest_setup()
|
||||
{
|
||||
fprintf(stderr, "AD51XXA_VERSION: %s\n", (char *) AD51XXA_VERSION);
|
||||
}
|
||||
|
||||
|
||||
@ -37,14 +38,12 @@ unittest_teardown()
|
||||
|
||||
unittest(test_constructors)
|
||||
{
|
||||
fprintf(stderr, "AD51XXA_VERSION: %s\n", (char *) AD51XXA_VERSION);
|
||||
|
||||
Wire.begin();
|
||||
|
||||
AD5123 AD23(0x2C);
|
||||
assertEqual( 4, AD23.pmCount());
|
||||
assertEqual(127, AD23.maxValue());
|
||||
// assertEqual(0, AD23.read()) // todo
|
||||
// assertEqual(0, AD23.read()) // todo
|
||||
|
||||
AD5124 AD24(0x2C);
|
||||
assertEqual( 4, AD24.pmCount());
|
||||
@ -86,7 +85,6 @@ unittest(test_constants)
|
||||
assertEqual(100, AD51XXA_ERROR);
|
||||
assertEqual(101, AD51XXA_INVALID_POT);
|
||||
assertEqual(102, AD51XXA_INVALID_VALUE);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user