Fix compile error with DUE + MAX6675 (#13086)
This commit is contained in:
parent
ab6908a513
commit
3c49396370
@ -33,21 +33,22 @@ class SPIclass {
|
||||
FORCE_INLINE static uint8_t receive() { return softSPI.receive(); }
|
||||
};
|
||||
|
||||
|
||||
// Hardware SPI
|
||||
template<>
|
||||
class SPIclass<MISO_PIN, MOSI_PIN, SCK_PIN> {
|
||||
public:
|
||||
FORCE_INLINE static void init() {
|
||||
OUT_WRITE(SCK_PIN, LOW);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
SET_INPUT(MISO_PIN);
|
||||
WRITE(MISO_PIN, HIGH);
|
||||
OUT_WRITE(SCK_PIN, LOW);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
SET_INPUT_PULLUP(MISO_PIN);
|
||||
}
|
||||
FORCE_INLINE static uint8_t receive() {
|
||||
SPDR = 0;
|
||||
for (;!TEST(SPSR, SPIF););
|
||||
return SPDR;
|
||||
#if defined(__AVR__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__)
|
||||
SPDR = 0;
|
||||
for (;!TEST(SPSR, SPIF););
|
||||
return SPDR;
|
||||
#else
|
||||
return spiRec();
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -33,7 +33,9 @@
|
||||
#include "../core/language.h"
|
||||
#include "../HAL/shared/Delay.h"
|
||||
|
||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||
#define MAX6675_SEPARATE_SPI (ENABLED(HEATER_0_USES_MAX6675) || ENABLED(HEATER_1_USES_MAX6675)) && PIN_EXISTS(MAX6675_SCK) && PIN_EXISTS(MAX6675_DO)
|
||||
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
#include "../libs/private_spi.h"
|
||||
#endif
|
||||
|
||||
@ -1205,13 +1207,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
||||
|
||||
#endif
|
||||
|
||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||
#ifndef MAX6675_SCK_PIN
|
||||
#define MAX6675_SCK_PIN SCK_PIN
|
||||
#endif
|
||||
#ifndef MAX6675_DO_PIN
|
||||
#define MAX6675_DO_PIN MISO_PIN
|
||||
#endif
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
SPIclass<MAX6675_DO_PIN, MOSI_PIN, MAX6675_SCK_PIN> max6675_spi;
|
||||
#endif
|
||||
|
||||
@ -1289,7 +1285,7 @@ void Temperature::init() {
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if ENABLED(HEATER_0_USES_MAX6675)
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
|
||||
OUT_WRITE(SCK_PIN, LOW);
|
||||
OUT_WRITE(MOSI_PIN, HIGH);
|
||||
@ -1300,7 +1296,7 @@ void Temperature::init() {
|
||||
OUT_WRITE(SS_PIN, HIGH);
|
||||
OUT_WRITE(MAX6675_SS_PIN, HIGH);
|
||||
|
||||
#endif // HEATER_0_USES_MAX6675
|
||||
#endif
|
||||
|
||||
#if ENABLED(HEATER_1_USES_MAX6675)
|
||||
OUT_WRITE(MAX6675_SS2_PIN, HIGH);
|
||||
@ -1792,7 +1788,7 @@ void Temperature::disable_all_heaters() {
|
||||
//
|
||||
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
||||
//
|
||||
#if MB(MIGHTYBOARD_REVE)
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
spiBegin();
|
||||
spiInit(MAX6675_SPEED_BITS);
|
||||
#endif
|
||||
@ -1813,7 +1809,7 @@ void Temperature::disable_all_heaters() {
|
||||
max6675_temp = 0;
|
||||
for (uint8_t i = sizeof(max6675_temp); i--;) {
|
||||
max6675_temp |= (
|
||||
#if MB(MIGHTYBOARD_REVE)
|
||||
#if MAX6675_SEPARATE_SPI
|
||||
max6675_spi.receive()
|
||||
#else
|
||||
spiRec()
|
||||
|
Loading…
Reference in New Issue
Block a user