Skip to content

Commit

Permalink
Fix NULL-pointer assignment to object
Browse files Browse the repository at this point in the history
  • Loading branch information
AnHardt committed Sep 29, 2020
1 parent 5d1c84e commit e87442c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
13 changes: 5 additions & 8 deletions Adafruit_MAX31865.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,18 @@
/**************************************************************************/
//
Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs, int8_t spi_mosi,
int8_t spi_miso, int8_t spi_clk) {
spi_dev = Adafruit_SPIDevice(spi_cs, spi_clk, spi_miso, spi_mosi, 1000000,
SPI_BITORDER_MSBFIRST, SPI_MODE1);
}
int8_t spi_miso, int8_t spi_clk)
: spi_dev(spi_cs, spi_clk, spi_miso, spi_mosi, 1000000,
SPI_BITORDER_MSBFIRST, SPI_MODE1) {}

/**************************************************************************/
/*!
@brief Create the interface object using hardware SPI
@param spi_cs the SPI CS pin to use along with the default SPI device
*/
/**************************************************************************/
Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs) {
spi_dev =
Adafruit_SPIDevice(spi_cs, 1000000, SPI_BITORDER_MSBFIRST, SPI_MODE1);
}
Adafruit_MAX31865::Adafruit_MAX31865(int8_t spi_cs)
: spi_dev(spi_cs, 1000000, SPI_BITORDER_MSBFIRST, SPI_MODE1) {}

/**************************************************************************/
/*!
Expand Down
2 changes: 1 addition & 1 deletion Adafruit_MAX31865.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Adafruit_MAX31865 {
float temperature(float RTDnominal, float refResistor);

private:
Adafruit_SPIDevice spi_dev = NULL;
Adafruit_SPIDevice spi_dev;

void readRegisterN(uint8_t addr, uint8_t buffer[], uint8_t n);

Expand Down

0 comments on commit e87442c

Please sign in to comment.