Skip to content

Commit

Permalink
Improve SPI dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
RobTillaart committed Jan 19, 2024
1 parent a35c109 commit 90907cd
Show file tree
Hide file tree
Showing 21 changed files with 50 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).


## [0.6.0] - 2024-01-19
- Fix #31, improve SPI dependency

----

## [0.5.0] - 2023-11-29
- refactor constructor/begin interface - breaking changes.
- minimize conditional code. -- create SPI_CLASS macro to solve it.
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) 2014-2023 Rob Tillaart
Copyright (c) 2014-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
8 changes: 4 additions & 4 deletions MAX31855.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//
// FILE: MAX31855.cpp
// AUTHOR: Rob Tillaart
// VERSION: 0.5.0
// VERSION: 0.6.0
// PURPOSE: Arduino library for MAX31855 chip for K type thermocouple
// DATE: 2014-01-01
// URL: https://github.com/RobTillaart/MAX31855_RT
Expand Down Expand Up @@ -48,9 +48,9 @@ void MAX31855::begin()

if (_hwSPI)
{
_mySPI->end();
_mySPI->begin();
delay(1);
// _mySPI->end();
// _mySPI->begin();
// delay(1);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions MAX31855.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// FILE: MAX31855.h
// AUTHOR: Rob Tillaart
// VERSION: 0.5.0
// VERSION: 0.6.0
// PURPOSE: Arduino library for MAX31855 chip for K type thermocouple
// DATE: 2014-01-01
// URL: https://github.com/RobTillaart/MAX31855_RT
Expand All @@ -25,7 +25,7 @@
#include "SPI.h"


#define MAX31855_VERSION (F("0.5.0"))
#define MAX31855_VERSION (F("0.6.0"))

#ifndef __SPI_CLASS__
#if defined(ARDUINO_ARCH_RP2040)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ Library tested with breakout board.
```


#### 0.6.0 Breaking change

Version 0.6.0 introduced a breaking change to improve handling the SPI dependency.
The user has to call **SPI.begin()** or equivalent before calling **MX.begin()**.
Optionally the user can provide parameters to the **SPI.begin(...)**


#### 0.5.0 Breaking change

The version 0.5.0 has breaking changes in the interface.
Expand Down
3 changes: 2 additions & 1 deletion examples/Demo_getRawData/Demo_getRawData.ino
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// PURPOSE: thermocouple lib demo application
// DATE: 2020-08-24
// URL: https://github.com/RobTillaart/MAX31855_RT
//


#include "MAX31855.h"
Expand All @@ -26,6 +25,8 @@ void setup ()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
}

Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_ESP32_HSPI/max31855_ESP32_HSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
thermoCouple.setSPIspeed(1000000);
}
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_ESP32_VSPI/max31855_ESP32_VSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ void setup()
Serial.println();
delay(250);

myspi->begin();

thermoCouple.begin();
thermoCouple.setSPIspeed(16000000);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/max31855_array/max31855_array.ino
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
// URL: https://github.com/RobTillaart/MAX31855_RT
//
// kudos to FabioBrondo for the idea.
//


#include "MAX31855.h"
Expand Down Expand Up @@ -35,6 +34,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

Serial.println(sensorCount);

for (int i = 0; i < sensorCount; i++)
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo0/max31855_demo0.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
}

Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo1/max31855_demo1.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
}

Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo2/max31855_demo2.ino
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();

thermoCouple.read();
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo3/max31855_demo3.ino
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();

uint32_t start = micros();
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo4/max31855_demo4.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();

uint32_t start = micros();
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo5/max31855_demo5.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();

thermoCouple.read();
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_demo6/max31855_demo6.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();

thermoCouple.read();
Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_hwSPI/max31855_hwSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
}

Expand Down
2 changes: 2 additions & 0 deletions examples/max31855_swSPI/max31855_swSPI.ino
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
thermoCouple.setSWSPIdelay(4); // add 4 us per bit to improve signal.
}
Expand Down
4 changes: 3 additions & 1 deletion examples/max31855_test_error/max31855_test_error.ino
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ void setup()
Serial.println();
delay(250);

SPI.begin();

thermoCouple.begin();
}

Expand All @@ -35,7 +37,7 @@ void loop()
int status = thermoCouple.read();
Serial.print("stat:\t\t");
Serial.println(status);

if (thermoCouple.getStatus())
{
Serial.print("error:\t\t");
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/MAX31855_RT"
},
"version": "0.5.0",
"version": "0.6.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=MAX31855_RT
version=0.5.0
version=0.6.0
author=Rob Tillaart <[email protected]>
maintainer=Rob Tillaart <[email protected]>
sentence=Arduino library for MAX31855 chip for K type thermocouple.
Expand Down

0 comments on commit 90907cd

Please sign in to comment.