Skip to content

Commit

Permalink
Changed some #defines to be bracketed by #ifndef
Browse files Browse the repository at this point in the history
Fixed incorrect reference to MD_cmdProcessor location
  • Loading branch information
MajicDesigns committed Feb 3, 2024
1 parent dae08eb commit 9c5fefd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/MD_AD9833_Test/MD_AD9833_Test.ino
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// hardware using the library functions.
//
// Dependencies:
// MD_cmdProcessor is available at https://github.com/MajicDesigns/MD_AD9833
// MD_cmdProcessor is available at https://github.com/MajicDesigns/MD_cmdProcessor or Arduino Library Manager
//

#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=MD_AD9833
version=1.2.3
version=1.2.4
author=majicDesigns
maintainer=marco_c <[email protected]>
sentence=Library for using a AD9833 Programmable Waveform Generator.
Expand Down
4 changes: 2 additions & 2 deletions src/MD_AD9833.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ void MD_AD9833::reset(bool hold)
}

void MD_AD9833::begin(void)
// Initialise the AD9833 and then set up safe values for the AD9833 device
// Initialize the AD9833 and then set up safe values for the AD9833 device
// Procedure from Figure 27 of in the AD9833 Data Sheet
{
// initialize the SPI interface
Expand All @@ -128,7 +128,7 @@ void MD_AD9833::begin(void)
pinMode(_clkPin, OUTPUT);
}

// initialise our preferred CS pin (could be same as SS)
// initialize our preferred CS pin (could be same as SS)
pinMode(_fsyncPin, OUTPUT);
digitalWrite(_fsyncPin, HIGH);

Expand Down
5 changes: 4 additions & 1 deletion src/MD_AD9833.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,12 @@ Topics
- \subpage pageDonation
\page pageRevHistory Revision History
Aug 2023 version 1.2.4
- Changed some #defines to be bracketed by #ifndef
Aug 2023 version 1.2.3
- Corrected documentation errors
- Reworked code to prevent unncessary ESP32 compiler warnings
- Reworked code to prevent unnecessary ESP32 compiler warnings
Feb 2021 version 1.2.2
- Fixed problem of SQ1 and SQ2 to off leaving high signal.
Expand Down
28 changes: 17 additions & 11 deletions src/MD_AD9833_lib.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,29 @@ See the main header file for full information
* \brief Includes library-only definitions for AD_9833 library
*/

#define AD_DEBUG 0 ///< Enable or disable (default) debugging output from the MD_AD9833 library
#define AD_DEBUG 0 ///< Enable or disable (default) debugging output from the MD_AD9833 library

#if AD_DEBUG
#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); } ///< Print a string followed by a value (decimal)
#define PRINTX(s, v) { Serial.print(F(s)); Serial.print(" 0x"); Serial.print(v, HEX); } ///< Print a string followed by a value (hex)
#define PRINTB(s, v) { Serial.print(F(s)); Serial.print(v, BIN); } ///< Print a string followed by a value (binary)
#define PRINTS(s) { Serial.print(F(s)); } ///< Print a string
#define PRINT(s, v) { Serial.print(F(s)); Serial.print(v); } ///< Print a string followed by a value (decimal)
#define PRINTX(s, v) { Serial.print(F(s)); Serial.print(" 0x"); Serial.print(v, HEX); } ///< Print a string followed by a value (hex)
#define PRINTB(s, v) { Serial.print(F(s)); Serial.print(v, BIN); } ///< Print a string followed by a value (binary)
#define PRINTS(s) { Serial.print(F(s)); } ///< Print a string
#else
#define PRINT(s, v) ///< Print a string followed by a value (decimal)
#define PRINTX(s, v) ///< Print a string followed by a value (hex)
#define PRINTB(s, v) ///< Print a string followed by a value (binary)
#define PRINTS(s) ///< Print a string
#define PRINT(s, v) ///< Print a string followed by a value (decimal)
#define PRINTX(s, v) ///< Print a string followed by a value (hex)
#define PRINTB(s, v) ///< Print a string followed by a value (binary)
#define PRINTS(s) ///< Print a string
#endif

/** \name Library defaults
* @{
*/
#define AD_DEFAULT_FREQ 1000 ///< Default initialisation frequency (Hz)
#define AD_DEFAULT_PHASE 0 ///< Default initialisation phase angle (degrees)
#ifndef AD_DEFAULT_FREQ
#define AD_DEFAULT_FREQ 1000 ///< Default initialization frequency (Hz)
#endif
#ifndef AD_DEFAULT_PHASE
#define AD_DEFAULT_PHASE 0 ///< Default initialization phase angle (degrees)
#endif

/** @}*/

Expand Down Expand Up @@ -83,7 +87,9 @@ const uint8_t AD_PHASE = 13; ///< Select the phase register

/** \name AD9833 frequency and phase calculation macros
* @{ */
#ifndef AD_MCLK
#define AD_MCLK 25000000UL ///< Clock speed of the AD9833 reference clock in Hz
#endif
#define AD_2POW28 (1UL << 28) ///< Used when calculating output frequency

/** @} */

0 comments on commit 9c5fefd

Please sign in to comment.