0.1.1 AD5248

This commit is contained in:
Rob Tillaart 2024-03-16 19:58:26 +01:00
parent b930ee7a5b
commit 686576cf8c
17 changed files with 52 additions and 38 deletions

View File

@ -1,4 +1,4 @@
# These are supported funding model platforms
github: RobTillaart
custom: "https://www.paypal.me/robtillaart"

View File

@ -6,7 +6,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6

View File

@ -10,9 +10,9 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: json-syntax-check
uses: limitusus/json-syntax-check@v1
uses: limitusus/json-syntax-check@v2
with:
pattern: "\\.json$"

View File

@ -1,7 +1,7 @@
//
// FILE: AD5248.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// VERSION: 0.1.1
// PURPOSE: Library for I2C digital potentiometer AD5243 + rheostat AD5248
// DATE: 2023-12-12
// URL: https://github.com/RobTillaart/AD5248
@ -15,6 +15,8 @@
#define AD5248_RESET 0x40
#define AD5248_SHUTDOWN 0x20
#define AD5243_ADDRESS 0x2F
AD5248::AD5248(uint8_t address, TwoWire *wire)
{
@ -42,6 +44,12 @@ bool AD5248::isConnected()
}
uint8_t AD5248::getAddress()
{
return _address;
}
uint8_t AD5248::reset()
{
write(0, AD5248_MIDPOINT);
@ -123,7 +131,7 @@ uint8_t AD5248::send(const uint8_t cmd, const uint8_t value)
//
// DERIVED CLASS AD5243 potentiometer
//
AD5243::AD5243(TwoWire * wire) : AD5248(0x2C, wire)
AD5243::AD5243(TwoWire * wire) : AD5248(AD5243_ADDRESS, wire) // fixed address
{
_pmCount = 2;
}

View File

@ -2,7 +2,7 @@
//
// FILE: AD5248.h
// AUTHOR: Rob Tillaart
// VERSION: 0.1.0
// VERSION: 0.1.1
// PURPOSE: Library for I2C digital potentiometer AD5243 + rheostat AD5248
// DATE: 2023-12-12
// URL: https://github.com/RobTillaart/AD5248
@ -12,7 +12,7 @@
#include "Wire.h"
#define AD5248_LIB_VERSION (F("0.1.0"))
#define AD5248_LIB_VERSION (F("0.1.1"))
#define AD5248_OK 0
@ -29,6 +29,7 @@ public:
bool begin();
bool isConnected();
uint8_t getAddress();
// RESET
uint8_t reset(); // reset both channels to AD524X_MIDPOINT
@ -62,7 +63,7 @@ protected:
//////////////////////////////////////////////////////////////
//
// DERIVED CLASSES AD5248 rheostat
// DERIVED CLASS AD5243 potentiometer
//
class AD5243 : public AD5248
{

View File

@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.1] - 2024-03-16
- add **getAddress()** (e.g. debugging)
- update GitHub actions
- update keywords.txt
- minor edits
## [0.1.0] - 2023-12-12
- initial versions

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2023-2023 Rob Tillaart
Copyright (c) 2023-2024 Rob Tillaart
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -11,7 +11,7 @@
# AD5248
Arduino library for I2C digital potentioMeter AD5243 + rheostat AD5248
Arduino library for I2C digital potentioMeter AD5243 and rheostat AD5248
## Description
@ -28,22 +28,22 @@ The AD5243 is a digital potentiometer, the AD5248 is a digital rheostat.
Both IC's have two "channels" and they do not have the output lines
some other IC's in these series have e.g. like the AD5242.
The AD5243 has a fixed address (0x2F = 47) while the AD5248 has 2 address pins
giving 4 possible addresses. See table.
The AD5243 has a fixed address (0x2F = 47 decimal) while the AD5248 has
two address pins giving 4 possible addresses. See table below.
| Addr(dec)| Addr(Hex) | AD1 | AD0 |
|:--------:|:---------:|:-----:|:-----:|
| Addr(dec)| Addr(Hex) | AD1 | AD0 | Notes |
|:--------:|:---------:|:-----:|:-----:|:-------:|
| 44 | 0x2C | GND | GND |
| 45 | 0x2D | GND | +5V |
| 46 | 0x2E | +5V | GND |
| 47 | 0x2F | +5V | +5V |
| 47 | 0x2F | +5V | +5V | fixed address of AD5243 |
An important property of the devices is that they defaults
to their mid position at startup.
The library defines AD5243_MIDPOINT == 127.
The library defines **AD5248_MIDPOINT == 127**.
To be used to set to defined mid-point.
@ -52,6 +52,7 @@ To be used to set to defined mid-point.
- https://github.com/RobTillaart/AD520x
- https://github.com/RobTillaart/AD524X
- https://github.com/RobTillaart/AD5245
- https://github.com/RobTillaart/AD5248
- https://github.com/RobTillaart/AD5144A
- https://github.com/RobTillaart/AD5263
- https://github.com/RobTillaart/X9C10X
@ -59,7 +60,6 @@ To be used to set to defined mid-point.
#### Compatibles
If you know compatible devices please let me know.
@ -81,9 +81,9 @@ creates an instance with 2 potentiometers.
- **bool begin()** initialization of the object.
Note the user must call **wire.begin()** or equivalent before calling **begin()**.
- **bool isConnected()** See if the address set in constructor is on the I2C bus.
- **uint8_t getAddress()** Returns address set in the constructor, or fixed 0x2F for the AD5243.
#### REad write
#### Read write
- **uint8_t read(uint8_t channel)** read back the set value.
- **uint8_t write(uint8_t channel, uint8_t value)** set channel 0/1 to value 0..255.
@ -98,11 +98,6 @@ Note the user must call **wire.begin()** or equivalent before calling **begin()*
- **uint8_t shutDown()** check datasheet, not tested yet, use at own risk.
## Operation
The examples show the basic working of the functions.
## Error codes
| define | value |

View File

@ -3,7 +3,6 @@
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/AD5248
//
#include "AD5248.h"

View File

@ -3,7 +3,6 @@
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/AD5248
//
#include "AD5248.h"

View File

@ -3,7 +3,6 @@
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/AD5248
//
#include "AD5248.h"

View File

@ -3,7 +3,6 @@
// AUTHOR: Rob Tillaart
// PURPOSE: demo
// URL: https://github.com/RobTillaart/AD5248
//
#include "AD5248.h"

View File

@ -7,6 +7,9 @@ AD5248 KEYWORD1
# Methods and Functions (KEYWORD2)
begin KEYWORD2
isConnected KEYWORD2
getAddress KEYWORD2
reset KEYWORD2
zeroAll KEYWORD2
@ -15,6 +18,8 @@ write KEYWORD2
midScaleReset KEYWORD2
pmCount KEYWORD2
readBackRegister KEYWORD2
shutDown KEYWORD2

View File

@ -1,7 +1,7 @@
{
"name": "AD5248",
"keywords": "I2C,digital,potentiometer, rheostat, AD5243, AD5248",
"description": "Library for I2C digital potentiometer AD5243 + rheostat AD5248.",
"description": "Library for I2C digital potentiometer AD5243 and rheostat AD5248.",
"authors":
[
{
@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/AD5248"
},
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,8 +1,8 @@
name=AD5248
version=0.1.0
version=0.1.1
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Library for I2C digital potentiometer AD5243 + rheostat AD5248
sentence=Library for I2C digital potentiometer AD5243 and rheostat AD5248
paragraph=
category=Signal Input/Output
url=https://github.com/RobTillaart/AD5248

View File

@ -41,10 +41,12 @@ unittest(test_constructors)
Wire.begin();
AD5243 ADx;
assertEqual(0x2F, ADx.getAddress());
assertEqual(127, ADx.read(0));
assertEqual(127, ADx.read(1));
AD5248 AD1(0x2C);
assertEqual(0x2C, AD1.getAddress());
assertEqual(127, AD1.read(0));
assertEqual(127, AD1.read(1));
}