Skip to content

Commit

Permalink
Fix #15, improve SPI dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Jan 20, 2024
1 parent 0ee7472 commit 349b73e
Show file tree
Hide file tree
Showing 14 changed files with 42 additions and 10 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ 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 #15, improve handling SPI dependency.
- update examples

----

## [0.3.0] - 2023-12-01
- refactor constructor interface - breaking changes.
- minimize conditional code. -- create SPI_CLASS macro to solve it.
Expand Down
8 changes: 4 additions & 4 deletions DAC8554.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// FILE: DAC8554.cpp
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for DAC8554 SPI Digital Analog Convertor
// VERSION: 0.3.0
// VERSION: 0.4.0
// DATE: 2017-12-19
// URL: https://github.com/RobTillaart/DAC8554

Expand Down Expand Up @@ -49,9 +49,9 @@ void DAC8554::begin()

if(_hwSPI)
{
_mySPI->end();
_mySPI->begin();
delay(1);
// _mySPI->end();
// _mySPI->begin();
// delay(1);
}
else // SOFTWARE SPI
{
Expand Down
4 changes: 2 additions & 2 deletions DAC8554.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
// FILE: DAC8554.h
// AUTHOR: Rob Tillaart
// PURPOSE: Arduino library for DAC8554 SPI Digital Analog Convertor
// VERSION: 0.3.0
// VERSION: 0.4.0
// DATE: 2017-12-19
// URL: https://github.com/RobTillaart/DAC8554
//

#include "Arduino.h"
#include "SPI.h"

#define DAC8554_LIB_VERSION (F("0.3.0"))
#define DAC8554_LIB_VERSION (F("0.4.0"))

#define DAC8554_POWERDOWN_NORMAL 0x00
#define DAC8554_POWERDOWN_1K 0x40
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2023 Rob Tillaart
Copyright (c) 2017-2024 Rob Tillaart

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ The DAC8554 is a SPI based 16 bit DAC with four channels.
**Warning** This library is not tested extensively


#### 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 **DAC.begin()**.
Optionally the user can provide parameters to the **SPI.begin(...)**


#### 0.3.0 Breaking change

The version 0.3.0 has breaking changes in the interface.
Expand Down
2 changes: 2 additions & 0 deletions examples/DAC8534_sw_spi/DAC8534_sw_spi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();
}

Expand Down
6 changes: 5 additions & 1 deletion examples/DAC8554_broadcast/DAC8554_broadcast.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

#include "DAC8554.h"

// note address as param

// note address as parameter
DAC8554 DAC_A(10, &SPI, 0);
DAC8554 DAC_B(11, &SPI, 1);

Expand All @@ -17,6 +18,9 @@ void setup()
Serial.begin(115200);
Serial.println(__FILE__);
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

DAC_A.begin();
DAC_B.begin();

Expand Down
3 changes: 3 additions & 0 deletions examples/DAC8554_hw_spi/DAC8554_hw_spi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "DAC8554.h"


DAC8554 mydac(10);


Expand All @@ -17,6 +18,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();
}

Expand Down
3 changes: 3 additions & 0 deletions examples/DAC8554_powerdown/DAC8554_powerdown.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "DAC8554.h"


// HW SPI
DAC8554 mydac(10);

Expand All @@ -23,6 +24,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();

mydac.setValue(chanA, 0);
Expand Down
3 changes: 3 additions & 0 deletions examples/DAC8554_same_time_write/DAC8554_same_time_write.ino
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include "DAC8554.h"


// HW SPI
DAC8554 mydac(10);

Expand All @@ -21,6 +22,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();
}

Expand Down
2 changes: 2 additions & 0 deletions examples/DAC8554_sw_spi/DAC8554_sw_spi.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ void setup()
Serial.print("DAC8554_LIB_VERSION: ");
Serial.println(DAC8554_LIB_VERSION);

SPI.begin();

mydac.begin();
}

Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "git",
"url": "https://github.com/RobTillaart/DAC8554"
},
"version": "0.3.0",
"version": "0.4.0",
"license": "MIT",
"frameworks": "*",
"platforms": "*",
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=DAC8554
version=0.3.0
version=0.4.0
author=Rob Tillaart <rob.tillaart@gmail.com>
maintainer=Rob Tillaart <rob.tillaart@gmail.com>
sentence=Arduino library for DAC8534 and DAC8554 SPI Digital Analog Convertor.
Expand Down

0 comments on commit 349b73e

Please sign in to comment.