0.1.2 ADG725

This commit is contained in:
Rob Tillaart 2024-03-17 17:47:00 +01:00
parent d8f5d864ee
commit c75c897d4e
14 changed files with 120 additions and 19 deletions

View File

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

View File

@ -5,8 +5,9 @@ on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: arduino/arduino-lint-action@v1
with:
library-manager: update

View File

@ -6,12 +6,14 @@ on: [push, pull_request]
jobs:
runTest:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- run: |
sudo sysctl vm.mmap_rnd_bits=28
gem install arduino_ci
arduino_ci.rb

View File

@ -9,10 +9,11 @@ on:
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 5
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

@ -3,14 +3,14 @@
// FILE: ADG725.h
// AUTHOR: Rob Tillaart
// DATE: 2023-07-24
// VERSION: 0.1.1
// VERSION: 0.1.2
// PURPOSE: Arduino library for ADG725 - 16 to 1 channel (2x) multiplexer
// URL: https://github.com/RobTillaart/ADG725
#include "Arduino.h"
#define ADG725_LIB_VERSION (F("0.1.1"))
#define ADG725_LIB_VERSION (F("0.1.2"))
#define ADG725_ALLOFF 0x80 // ENable bit (false)
#define ADG725_A_ONLY 0x20 // retain B
@ -68,8 +68,8 @@ public:
{
return _channelA;
}
uint8_t getChannelB()
{
return _channelB;
@ -93,14 +93,17 @@ public:
private:
void write(uint8_t data)
{
uint8_t cl = _clockPin;
uint8_t da = _dataPin;
digitalWrite(_syncPin, LOW);
for (int i = 0; i < 8; i++)
{
// CLOCK max 30 MHz.
digitalWrite(_clockPin, HIGH);
digitalWrite(_dataPin, (data & 0x80) > 0);
digitalWrite(cl, HIGH);
// MSB first
digitalWrite(da, (data & 0x80) > 0);
data <<= 1;
digitalWrite(_clockPin, LOW);
digitalWrite(cl, LOW);
}
digitalWrite(_syncPin, HIGH);
}

View File

@ -6,9 +6,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.1.2] - 2024-03-17
- update GitHub actions
- add performance example
- update readme.md
- minor performance tweak.
## [0.1.1] - 2023-10-16
- update readme.md
## [0.1.0] - 2023-07-24
- initial version

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

@ -35,6 +35,18 @@ No tests with hardware have been done yet, so use with care.
Feedback welcome!
#### Multiple ADG725 in parallel
**To be tested**
It seems possible to connect multiple ADG725 devices side by side and control
them as one. This would allow to create e.g a fast 8x16 multiplexer.
If you want to control them separately, every device need its own **syncPin**
a.k.a. Chip Select Pin. The data- and clockPin can be shared.
If you want to control them as one, all three lines should be shared.
#### Related
- https://github.com/RobTillaart/HC4051 (1x8 mux)
@ -76,7 +88,7 @@ Valid values for channel are 0..15.
#### Should
- add examples
- check performance
- test multiple ADG725 in parallel
#### Could

View File

@ -12,13 +12,14 @@ ADG725 ADG(10, 11, 12);
uint32_t start, stop;
void setup()
{
Serial.begin(115200);
Serial.print("ADG725_LIB_VERSION: ");
Serial.println(ADG725_LIB_VERSION);
delay(100);
start = micros();
for (int ch = 0; ch < 16; ch++)
{

View File

@ -0,0 +1,60 @@
//
// FILE: ADG725_performance.ino
// AUTHOR: Rob Tillaart
// PURPOSE: measure performance
// URL: https://github.com/RobTillaart/ADG725
#include "ADG725.h"
ADG725 ADG(10, 11, 12);
uint32_t start, stop;
void setup()
{
Serial.begin(115200);
Serial.print("ADG725_LIB_VERSION: ");
Serial.println(ADG725_LIB_VERSION);
delay(100);
start = micros();
for (int ch = 0; ch < 16; ch++)
{
ADG.setChannel(ch);
}
stop = micros();
Serial.print("setChannel:\t");
Serial.println((stop - start) / 16.0);
delay(100);
start = micros();
for (int ch = 0; ch < 16; ch++)
{
ADG.setChannelA(ch);
}
stop = micros();
Serial.print("setChannelA:\t");
Serial.println((stop - start) / 16.0);
delay(100);
start = micros();
for (int ch = 0; ch < 16; ch++)
{
ADG.setChannelB(ch);
}
stop = micros();
Serial.print("setChannelB:\t");
Serial.println((stop - start) / 16.0);
delay(100);
}
void loop()
{
}
// -- END OF FILE --

View File

@ -0,0 +1,7 @@
Arduino UNO
IDE:1.8.19
ADG725_LIB_VERSION: 0.1.1
setChannel: 125.25
setChannelA: 125.00
setChannelB: 125.25

View File

@ -0,0 +1,8 @@
Arduino UNO
IDE:1.8.19
ADG725_LIB_VERSION: 0.1.2
setChannel: 124.50
setChannelA: 124.25
setChannelB: 124.25

View File

@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/ADG725"
},
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"frameworks": "*",
"platforms": "*",

View File

@ -1,9 +1,9 @@
name=ADG725
version=0.1.1
version=0.1.2
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for ADG725 - 16 to 1 channel (2x) multiplexer.
paragraph=
paragraph=
category=Signal Input/Output
url=https://github.com/RobTillaart/ADG725
architectures=*