Fix MAX6675 readout with Hardware SPI (#13530)
This commit is contained in:
parent
04086fc455
commit
c9079165ee
@ -1816,19 +1816,23 @@ void Temperature::disable_all_heaters() {
|
|||||||
//
|
//
|
||||||
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
||||||
//
|
//
|
||||||
#if MAX6675_SEPARATE_SPI
|
#if !MAX6675_SEPARATE_SPI
|
||||||
spiBegin();
|
spiBegin();
|
||||||
spiInit(MAX6675_SPEED_BITS);
|
spiInit(MAX6675_SPEED_BITS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if COUNT_6675 > 1
|
#if COUNT_6675 > 1
|
||||||
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
|
#define WRITE_MAX6675(V) do{ switch (hindex) { case 1: WRITE(MAX6675_SS2_PIN, V); break; default: WRITE(MAX6675_SS_PIN, V); } }while(0)
|
||||||
|
#define SET_OUTPUT_MAX6675() do{ switch (hindex) { case 1: SET_OUTPUT(MAX6675_SS2_PIN); break; default: SET_OUTPUT(MAX6675_SS_PIN); } }while(0)
|
||||||
#elif ENABLED(HEATER_1_USES_MAX6675)
|
#elif ENABLED(HEATER_1_USES_MAX6675)
|
||||||
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
|
#define WRITE_MAX6675(V) WRITE(MAX6675_SS2_PIN, V)
|
||||||
|
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS2_PIN)
|
||||||
#else
|
#else
|
||||||
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
|
#define WRITE_MAX6675(V) WRITE(MAX6675_SS_PIN, V)
|
||||||
|
#define SET_OUTPUT_MAX6675() SET_OUTPUT(MAX6675_SS_PIN)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SET_OUTPUT_MAX6675();
|
||||||
WRITE_MAX6675(LOW); // enable TT_MAX6675
|
WRITE_MAX6675(LOW); // enable TT_MAX6675
|
||||||
|
|
||||||
DELAY_NS(100); // Ensure 100ns delay
|
DELAY_NS(100); // Ensure 100ns delay
|
||||||
|
Loading…
Reference in New Issue
Block a user