From 43390bea53d382fa58f4de0deecec447ae20153d Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Fri, 19 Jan 2024 13:46:03 +0100 Subject: [PATCH] 0.3.0 AD5680 --- libraries/AD5680/AD5680.cpp | 8 ++++---- libraries/AD5680/AD5680.h | 4 ++-- libraries/AD5680/CHANGELOG.md | 7 ++++++- libraries/AD5680/README.md | 7 +++++++ libraries/AD5680/examples/AD5680_demo/AD5680_demo.ino | 5 +++-- .../examples/AD5680_demo_ESP32/AD5680_demo_ESP32.ino | 2 +- .../AD5680/examples/AD5680_sawtooth/AD5680_sawtooth.ino | 3 +++ libraries/AD5680/examples/AD5680_sinus/AD5680_sinus.ino | 2 ++ .../AD5680/examples/AD5680_triangle/AD5680_triangle.ino | 3 +++ libraries/AD5680/library.json | 2 +- libraries/AD5680/library.properties | 2 +- 11 files changed, 33 insertions(+), 12 deletions(-) diff --git a/libraries/AD5680/AD5680.cpp b/libraries/AD5680/AD5680.cpp index 54bce47e..ccf20e43 100644 --- a/libraries/AD5680/AD5680.cpp +++ b/libraries/AD5680/AD5680.cpp @@ -1,7 +1,7 @@ // // FILE: AD5680.cpp // AUTHOR: Rob Tillaart -// VERSION: 0.2.1 +// VERSION: 0.3.0 // DATE: 2023-09-19 // PURPOSE: Arduino library for AD5680 Digital Analog Convertor (18 bit). @@ -41,9 +41,9 @@ void AD5680::begin() if(_hwSPI) { - _mySPI->end(); - _mySPI->begin(); - delay(1); + // _mySPI->end(); + // _mySPI->begin(); + // delay(1); } else // SOFTWARE SPI { diff --git a/libraries/AD5680/AD5680.h b/libraries/AD5680/AD5680.h index 2def5e9f..471b5412 100644 --- a/libraries/AD5680/AD5680.h +++ b/libraries/AD5680/AD5680.h @@ -2,7 +2,7 @@ // // FILE: AD5680.h // AUTHOR: Rob Tillaart -// VERSION: 0.2.1 +// VERSION: 0.3.0 // DATE: 2023-09-19 // PURPOSE: Arduino library for AD5680 Digital Analog Convertor (18 bit). @@ -10,7 +10,7 @@ #include "Arduino.h" #include "SPI.h" -#define AD5680_LIB_VERSION (F("0.2.1")) +#define AD5680_LIB_VERSION (F("0.3.0")) #ifndef __SPI_CLASS__ #if defined(ARDUINO_ARCH_RP2040) diff --git a/libraries/AD5680/CHANGELOG.md b/libraries/AD5680/CHANGELOG.md index b7e6d893..7fb74652 100644 --- a/libraries/AD5680/CHANGELOG.md +++ b/libraries/AD5680/CHANGELOG.md @@ -6,12 +6,17 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.3.0] - 2024-01-19 +- Fix #7, improve handling SPI dependency. + + +---- + ## [0.2.1] - 2024-01-02 - fix examples - add __SPI_CLASS__ guard - minor edits - ## [0.2.0] - 2023-11-26 - refactor constructor interface - breaking changes. - minimize conditional code. -- create SPI_CLASS macro to solve it. diff --git a/libraries/AD5680/README.md b/libraries/AD5680/README.md index f1c2e74c..a4a63636 100644 --- a/libraries/AD5680/README.md +++ b/libraries/AD5680/README.md @@ -28,6 +28,13 @@ Feedback, issues, improvements are welcome. Please file an issue on GitHub. +#### 0.3.0 Breaking change + +Version 0.3.0 introduced a breaking change to improve handling the SPI dependency. +The user has to call **SPI.begin()** or equivalent before calling **AD.begin()**. +Optionally the user can provide parameters to the **SPI.begin(...)** + + #### 0.2.0 breaking change The version 0.2.0 has breaking changes in the interface. diff --git a/libraries/AD5680/examples/AD5680_demo/AD5680_demo.ino b/libraries/AD5680/examples/AD5680_demo/AD5680_demo.ino index dec61400..33808bff 100644 --- a/libraries/AD5680/examples/AD5680_demo/AD5680_demo.ino +++ b/libraries/AD5680/examples/AD5680_demo/AD5680_demo.ino @@ -4,7 +4,7 @@ // PURPOSE: test basic behaviour and performance // URL: https://github.com/RobTillaart/AD5680 -#include "SPI.h" + #include "AD5680.h" @@ -20,6 +20,7 @@ void setup() Serial.print("AD5680_LIB_VERSION: "); Serial.println(AD5680_LIB_VERSION); + SPI.begin(); AD16_HW.begin(); AD16_SW.begin(); @@ -36,7 +37,7 @@ void loop() uint32_t start = micros(); for (uint32_t i = 0; i < 1000; i++) { - // AD16_HW.setValue(i); + // AD16_HW.setValue(i); AD16_SW.setValue(i); } uint32_t duration = micros() - start; diff --git a/libraries/AD5680/examples/AD5680_demo_ESP32/AD5680_demo_ESP32.ino b/libraries/AD5680/examples/AD5680_demo_ESP32/AD5680_demo_ESP32.ino index 13d8c932..b3040c13 100644 --- a/libraries/AD5680/examples/AD5680_demo_ESP32/AD5680_demo_ESP32.ino +++ b/libraries/AD5680/examples/AD5680_demo_ESP32/AD5680_demo_ESP32.ino @@ -5,7 +5,6 @@ // URL: https://github.com/RobTillaart/AD5680 -#include "SPI.h" #include "AD5680.h" @@ -29,6 +28,7 @@ void setup() Serial.print("AD5680_LIB_VERSION: "); Serial.println(AD5680_LIB_VERSION); + myspi->begin(); AD16_HW.begin(); AD16_SW.begin(); diff --git a/libraries/AD5680/examples/AD5680_sawtooth/AD5680_sawtooth.ino b/libraries/AD5680/examples/AD5680_sawtooth/AD5680_sawtooth.ino index 721dcbdb..88f1b344 100644 --- a/libraries/AD5680/examples/AD5680_sawtooth/AD5680_sawtooth.ino +++ b/libraries/AD5680/examples/AD5680_sawtooth/AD5680_sawtooth.ino @@ -7,12 +7,14 @@ #include "AD5680.h" + AD5680 AD16_HW(8, &SPI); AD5680 AD16_SW(5, 6, 7); float frequency = 50; float amplitude = 262144; // 18 bits + void setup() { Serial.begin(115200); @@ -21,6 +23,7 @@ void setup() Serial.print("AD5680_LIB_VERSION: "); Serial.println(AD5680_LIB_VERSION); + SPI.begin(); AD16_HW.begin(); AD16_SW.begin(); diff --git a/libraries/AD5680/examples/AD5680_sinus/AD5680_sinus.ino b/libraries/AD5680/examples/AD5680_sinus/AD5680_sinus.ino index 4a160329..00ffc8ac 100644 --- a/libraries/AD5680/examples/AD5680_sinus/AD5680_sinus.ino +++ b/libraries/AD5680/examples/AD5680_sinus/AD5680_sinus.ino @@ -7,6 +7,7 @@ #include "AD5680.h" + AD5680 AD16_HW(8, &SPI); AD5680 AD16_SW(5, 6, 7); @@ -21,6 +22,7 @@ void setup() Serial.print("AD5680_LIB_VERSION: "); Serial.println(AD5680_LIB_VERSION); + SPI.begin(); AD16_HW.begin(); AD16_SW.begin(); diff --git a/libraries/AD5680/examples/AD5680_triangle/AD5680_triangle.ino b/libraries/AD5680/examples/AD5680_triangle/AD5680_triangle.ino index 8729c696..4cd71fdc 100644 --- a/libraries/AD5680/examples/AD5680_triangle/AD5680_triangle.ino +++ b/libraries/AD5680/examples/AD5680_triangle/AD5680_triangle.ino @@ -7,12 +7,14 @@ #include "AD5680.h" + AD5680 AD16_HW(8, &SPI); AD5680 AD16_SW(5, 6, 7); float frequency = 1.0; float amplitude = 262144; // 18 bits + void setup() { Serial.begin(115200); @@ -21,6 +23,7 @@ void setup() Serial.print("AD5680_LIB_VERSION: "); Serial.println(AD5680_LIB_VERSION); + SPI.begin(); AD16_HW.begin(); AD16_SW.begin(); diff --git a/libraries/AD5680/library.json b/libraries/AD5680/library.json index c965d5e5..8a92a0a6 100644 --- a/libraries/AD5680/library.json +++ b/libraries/AD5680/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/AD5680.git" }, - "version": "0.2.1", + "version": "0.3.0", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/AD5680/library.properties b/libraries/AD5680/library.properties index 76b9072a..1f0c9eb4 100644 --- a/libraries/AD5680/library.properties +++ b/libraries/AD5680/library.properties @@ -1,5 +1,5 @@ name=AD5680 -version=0.2.1 +version=0.3.0 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for AD5680 Digital Analog Convertor (18 bit).