MAX Thermocouples rework (#20447)

Co-authored-by: Scott Lahteine <github@thinkyhead.com>
This commit is contained in:
JoAnn Manges
2021-02-08 20:51:57 -05:00
committed by GitHub
parent 0127763ade
commit 8707ae23e2
5 changed files with 266 additions and 56 deletions

View File

@ -490,6 +490,90 @@
#define HAS_MAX6675 1
#endif
//
// Compatibility layer for MAX (SPI) temp boards
//
#if PIN_EXISTS(MAX6675_SS)
#if TEMP_SENSOR_0_IS_MAX31855
#define MAX31855_CS_PIN MAX6675_SS_PIN
#elif TEMP_SENSOR_0_IS_MAX31865
#define MAX31865_CS_PIN MAX6675_SS_PIN
#elif TEMP_SENSOR_0_IS_MAX6675
#define MAX6675_CS_PIN MAX6675_SS_PIN
#endif
#endif
#if PIN_EXISTS(MAX6675_SS2)
#if TEMP_SENSOR_1_IS_MAX31855
#define MAX31855_CS2_PIN MAX6675_SS2_PIN
#elif TEMP_SENSOR_1_IS_MAX31865
#define MAX31865_CS2_PIN MAX6675_SS2_PIN
#elif TEMP_SENSOR_1_IS_MAX6675
#define MAX6675_CS2_PIN MAX6675_SS2_PIN
#endif
#endif
#if PIN_EXISTS(MAX6675_DO)
#if HAS_MAX31855
#define MAX31855_MISO_PIN MAX6675_DO_PIN
#elif HAS_MAX31865
#define MAX31865_MISO_PIN MAX6675_DO_PIN
#elif HAS_MAX6675
#define MAX6675_MISO_PIN MAX6675_DO_PIN
#endif
#endif
#if PIN_EXISTS(MAX6675_SCK)
#if HAS_MAX31855
#define MAX31855_SCK_PIN MAX6675_SCK_PIN
#elif HAS_MAX31865
#define MAX31865_SCK_PIN MAX6675_SCK_PIN
#endif
#endif
// Compatibility Layer for use when HAL manipulates PINS for MAX31855 and MAX6675
#if PIN_EXISTS(MAX31855_CS) && !PIN_EXISTS(MAX6675_SS)
#define MAX6675_SS_PIN MAX31855_CS_PIN
#endif
#if PIN_EXISTS(MAX31855_CS2) && !PIN_EXISTS(MAX6675_SS2)
#define MAX6675_SS2_PIN MAX31855_CS2_PIN
#endif
#if PIN_EXISTS(MAX6675_CS) && !PIN_EXISTS(MAX6675_SS)
#define MAX6675_SS_PIN MAX6675_CS_PIN
#endif
#if PIN_EXISTS(MAX6675_CS2) && !PIN_EXISTS(MAX6675_SS2)
#define MAX6675_SS2_PIN MAX6675_CS2_PIN
#endif
#if PIN_EXISTS(MAX31855_MISO) && !PIN_EXISTS(MAX6675_DO)
#define MAX6675_DO_PIN MAX31855_MISO_PIN
#endif
#if PIN_EXISTS(MAX6675_MISO) && !PIN_EXISTS(MAX6675_DO)
#define MAX6675_DO_PIN MAX6675_MISO_PIN
#endif
#if PIN_EXISTS(MAX31855_SCK) && !PIN_EXISTS(MAX6675_SCK)
#define MAX6675_SCK_PIN MAX31855_SCK_PIN
#endif
//
// User-defined thermocouple libraries
//
// Add LIB_MAX6675 / LIB_MAX31855 / LIB_MAX31865 to the build_flags
// to select a USER library for MAX6675, MAX31855, MAX31865
//
#if BOTH(HAS_MAX6675, LIB_MAX6675)
#define LIB_USR_MAX6675 1
#endif
#if BOTH(HAS_MAX31855, LIB_MAX31855)
#define LIB_USR_MAX31855 1
#endif
#if HAS_MAX31865
#if ENABLED(LIB_MAX31865)
#define LIB_USR_MAX31865 1
#else
#define LIB_ADAFRUIT_MAX31865 1
#endif
#endif
#if TEMP_SENSOR_2 == -4
#define TEMP_SENSOR_2_IS_AD8495 1
#elif TEMP_SENSOR_2 == -3