-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from janelia-arduino/multichip
Multichip Support
- Loading branch information
Showing
10 changed files
with
248 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,3 +6,5 @@ | |
/sftp-config.json | ||
.tags | ||
.tags_sorted_by_file | ||
.pio | ||
.venv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,28 @@ | ||
License Agreement | ||
(3-clause BSD License) | ||
Janelia Research Campus Software Copyright 1.1 | ||
Janelia Open-Source Software (3-clause BSD License) | ||
|
||
Copyright (c) 2014, Howard Hughes Medical Institute | ||
All rights reserved. | ||
Copyright 2023 Howard Hughes Medical Institute | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation and/or | ||
other materials provided with the distribution. | ||
|
||
* Neither the name of the Howard Hughes Medical Institute nor the | ||
names of its contributors may be used to endorse or promote products | ||
derived from this software without specific prior written | ||
permission. | ||
3. Neither the name of the copyright holder nor the names of its contributors | ||
may be used to endorse or promote products derived from this software without | ||
specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
.PHONY: venv | ||
venv: | ||
rm -rf .venv;\ | ||
mkdir .venv;\ | ||
python3 -m venv .venv;\ | ||
source .venv/bin/activate;\ | ||
pip install platformio | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf .pio | ||
|
||
firmware: clean | ||
. .venv/bin/activate; pio run -e teensy41 | ||
|
||
.PHONY: upload | ||
upload: clean | ||
. .venv/bin/activate; pio run -e teensy41 --target upload --upload-port /dev/ttyACM0 | ||
|
||
.PHONY: monitor | ||
monitor: | ||
. .venv/bin/activate; pio device monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,14 @@ | |
|
||
* Library Information | ||
- Name :: AD57X4R | ||
- Version :: 4.0.1 | ||
- Version :: 5.0.0 | ||
- License :: BSD | ||
- URL :: https://github.com/janelia-arduino/AD57X4R | ||
- Author :: Peter Polidoro | ||
- Email :: [email protected] | ||
|
||
** Description | ||
|
||
Provides an SPI based interface to the AD5724R, AD5734R, and the AD5754R Quad | ||
12-/14-/16-Bit Unipolar/Bipolar Voltage Output DACs. | ||
|
||
|
@@ -25,12 +27,12 @@ | |
|
||
* Wiring | ||
|
||
| PIN | CONNECTION | | ||
|-----------+---------------------------------------------------------------------| | ||
| SDIN | connect to processor MOSI pin or SDO of previous daisy-chained chip | | ||
| SDO | connect to processor MISO pin or SDIN of next daisy-chained chip | | ||
| SCLK | connect to processor SCK pin | | ||
| SYNC | connect to processor chip select pin | | ||
| BIN2SCOMP | GND | | ||
| LDAC | GND or connect to processor pin and use setLoadDacPin method | | ||
| CLR | DVCC or connect to processor pin and use setClearPin method | | ||
| PIN | CONNECTION | | ||
|-----------+-------------------------------------------------------------------------------| | ||
| SDIN | connect to processor MOSI pin or SDO of previous daisy-chained chip | | ||
| SDO | connect to processor MISO pin or SDIN of next daisy-chained chip | | ||
| SCLK | connect to processor SCK pin | | ||
| SYNC | connect to processor CS pin and set in constructor or setChipSelectPin method | | ||
| BIN2SCOMP | GND | | ||
| LDAC | GND or connect to processor pin and use setLoadDacPin method | | ||
| CLR | DVCC or connect to processor pin and use setClearPin method | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#include <AD57X4R.h> | ||
|
||
|
||
const size_t CHIP_SELECT_PIN = 10; | ||
const size_t LOAD_DAC_PIN = 3; | ||
const size_t CLEAR_PIN = 4; | ||
|
||
const size_t CHIP_COUNT = 2; | ||
|
||
const size_t VOLTAGE_MULTIPLIER = 1; | ||
|
||
const int DELAY = 500; | ||
|
||
AD57X4R dac = AD57X4R(CHIP_SELECT_PIN); | ||
|
||
void setup() | ||
{ | ||
// Initialize DAC | ||
dac.setLoadDacPin(LOAD_DAC_PIN); | ||
dac.setClearPin(CLEAR_PIN); | ||
dac.setup(AD57X4R::AD5724R, CHIP_COUNT); | ||
|
||
dac.setAllOutputRanges(AD57X4R::UNIPOLAR_10V); | ||
} | ||
|
||
void loop() | ||
{ | ||
dac.beginSimultaneousUpdate(); | ||
for (size_t channel=0; channel<dac.getChannelCount(); ++channel) | ||
{ | ||
dac.setVoltage(channel, channel*VOLTAGE_MULTIPLIER); | ||
} | ||
dac.simultaneousUpdate(); | ||
|
||
delay(DELAY); | ||
|
||
dac.beginSimultaneousUpdate(); | ||
dac.setAllVoltages(0); | ||
dac.simultaneousUpdate(); | ||
|
||
delay(DELAY); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name=AD57X4R | ||
version=4.0.1 | ||
version=5.0.0 | ||
author=Peter Polidoro <[email protected]> | ||
maintainer=Peter Polidoro <[email protected]> | ||
sentence=Provides an SPI based interface to the AD5724R, AD5734R, and the AD5754R Quad 12-/14-/16-Bit Unipolar/Bipolar Voltage Output DACs. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
[platformio] | ||
; src_dir = examples/Interactive | ||
; src_dir = examples/MultiChip | ||
; src_dir = examples/Sawtooth | ||
src_dir = examples/SimultaneousUpdate | ||
lib_dir = src | ||
|
||
[common_env_data] | ||
build_flags = | ||
-Isrc | ||
lib_deps_builtin = | ||
SPI | ||
lib_deps_external = | ||
https://github.com/janelia-arduino/Streaming.git#6.1.1 | ||
lib_deps_local = | ||
src/AD57X4R | ||
|
||
[env] | ||
lib_ldf_mode = off | ||
build_flags = | ||
${common_env_data.build_flags} | ||
; monitor_flags = | ||
; --echo | ||
; --eol | ||
; CRLF | ||
monitor_filters = | ||
send_on_enter | ||
colorize | ||
monitor_speed = 115200 | ||
lib_deps = | ||
${common_env_data.lib_deps_builtin} | ||
${common_env_data.lib_deps_external} | ||
${common_env_data.lib_deps_local} | ||
|
||
[env:teensy41] | ||
platform = teensy | ||
framework = arduino | ||
board = teensy41 | ||
upload_protocol = teensy-cli | ||
|
||
; pio run | ||
; pio run -e teensy41 --target upload --upload-port /dev/ttyACM0 | ||
; pio device monitor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.