From 780c1701196e344fecaea1f5d71ef12d917191f6 Mon Sep 17 00:00:00 2001 From: Eric Berseth Date: Mon, 3 Feb 2025 10:53:59 -0800 Subject: [PATCH] Fix HAL compile errors for the thermistor --- lib/Thermistor/library.properties | 2 +- lib/Thermistor/src/thermistor.h | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/Thermistor/library.properties b/lib/Thermistor/library.properties index 5301f7f..914961b 100644 --- a/lib/Thermistor/library.properties +++ b/lib/Thermistor/library.properties @@ -1,5 +1,5 @@ name=Thermistor -version=0.0.1 +version=0.0.2 author=Eric Berseth license=Apache License, Version 2.0 sentence=Library to implement a thermistor temperature reader diff --git a/lib/Thermistor/src/thermistor.h b/lib/Thermistor/src/thermistor.h index 18edcdd..468889f 100644 --- a/lib/Thermistor/src/thermistor.h +++ b/lib/Thermistor/src/thermistor.h @@ -21,6 +21,12 @@ namespace particle { +#if ( SYSTEM_VERSION >= SYSTEM_VERSION_DEFAULT(6, 2, 0) ) +#define PIN_VALIDATE hal_pin_validate_function +#else +#define PIN_VALIDATE HAL_Validate_Pin_Function +#endif // SYSTEM_VERSION + /** * @brief Resistor divider circuit used for thermistor. * @@ -114,7 +120,7 @@ class Thermistor { CHECK_TRUE((checkPin < FIRST_ANALOG_PIN + TOTAL_ANALOG_PINS), SYSTEM_ERROR_INVALID_ARGUMENT); checkPin += FIRST_ANALOG_PIN; CHECK_TRUE(pinAvailable(checkPin), SYSTEM_ERROR_ALREADY_EXISTS); - CHECK_TRUE((HAL_Validate_Pin_Function(checkPin, PF_ADC) == PF_ADC), SYSTEM_ERROR_IO); + CHECK_TRUE((PIN_VALIDATE(checkPin, PF_ADC) == PF_ADC), SYSTEM_ERROR_IO); // Various configuration checks CHECK_TRUE((config.adcResolution > 1.0), SYSTEM_ERROR_INVALID_ARGUMENT);