|
|
@ -33,7 +33,9 @@
|
|
|
|
#include "../core/language.h"
|
|
|
|
#include "../core/language.h"
|
|
|
|
#include "../HAL/shared/Delay.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"
|
|
|
|
#include "../libs/private_spi.h"
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1205,13 +1207,7 @@ void Temperature::updateTemperaturesFromRawValues() {
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
|
|
|
#if MAX6675_SEPARATE_SPI
|
|
|
|
#ifndef MAX6675_SCK_PIN
|
|
|
|
|
|
|
|
#define MAX6675_SCK_PIN SCK_PIN
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MAX6675_DO_PIN
|
|
|
|
|
|
|
|
#define MAX6675_DO_PIN MISO_PIN
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SPIclass<MAX6675_DO_PIN, MOSI_PIN, MAX6675_SCK_PIN> max6675_spi;
|
|
|
|
SPIclass<MAX6675_DO_PIN, MOSI_PIN, MAX6675_SCK_PIN> max6675_spi;
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
@ -1289,7 +1285,7 @@ void Temperature::init() {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HEATER_0_USES_MAX6675)
|
|
|
|
#if MAX6675_SEPARATE_SPI
|
|
|
|
|
|
|
|
|
|
|
|
OUT_WRITE(SCK_PIN, LOW);
|
|
|
|
OUT_WRITE(SCK_PIN, LOW);
|
|
|
|
OUT_WRITE(MOSI_PIN, HIGH);
|
|
|
|
OUT_WRITE(MOSI_PIN, HIGH);
|
|
|
@ -1300,7 +1296,7 @@ void Temperature::init() {
|
|
|
|
OUT_WRITE(SS_PIN, HIGH);
|
|
|
|
OUT_WRITE(SS_PIN, HIGH);
|
|
|
|
OUT_WRITE(MAX6675_SS_PIN, HIGH);
|
|
|
|
OUT_WRITE(MAX6675_SS_PIN, HIGH);
|
|
|
|
|
|
|
|
|
|
|
|
#endif // HEATER_0_USES_MAX6675
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
|
|
|
#if ENABLED(HEATER_1_USES_MAX6675)
|
|
|
|
OUT_WRITE(MAX6675_SS2_PIN, HIGH);
|
|
|
|
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.
|
|
|
|
// TODO: spiBegin, spiRec and spiInit doesn't work when soft spi is used.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
#if MB(MIGHTYBOARD_REVE)
|
|
|
|
#if MAX6675_SEPARATE_SPI
|
|
|
|
spiBegin();
|
|
|
|
spiBegin();
|
|
|
|
spiInit(MAX6675_SPEED_BITS);
|
|
|
|
spiInit(MAX6675_SPEED_BITS);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -1813,7 +1809,7 @@ void Temperature::disable_all_heaters() {
|
|
|
|
max6675_temp = 0;
|
|
|
|
max6675_temp = 0;
|
|
|
|
for (uint8_t i = sizeof(max6675_temp); i--;) {
|
|
|
|
for (uint8_t i = sizeof(max6675_temp); i--;) {
|
|
|
|
max6675_temp |= (
|
|
|
|
max6675_temp |= (
|
|
|
|
#if MB(MIGHTYBOARD_REVE)
|
|
|
|
#if MAX6675_SEPARATE_SPI
|
|
|
|
max6675_spi.receive()
|
|
|
|
max6675_spi.receive()
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|
spiRec()
|
|
|
|
spiRec()
|
|
|
|