From 0ba51433c86380c826296b1da512a83c9d548ed0 Mon Sep 17 00:00:00 2001 From: Rob Tillaart Date: Sat, 20 Jan 2024 09:54:40 +0100 Subject: [PATCH] 0.4.0 AD9833 --- libraries/AD9833/AD9833.cpp | 6 +++--- libraries/AD9833/AD9833.h | 4 ++-- libraries/AD9833/CHANGELOG.md | 7 ++++++- libraries/AD9833/README.md | 7 +++++++ .../AD9833/examples/AD9833_1000_Hz/AD9833_1000_Hz.ino | 2 ++ .../AD9833/examples/AD9833_HLB_MODE/AD9833_HLB_MODE.ino | 2 ++ .../AD9833/examples/AD9833_minimal/AD9833_minimal.ino | 2 ++ .../examples/AD9833_minimal_ESP32/AD9833_minimal_ESP32.ino | 2 ++ .../examples/AD9833_multi_device/AD9833_multi_device.ino | 4 +++- .../examples/AD9833_performance/AD9833_performance.ino | 3 +++ .../AD9833_switch_channel/AD9833_switch_channel.ino | 2 ++ .../examples/AD9833_switch_phase/AD9833_switch_phase.ino | 2 ++ .../AD9833/examples/AD9833_test_10/AD9833_test_10.ino | 2 ++ libraries/AD9833/library.json | 2 +- libraries/AD9833/library.properties | 2 +- 15 files changed, 40 insertions(+), 9 deletions(-) diff --git a/libraries/AD9833/AD9833.cpp b/libraries/AD9833/AD9833.cpp index a76db12e..84e4910a 100644 --- a/libraries/AD9833/AD9833.cpp +++ b/libraries/AD9833/AD9833.cpp @@ -2,7 +2,7 @@ // FILE: AD9833.cpp // AUTHOR: Rob Tillaart // PURPOSE: Arduino library for AD9833 function generator -// VERSION: 0.3.1 +// VERSION: 0.4.0 // URL: https://github.com/RobTillaart/AD9833 // @@ -58,8 +58,8 @@ void AD9833::begin() if (_hwSPI) { - _mySPI->end(); - _mySPI->begin(); + // _mySPI->end(); + // _mySPI->begin(); } else // SOFTWARE SPI { diff --git a/libraries/AD9833/AD9833.h b/libraries/AD9833/AD9833.h index 4a3ab55e..a3b6325e 100644 --- a/libraries/AD9833/AD9833.h +++ b/libraries/AD9833/AD9833.h @@ -3,7 +3,7 @@ // FILE: AD9833.h // AUTHOR: Rob Tillaart // PURPOSE: Arduino library for AD9833 function generator. -// VERSION: 0.3.1 +// VERSION: 0.4.0 // URL: https://github.com/RobTillaart/AD9833 @@ -11,7 +11,7 @@ #include "SPI.h" -#define AD9833_LIB_VERSION (F("0.3.1")) +#define AD9833_LIB_VERSION (F("0.4.0")) #if !defined(__SPI_CLASS__) diff --git a/libraries/AD9833/CHANGELOG.md b/libraries/AD9833/CHANGELOG.md index 365cf293..f5b43996 100644 --- a/libraries/AD9833/CHANGELOG.md +++ b/libraries/AD9833/CHANGELOG.md @@ -6,13 +6,18 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.4.0] - 2024-01-20 +- Fix #14, improve handling SPI dependency. +- update examples + +---- + ## [0.3.1] - 2024-01-12 - Fix #12, make crystal adjustable (experimental implementation). - add **bool setCrystalFrequency(uint32_t crystal = 25000000)** - add **uint32_t getCrystalFrequency()** - update readme.md - ## [0.3.0] - 2023-11-26 - fix #10, explicit write control register fixes glitch. - rename **writeFreqRegister()** to **writeFrequencyRegister()** diff --git a/libraries/AD9833/README.md b/libraries/AD9833/README.md index 69368b8b..26e0d26e 100644 --- a/libraries/AD9833/README.md +++ b/libraries/AD9833/README.md @@ -59,6 +59,13 @@ please let me know by opening an issue. Probably they need a dedicated library based on this one. +#### 0.4.0 Breaking change + +Version 0.4.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/AD9833/examples/AD9833_1000_Hz/AD9833_1000_Hz.ino b/libraries/AD9833/examples/AD9833_1000_Hz/AD9833_1000_Hz.ino index 77c734f7..86633edb 100644 --- a/libraries/AD9833/examples/AD9833_1000_Hz/AD9833_1000_Hz.ino +++ b/libraries/AD9833/examples/AD9833_1000_Hz/AD9833_1000_Hz.ino @@ -17,6 +17,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setWave(AD9833_SQUARE1); diff --git a/libraries/AD9833/examples/AD9833_HLB_MODE/AD9833_HLB_MODE.ino b/libraries/AD9833/examples/AD9833_HLB_MODE/AD9833_HLB_MODE.ino index 39742f01..733a3973 100644 --- a/libraries/AD9833/examples/AD9833_HLB_MODE/AD9833_HLB_MODE.ino +++ b/libraries/AD9833/examples/AD9833_HLB_MODE/AD9833_HLB_MODE.ino @@ -15,6 +15,8 @@ void setup() while(!Serial); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setFrequency(1000, 0); AD.setFrequency(1000, 0); diff --git a/libraries/AD9833/examples/AD9833_minimal/AD9833_minimal.ino b/libraries/AD9833/examples/AD9833_minimal/AD9833_minimal.ino index 346271f0..74f0669c 100644 --- a/libraries/AD9833/examples/AD9833_minimal/AD9833_minimal.ino +++ b/libraries/AD9833/examples/AD9833_minimal/AD9833_minimal.ino @@ -16,6 +16,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setFrequency(1000, 0); // 1000 Hz. diff --git a/libraries/AD9833/examples/AD9833_minimal_ESP32/AD9833_minimal_ESP32.ino b/libraries/AD9833/examples/AD9833_minimal_ESP32/AD9833_minimal_ESP32.ino index fbd4e1f5..372f42c6 100644 --- a/libraries/AD9833/examples/AD9833_minimal_ESP32/AD9833_minimal_ESP32.ino +++ b/libraries/AD9833/examples/AD9833_minimal_ESP32/AD9833_minimal_ESP32.ino @@ -24,6 +24,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + myspi->begin(); + AD.begin(); AD.setFrequency(1000, 0); // 1000 Hz. diff --git a/libraries/AD9833/examples/AD9833_multi_device/AD9833_multi_device.ino b/libraries/AD9833/examples/AD9833_multi_device/AD9833_multi_device.ino index c34c8e78..761ebcc6 100644 --- a/libraries/AD9833/examples/AD9833_multi_device/AD9833_multi_device.ino +++ b/libraries/AD9833/examples/AD9833_multi_device/AD9833_multi_device.ino @@ -3,7 +3,7 @@ // AUTHOR: Rob Tillaart // PURPOSE: demo AD9833 wave form generator on 4 devices // -// todo: test with hardware +// TODO: test with hardware #include "AD9833.h" @@ -23,6 +23,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + SPI.begin(); + for (int i = 0; i < 3; i++) { AD[i].begin(); diff --git a/libraries/AD9833/examples/AD9833_performance/AD9833_performance.ino b/libraries/AD9833/examples/AD9833_performance/AD9833_performance.ino index 3004e44c..6cb5c43c 100644 --- a/libraries/AD9833/examples/AD9833_performance/AD9833_performance.ino +++ b/libraries/AD9833/examples/AD9833_performance/AD9833_performance.ino @@ -7,6 +7,7 @@ #include "AD9833.h" + // ESP32 // SPIClass * myspi = new SPIClass(VSPI); // AD9833 AD(5, myspi); @@ -27,6 +28,8 @@ void setup() Serial.println(AD9833_LIB_VERSION); delay(10); + SPI.begin(); + AD.begin(); Serial.print("hardware:\t"); diff --git a/libraries/AD9833/examples/AD9833_switch_channel/AD9833_switch_channel.ino b/libraries/AD9833/examples/AD9833_switch_channel/AD9833_switch_channel.ino index a028673e..235c9e48 100644 --- a/libraries/AD9833/examples/AD9833_switch_channel/AD9833_switch_channel.ino +++ b/libraries/AD9833/examples/AD9833_switch_channel/AD9833_switch_channel.ino @@ -18,6 +18,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setWave(AD9833_SINE); diff --git a/libraries/AD9833/examples/AD9833_switch_phase/AD9833_switch_phase.ino b/libraries/AD9833/examples/AD9833_switch_phase/AD9833_switch_phase.ino index 831da1d2..459a2c1a 100644 --- a/libraries/AD9833/examples/AD9833_switch_phase/AD9833_switch_phase.ino +++ b/libraries/AD9833/examples/AD9833_switch_phase/AD9833_switch_phase.ino @@ -18,6 +18,8 @@ void setup() Serial.begin(115200); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setWave(AD9833_SINE); diff --git a/libraries/AD9833/examples/AD9833_test_10/AD9833_test_10.ino b/libraries/AD9833/examples/AD9833_test_10/AD9833_test_10.ino index 11b1419e..0e49690d 100644 --- a/libraries/AD9833/examples/AD9833_test_10/AD9833_test_10.ino +++ b/libraries/AD9833/examples/AD9833_test_10/AD9833_test_10.ino @@ -15,6 +15,8 @@ void setup() while(!Serial); Serial.println(__FILE__); + SPI.begin(); + AD.begin(); AD.setFrequency(1000, 0); AD.setFrequency(1000, 0); diff --git a/libraries/AD9833/library.json b/libraries/AD9833/library.json index 5921c9d4..65ae2853 100644 --- a/libraries/AD9833/library.json +++ b/libraries/AD9833/library.json @@ -15,7 +15,7 @@ "type": "git", "url": "https://github.com/RobTillaart/AD9833.git" }, - "version": "0.3.1", + "version": "0.4.0", "license": "MIT", "frameworks": "*", "platforms": "*", diff --git a/libraries/AD9833/library.properties b/libraries/AD9833/library.properties index a980a6a7..a46eec0f 100644 --- a/libraries/AD9833/library.properties +++ b/libraries/AD9833/library.properties @@ -1,5 +1,5 @@ name=AD9833 -version=0.3.1 +version=0.4.0 author=Rob Tillaart maintainer=Rob Tillaart sentence=Arduino library for AD9833 function generator. Supports hardware SPI and software SPI.