0.4.0 AD9833

This commit is contained in:
Rob Tillaart 2024-01-20 09:54:40 +01:00
parent a8d0b7d8d7
commit 0ba51433c8
15 changed files with 40 additions and 9 deletions

View File

@ -2,7 +2,7 @@
// FILE: AD9833.cpp // FILE: AD9833.cpp
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for AD9833 function generator // PURPOSE: Arduino library for AD9833 function generator
// VERSION: 0.3.1 // VERSION: 0.4.0
// URL: https://github.com/RobTillaart/AD9833 // URL: https://github.com/RobTillaart/AD9833
// //
@ -58,8 +58,8 @@ void AD9833::begin()
if (_hwSPI) if (_hwSPI)
{ {
_mySPI->end(); // _mySPI->end();
_mySPI->begin(); // _mySPI->begin();
} }
else // SOFTWARE SPI else // SOFTWARE SPI
{ {

View File

@ -3,7 +3,7 @@
// FILE: AD9833.h // FILE: AD9833.h
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for AD9833 function generator. // PURPOSE: Arduino library for AD9833 function generator.
// VERSION: 0.3.1 // VERSION: 0.4.0
// URL: https://github.com/RobTillaart/AD9833 // URL: https://github.com/RobTillaart/AD9833
@ -11,7 +11,7 @@
#include "SPI.h" #include "SPI.h"
#define AD9833_LIB_VERSION (F("0.3.1")) #define AD9833_LIB_VERSION (F("0.4.0"))
#if !defined(__SPI_CLASS__) #if !defined(__SPI_CLASS__)

View File

@ -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/). 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 ## [0.3.1] - 2024-01-12
- Fix #12, make crystal adjustable (experimental implementation). - Fix #12, make crystal adjustable (experimental implementation).
- add **bool setCrystalFrequency(uint32_t crystal = 25000000)** - add **bool setCrystalFrequency(uint32_t crystal = 25000000)**
- add **uint32_t getCrystalFrequency()** - add **uint32_t getCrystalFrequency()**
- update readme.md - update readme.md
## [0.3.0] - 2023-11-26 ## [0.3.0] - 2023-11-26
- fix #10, explicit write control register fixes glitch. - fix #10, explicit write control register fixes glitch.
- rename **writeFreqRegister()** to **writeFrequencyRegister()** - rename **writeFreqRegister()** to **writeFrequencyRegister()**

View File

@ -59,6 +59,13 @@ please let me know by opening an issue.
Probably they need a dedicated library based on this one. 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 #### 0.2.0 breaking change
The version 0.2.0 has breaking changes in the interface. The version 0.2.0 has breaking changes in the interface.

View File

@ -17,6 +17,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setWave(AD9833_SQUARE1); AD.setWave(AD9833_SQUARE1);

View File

@ -15,6 +15,8 @@ void setup()
while(!Serial); while(!Serial);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setFrequency(1000, 0); AD.setFrequency(1000, 0);
AD.setFrequency(1000, 0); AD.setFrequency(1000, 0);

View File

@ -16,6 +16,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setFrequency(1000, 0); // 1000 Hz. AD.setFrequency(1000, 0); // 1000 Hz.

View File

@ -24,6 +24,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
myspi->begin();
AD.begin(); AD.begin();
AD.setFrequency(1000, 0); // 1000 Hz. AD.setFrequency(1000, 0); // 1000 Hz.

View File

@ -3,7 +3,7 @@
// AUTHOR: Rob Tillaart // AUTHOR: Rob Tillaart
// PURPOSE: demo AD9833 wave form generator on 4 devices // PURPOSE: demo AD9833 wave form generator on 4 devices
// //
// todo: test with hardware // TODO: test with hardware
#include "AD9833.h" #include "AD9833.h"
@ -23,6 +23,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
for (int i = 0; i < 3; i++) for (int i = 0; i < 3; i++)
{ {
AD[i].begin(); AD[i].begin();

View File

@ -7,6 +7,7 @@
#include "AD9833.h" #include "AD9833.h"
// ESP32 // ESP32
// SPIClass * myspi = new SPIClass(VSPI); // SPIClass * myspi = new SPIClass(VSPI);
// AD9833 AD(5, myspi); // AD9833 AD(5, myspi);
@ -27,6 +28,8 @@ void setup()
Serial.println(AD9833_LIB_VERSION); Serial.println(AD9833_LIB_VERSION);
delay(10); delay(10);
SPI.begin();
AD.begin(); AD.begin();
Serial.print("hardware:\t"); Serial.print("hardware:\t");

View File

@ -18,6 +18,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setWave(AD9833_SINE); AD.setWave(AD9833_SINE);

View File

@ -18,6 +18,8 @@ void setup()
Serial.begin(115200); Serial.begin(115200);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setWave(AD9833_SINE); AD.setWave(AD9833_SINE);

View File

@ -15,6 +15,8 @@ void setup()
while(!Serial); while(!Serial);
Serial.println(__FILE__); Serial.println(__FILE__);
SPI.begin();
AD.begin(); AD.begin();
AD.setFrequency(1000, 0); AD.setFrequency(1000, 0);
AD.setFrequency(1000, 0); AD.setFrequency(1000, 0);

View File

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

View File

@ -1,5 +1,5 @@
name=AD9833 name=AD9833
version=0.3.1 version=0.4.0
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 AD9833 function generator. Supports hardware SPI and software SPI. sentence=Arduino library for AD9833 function generator. Supports hardware SPI and software SPI.