mirror of
https://github.com/RobTillaart/Arduino.git
synced 2024-10-03 18:09:02 -04:00
0.1.2 ADG731
This commit is contained in:
parent
0d0c0b8de0
commit
63d02b1b4f
1
libraries/ADG731/.github/FUNDING.yml
vendored
1
libraries/ADG731/.github/FUNDING.yml
vendored
@ -1,4 +1,5 @@
|
|||||||
# These are supported funding model platforms
|
# These are supported funding model platforms
|
||||||
|
|
||||||
github: RobTillaart
|
github: RobTillaart
|
||||||
|
custom: "https://www.paypal.me/robtillaart"
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ jobs:
|
|||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: arduino/arduino-lint-action@v1
|
- uses: arduino/arduino-lint-action@v1
|
||||||
with:
|
with:
|
||||||
library-manager: update
|
library-manager: update
|
||||||
|
@ -6,12 +6,14 @@ on: [push, pull_request]
|
|||||||
jobs:
|
jobs:
|
||||||
runTest:
|
runTest:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 20
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
ruby-version: 2.6
|
ruby-version: 2.6
|
||||||
- run: |
|
- run: |
|
||||||
|
sudo sysctl vm.mmap_rnd_bits=28
|
||||||
gem install arduino_ci
|
gem install arduino_ci
|
||||||
arduino_ci.rb
|
arduino_ci.rb
|
@ -10,9 +10,9 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- name: json-syntax-check
|
- name: json-syntax-check
|
||||||
uses: limitusus/json-syntax-check@v1
|
uses: limitusus/json-syntax-check@v2
|
||||||
with:
|
with:
|
||||||
pattern: "\\.json$"
|
pattern: "\\.json$"
|
||||||
|
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
// FILE: ADG731.h
|
// FILE: ADG731.h
|
||||||
// AUTHOR: Rob Tillaart
|
// AUTHOR: Rob Tillaart
|
||||||
// DATE: 2023-07-24
|
// DATE: 2023-07-24
|
||||||
// VERSION: 0.1.1
|
// VERSION: 0.1.2
|
||||||
// PURPOSE: Arduino library for ADG731 - 32 to 1 channel multiplexer
|
// PURPOSE: Arduino library for ADG731 - 32 to 1 channel multiplexer
|
||||||
// URL: https://github.com/RobTillaart/ADG731
|
// URL: https://github.com/RobTillaart/ADG731
|
||||||
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
|
|
||||||
#define ADG731_LIB_VERSION (F("0.1.1"))
|
#define ADG731_LIB_VERSION (F("0.1.2"))
|
||||||
|
|
||||||
#define ADG731_ALLOFF 0x80
|
#define ADG731_ALLOFF 0x80
|
||||||
|
|
||||||
|
@ -6,10 +6,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
|
## [0.1.2] - 2024-03-21
|
||||||
|
- update GitHub actions
|
||||||
|
- minor edits
|
||||||
|
|
||||||
|
|
||||||
## [0.1.1] - 2023-10-16
|
## [0.1.1] - 2023-10-16
|
||||||
- update readme.md (badges)
|
- update readme.md (badges)
|
||||||
- fix setChannel() - mask.
|
- fix setChannel() - mask.
|
||||||
|
|
||||||
|
|
||||||
## [0.1.0] - 2023-07-24
|
## [0.1.0] - 2023-07-24
|
||||||
- initial version
|
- initial version
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
@ -18,19 +18,17 @@ Arduino library for ADG731 - 32 to 1 channel multiplexer.
|
|||||||
|
|
||||||
**Experimental**
|
**Experimental**
|
||||||
|
|
||||||
ADG731 is an Arduino class that controls a 1 x 32 multiplexer over a SPI
|
ADG731 is an Arduino class that controls a 1 x 32 multiplexer over a
|
||||||
like interface.
|
SPI like interface.
|
||||||
Only one of the 32 channels can be connected at the same time.
|
Only one of the 32 channels can be connected at the same time.
|
||||||
The library also support to set them all off (17th state).
|
The library also support to select none (== 33th state).
|
||||||
|
|
||||||
This library can be used to connect 32 analog devices to one analog port.
|
On power-up, all switches are in the OFF state == none connected.
|
||||||
|
|
||||||
On power-up, all switches are in the OFF state.
|
|
||||||
|
|
||||||
This library can be used e.g. to connect 32 analog devices to
|
This library can be used e.g. to connect 32 analog devices to
|
||||||
one analog port, or to select between 32 DHT22 sensors.
|
one analog port, or to select between 32 DHT22 sensors.
|
||||||
|
|
||||||
Not tests with hardware have been done yet, so use with care.
|
No tests with hardware have been done yet, so use with care.
|
||||||
Feedback welcome!
|
Feedback welcome!
|
||||||
|
|
||||||
|
|
||||||
@ -55,6 +53,7 @@ Feedback welcome!
|
|||||||
- **ADG731(uint8_t clockPin, uint8_t dataPin, uint8_t syncPin)** constructor.
|
- **ADG731(uint8_t clockPin, uint8_t dataPin, uint8_t syncPin)** constructor.
|
||||||
- **void setChannel(uint8_t channel)** set the current channel.
|
- **void setChannel(uint8_t channel)** set the current channel.
|
||||||
Valid values for channel are 0..31.
|
Valid values for channel are 0..31.
|
||||||
|
Numbers larger than 31 will be "wrapped" modulo 32.
|
||||||
- **uint8_t getChannel()** get last set channel == 0..31 or ADG731_ALLOFF.
|
- **uint8_t getChannel()** get last set channel == 0..31 or ADG731_ALLOFF.
|
||||||
- **uint8_t channelCount()** returns 32 for ADG731.
|
- **uint8_t channelCount()** returns 32 for ADG731.
|
||||||
- **void allOff()** sets all channels to OFF, none selected.
|
- **void allOff()** sets all channels to OFF, none selected.
|
||||||
@ -65,14 +64,15 @@ Valid values for channel are 0..31.
|
|||||||
|
|
||||||
- improve documentation
|
- improve documentation
|
||||||
- test with hardware
|
- test with hardware
|
||||||
|
- keep in sync with ADG732 (interface)
|
||||||
|
|
||||||
#### Should
|
#### Should
|
||||||
|
|
||||||
- add examples
|
- add examples
|
||||||
- check performance
|
|
||||||
|
|
||||||
#### Could
|
#### Could
|
||||||
|
|
||||||
|
- **bool setChannel(uint8_t channel)** return false if out of range?
|
||||||
|
|
||||||
#### Wont
|
#### Wont
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ ADG731 ADG(10, 11, 12);
|
|||||||
|
|
||||||
uint32_t start, stop;
|
uint32_t start, stop;
|
||||||
|
|
||||||
|
|
||||||
void setup()
|
void setup()
|
||||||
{
|
{
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
//
|
||||||
|
// FILE: ADG731_performance.ino
|
||||||
|
// AUTHOR: Rob Tillaart
|
||||||
|
// PURPOSE: measure performance
|
||||||
|
// URL: https://github.com/RobTillaart/ADG731
|
||||||
|
|
||||||
|
|
||||||
|
#include "ADG731.h"
|
||||||
|
|
||||||
|
|
||||||
|
ADG731 ADG(10, 11, 12);
|
||||||
|
|
||||||
|
uint32_t start, stop;
|
||||||
|
|
||||||
|
|
||||||
|
void setup()
|
||||||
|
{
|
||||||
|
Serial.begin(115200);
|
||||||
|
Serial.print("ADG731_LIB_VERSION: ");
|
||||||
|
Serial.println(ADG731_LIB_VERSION);
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
start = micros();
|
||||||
|
for (int ch = 0; ch < 32; ch++)
|
||||||
|
{
|
||||||
|
ADG.setChannel(ch);
|
||||||
|
}
|
||||||
|
stop = micros();
|
||||||
|
Serial.print("setChannel:\t");
|
||||||
|
Serial.println((stop - start) / 32.0);
|
||||||
|
delay(100);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void loop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -- END OF FILE --
|
@ -0,0 +1,7 @@
|
|||||||
|
Arduino UNO
|
||||||
|
IDE:1.8.19
|
||||||
|
|
||||||
|
ADG731_LIB_VERSION: 0.1.2
|
||||||
|
setChannel: 124.00
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
|||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/RobTillaart/ADG731"
|
"url": "https://github.com/RobTillaart/ADG731"
|
||||||
},
|
},
|
||||||
"version": "0.1.1",
|
"version": "0.1.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"frameworks": "*",
|
"frameworks": "*",
|
||||||
"platforms": "*",
|
"platforms": "*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=ADG731
|
name=ADG731
|
||||||
version=0.1.1
|
version=0.1.2
|
||||||
author=Rob Tillaart <rob.tillaart@gmail.com>
|
author=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
|
||||||
sentence=Arduino library for ADG731 - 32 to 1 channel multiplexer.
|
sentence=Arduino library for ADG731 - 32 to 1 channel multiplexer.
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
#include <ArduinoUnitTests.h>
|
#include <ArduinoUnitTests.h>
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
#include "ADG731.h"
|
#include "ADG731.h"
|
||||||
|
|
||||||
|
|
||||||
@ -54,6 +54,8 @@ unittest(test_constants)
|
|||||||
unittest(test_allOff)
|
unittest(test_allOff)
|
||||||
{
|
{
|
||||||
ADG731 ADG(10, 11, 12);
|
ADG731 ADG(10, 11, 12);
|
||||||
|
// test default
|
||||||
|
assertEqual(ADG731_ALLOFF, ADG.getChannel());
|
||||||
|
|
||||||
ADG.setChannel(13);
|
ADG.setChannel(13);
|
||||||
ADG.allOff();
|
ADG.allOff();
|
||||||
@ -65,7 +67,8 @@ unittest(test_channel)
|
|||||||
{
|
{
|
||||||
ADG731 ADG(10, 11, 12);
|
ADG731 ADG(10, 11, 12);
|
||||||
|
|
||||||
for (int ch = 0; ch < 16; ch++)
|
// 0..31
|
||||||
|
for (int ch = 0; ch < 32; ch ++)
|
||||||
{
|
{
|
||||||
ADG.setChannel(ch);
|
ADG.setChannel(ch);
|
||||||
assertEqual(ch, ADG.getChannel());
|
assertEqual(ch, ADG.getChannel());
|
||||||
|
Loading…
Reference in New Issue
Block a user