mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.1 AD5248
This commit is contained in:
parent
b930ee7a5b
commit
686576cf8c
2
libraries/AD5248/.github/FUNDING.yml
vendored
2
libraries/AD5248/.github/FUNDING.yml
vendored
@ -1,4 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: RobTillaart
|
||||
|
||||
custom: "https://www.paypal.me/robtillaart"
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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$"
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
#define AD5248_MIDPOINT 127
|
||||
|
||||
|
||||
|
||||
class AD5248
|
||||
{
|
||||
@ -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
|
||||
{
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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 |
|
||||
|
@ -3,7 +3,6 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// URL: https://github.com/RobTillaart/AD5248
|
||||
//
|
||||
|
||||
|
||||
#include "AD5248.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// URL: https://github.com/RobTillaart/AD5248
|
||||
//
|
||||
|
||||
|
||||
#include "AD5248.h"
|
||||
|
@ -3,7 +3,6 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// URL: https://github.com/RobTillaart/AD5248
|
||||
//
|
||||
|
||||
|
||||
#include "AD5248.h"
|
||||
@ -21,7 +20,7 @@ void setup()
|
||||
|
||||
Wire1.begin(21, 22); // adjust if needed
|
||||
Wire1.setClock(400000);
|
||||
|
||||
|
||||
bool b = AD01.begin();
|
||||
Serial.println(b ? "true" : "false");
|
||||
Serial.println(AD01.isConnected());
|
||||
|
@ -3,7 +3,6 @@
|
||||
// AUTHOR: Rob Tillaart
|
||||
// PURPOSE: demo
|
||||
// URL: https://github.com/RobTillaart/AD5248
|
||||
//
|
||||
|
||||
|
||||
#include "AD5248.h"
|
||||
@ -23,7 +22,7 @@ void setup()
|
||||
Wire1.setSCL(13); // adjust if needed
|
||||
Wire1.begin();
|
||||
Wire1.setClock(400000);
|
||||
|
||||
|
||||
bool b = AD01.begin();
|
||||
Serial.println(b ? "true" : "false");
|
||||
Serial.println(AD01.isConnected());
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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": "*",
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
@ -56,7 +58,7 @@ unittest(test_pmCount)
|
||||
|
||||
AD5243 ADx;
|
||||
assertEqual(2, ADx.pmCount());
|
||||
|
||||
|
||||
AD5248 AD1(0x2C);
|
||||
assertEqual(2, ADx.pmCount());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user