Skip to content

Commit 14c4ac4

Browse files
authored
Merge pull request #44 from KurtE/specify_which_spi
Allow code to specify which SPI buss to use
2 parents af5b20d + 080a67c commit 14c4ac4

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

Adafruit_MAX31855.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,11 @@ Adafruit_MAX31855::Adafruit_MAX31855(int8_t _sclk, int8_t _cs, int8_t _miso)
5959
@brief Instantiates a new Adafruit_MAX31855 class using hardware SPI.
6060
6161
@param _cs The pin to use for SPI Chip Select.
62+
@param _spi which spi buss to use.
6263
*/
6364
/**************************************************************************/
64-
Adafruit_MAX31855::Adafruit_MAX31855(int8_t _cs) : spi_dev(_cs, 1000000) {}
65+
Adafruit_MAX31855::Adafruit_MAX31855(int8_t _cs, SPIClass *_spi)
66+
: spi_dev(_cs, 1000000, SPI_BITORDER_MSBFIRST, SPI_MODE0, _spi) {}
6567

6668
/**************************************************************************/
6769
/*!

Adafruit_MAX31855.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
class Adafruit_MAX31855 {
3838
public:
3939
Adafruit_MAX31855(int8_t _sclk, int8_t _cs, int8_t _miso);
40-
Adafruit_MAX31855(int8_t _cs);
40+
Adafruit_MAX31855(int8_t _cs, SPIClass *_spi = &SPI);
4141

4242
bool begin(void);
4343
double readInternal(void);

examples/serialthermocouple/serialthermocouple.ino

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ Adafruit_MAX31855 thermocouple(MAXCLK, MAXCS, MAXDO);
3434
//#define MAXCS 10
3535
//Adafruit_MAX31855 thermocouple(MAXCS);
3636

37+
// Example creating a thermocouple instance with hardware SPI
38+
// on SPI1 using specified CS pin.
39+
//#define MAXCS 10
40+
//Adafruit_MAX31855 thermocouple(MAXCS, SPI1);
41+
3742
void setup() {
3843
Serial.begin(9600);
3944

0 commit comments

Comments
 (0)