From 6a8db49d2438d3f6889b9bfe60beb64eb365c70b Mon Sep 17 00:00:00 2001 From: Antoine Beauchamp Date: Wed, 7 Aug 2024 17:14:42 -0400 Subject: [PATCH] Updated delay() function pointer definition. It is now ESP32 proof. ESP32 uses `uint32_t` for time argument. All other supported models (ESP8266, Arduino AVR) uses `unsigned long`. This matches the platform definitions for esp32:esp32 v3.0.4, esp8266:esp8266 v3.1.2 and arduino:avr v1.8.6. --- src/anyrtttl.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/anyrtttl.h b/src/anyrtttl.h index c1887a4..cc57d88 100644 --- a/src/anyrtttl.h +++ b/src/anyrtttl.h @@ -28,19 +28,23 @@ namespace anyrtttl * Description: * Defines a function pointer to a tone() function ****************************************************************************/ -typedef void (*ToneFuncPtr)(uint8_t _pin, unsigned int, unsigned long); +typedef void (*ToneFuncPtr)(uint8_t pin, unsigned int frequency, unsigned long duration); /**************************************************************************** * Description: * Defines a function pointer to a noTone() function ****************************************************************************/ -typedef void (*NoToneFuncPtr)(uint8_t); +typedef void (*NoToneFuncPtr)(uint8_t pin); /**************************************************************************** * Description: * Defines a function pointer to a delay() function ****************************************************************************/ +#if defined(ESP32) +typedef void (*DelayFuncPtr)(uint32_t); +#else typedef void (*DelayFuncPtr)(unsigned long); +#endif /**************************************************************************** * Description: