Skip to content

Commit

Permalink
Fix HAL compile errors for the thermistor
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Berseth committed Feb 3, 2025
1 parent dce344a commit 780c170
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/Thermistor/library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Thermistor
version=0.0.1
version=0.0.2
author=Eric Berseth <eric.berseth@particle.io>
license=Apache License, Version 2.0
sentence=Library to implement a thermistor temperature reader
Expand Down
8 changes: 7 additions & 1 deletion lib/Thermistor/src/thermistor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 780c170

Please sign in to comment.