0.3.5 AD524X

This commit is contained in:
rob tillaart 2022-10-25 17:57:23 +02:00
parent 5a35c6f3c6
commit 5fa5018b5f
7 changed files with 77 additions and 27 deletions

View File

@ -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:
@ -7,5 +22,6 @@ compile:
# - leonardo
- m4
- esp32
# - esp8266
# - mega2560
- esp8266
# - mega2560
- rpipico

View File

@ -1,16 +1,12 @@
//
// FILE: AD524X.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.3.4
// VERSION: 0.3.5
// PURPOSE: I2C digital potentiometer AD5241 AD5242
// DATE: 2013-10-12
// URL: https://github.com/RobTillaart/AD524X
//
// HISTORY
// 2021-10-16 0.3.2 fix build-CI, update readme.md
// 2021-12-10 0.3.3 update constants, library.json, license
// 2022-08-13 0.3.4 fix AD524X_LIB_VERSION
// minor edits,
// HISTORY see changelog.md
#include "AD524X.h"
@ -25,10 +21,10 @@
AD524X::AD524X(const uint8_t address, TwoWire *wire)
{
// address: 0x01011xx = 0x2C - 0x2F
// address: 0x01011xx = 0x2C - 0x2F
_address = address;
_wire = wire;
_lastValue[0] = _lastValue[1] = 127; // power on reset => mid position
_lastValue[0] = _lastValue[1] = 127; // power on reset => mid position
_O1 = _O2 = 0;
_pmCount = 2;
}
@ -162,17 +158,17 @@ uint8_t AD524X::midScaleReset(const uint8_t rdac)
}
// read datasheet P.15
// read datasheet P.15
uint8_t AD524X::shutDown()
{
uint8_t cmd = AD524X_SHUTDOWN; // TODO TEST & VERIFY
uint8_t cmd = AD524X_SHUTDOWN; // TODO TEST & VERIFY
return send(cmd, 0);
}
//////////////////////////////////////////////////////////
//
// PRIVATE
// PRIVATE
//
uint8_t AD524X::send(const uint8_t cmd, const uint8_t value)
{
@ -199,5 +195,5 @@ AD5242::AD5242(const uint8_t address, TwoWire *wire) : AD524X(address, wire)
};
// -- END OF FILE --
// -- END OF FILE --

View File

@ -2,7 +2,7 @@
//
// FILE: AD524X.h
// AUTHOR: Rob Tillaart
// VERSION: 0.3.4
// VERSION: 0.3.5
// 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.4"))
#define AD524X_LIB_VERSION (F("0.3.5"))
#define AD524X_OK 0
@ -30,26 +30,26 @@ public:
bool begin();
bool isConnected();
uint8_t reset(); // reset both channels to 127 and O1/O2 to LOW
uint8_t zeroAll(); // set both channels to 0 and O1/O2 to LOW
uint8_t reset(); // reset both channels to 127 and O1/O2 to LOW
uint8_t zeroAll(); // set both channels to 0 and O1/O2 to LOW
uint8_t read(const uint8_t rdac);
uint8_t write(const uint8_t rdac, const uint8_t value);
uint8_t write(const uint8_t rdac, const uint8_t value, const uint8_t O1, const uint8_t O2);
uint8_t setO1(const uint8_t value = HIGH); // HIGH (default) / LOW
uint8_t setO2(const uint8_t value = HIGH); // HIGH (default) / LOW
uint8_t setO1(const uint8_t value = HIGH); // HIGH (default) / LOW
uint8_t setO2(const uint8_t value = HIGH); // HIGH (default) / LOW
uint8_t getO1();
uint8_t getO2();
uint8_t midScaleReset(const uint8_t rdac);
uint8_t pmCount() { return _pmCount; };
// debugging
uint8_t readBackRegister(); // returns the last value written in register.
// debugging
uint8_t readBackRegister(); // returns the last value written in register.
// experimental - to be tested - use at own risk
uint8_t shutDown(); // datasheet P15
// experimental - to be tested - use at own risk
uint8_t shutDown(); // datasheet P15
protected:
uint8_t _pmCount = 0;

View File

@ -0,0 +1,26 @@
# Change Log AD524X
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.3.5] - 2022-10-25
- add changelog.md
- add RP2040 in build-CI
## [0.3.4] - 2022-08-13
- fix AD524X_LIB_VERSION
- minor edits,
## [0.3.3] - 2021-12-10
- update constants, library.json, license
## [0.3.2] - 2021-10-16
- fix build-CI, update readme.md
That's all folks!

View File

@ -13,7 +13,7 @@ Arduino class for I2C digital potentiometer AD5241 AD5242.
## Description
The AD5241 and AD5242 are two digital potentiometers.
The AD5241 and AD5242 are digital potentiometers.
The AD5241 has one, the AD5242 has two potentiometers.
Both types have two output lines O1 and O2.
@ -94,8 +94,20 @@ The developer is responsible for handling this correctly.
The examples show the basic working of the functions.
## Error codes
| define | value |
|:---------------|:-------:|
| AD524X_OK | 0 |
| AD524X_ERROR | 100 |
## Future
### should
- improve error handling.
- sync with AD520X library
#### wont
- make midpoint 128

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/AD524X"
},
"version": "0.3.4",
"version": "0.3.5",
"license": "MIT",
"frameworks": "arduino",
"platforms": "*",

View File

@ -1,5 +1,5 @@
name=AD524X
version=0.3.4
version=0.3.5
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino Library for AD524X