khoih-prog/ESP32_New_TimerInterrupt

Compiler errors when trying to build with PlatformIO

alvarolobato opened this issue · 2 comments

Describe the bug

PlatformIO project will throw errors when trying to use the library.

.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:379:100: error: 'timer_isr_callback_add' was not declared in this scope
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:66: error: 'TIMER_INTR_T0' was not declared in this scope

and

.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:82: error: 'TIMER_INTR_T1' was not declared in this scope

See full build log here if you use main.cpp

  *  Executing task: platformio run 

Processing ESP32 (platform: espressif32; framework: arduino; board: esp32doit-devkit-v1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.5.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ strict
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP32_New_TimerInterrupt @ 1.5.0
Building in release mode
Compiling .pio/build/ESP32/src/main.cpp.o
Compiling .pio/build/ESP32/FrameworkArduino/Stream.cpp.o
In file included from .pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:110:0,
                 from src/main.cpp:1:
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'bool ESP32TimerInterrupt::setFrequency(const float&, esp32_timer_callback)':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
Compiling .pio/build/ESP32/FrameworkArduino/StreamString.cpp.o
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:356:9: note: in expansion of macro 'TISR_LOGWARN3'
         TISR_LOGWARN3(F("ESP32_TimerInterrupt: _timerNo ="), _timerNo, F(", _fre ="), TIMER_BASE_CLK / TIMER_DIVIDER);
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:356:59: error: 'F' was not declared in this scope
         TISR_LOGWARN3(F("ESP32_TimerInterrupt: _timerNo ="), _timerNo, F(", _fre ="), TIMER_BASE_CLK / TIMER_DIVIDER);
                                                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:96: note: in definition of macro 'TISR_LOGWARN3'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                                                ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:357:9: note: in expansion of macro 'TISR_LOGWARN3'
         TISR_LOGWARN3(F("TIMER_BASE_CLK ="), TIMER_BASE_CLK, F(", TIMER_DIVIDER ="), TIMER_DIVIDER);
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:357:43: error: 'F' was not declared in this scope
         TISR_LOGWARN3(F("TIMER_BASE_CLK ="), TIMER_BASE_CLK, F(", TIMER_DIVIDER ="), TIMER_DIVIDER);
                                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:96: note: in definition of macro 'TISR_LOGWARN3'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                                                ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:358:9: note: in expansion of macro 'TISR_LOGWARN3'
         TISR_LOGWARN3(F("_timerIndex ="), _timerIndex, F(", _timerGroup ="), _timerGroup);
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:358:40: error: 'F' was not declared in this scope
         TISR_LOGWARN3(F("_timerIndex ="), _timerIndex, F(", _timerGroup ="), _timerGroup);
                                        ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:96: note: in definition of macro 'TISR_LOGWARN3'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                                                ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:359:9: note: in expansion of macro 'TISR_LOGWARN3'
         TISR_LOGWARN3(F("_count ="), (uint32_t) (_timerCount >> 32), F("-"), (uint32_t) (_timerCount));
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:359:35: error: 'F' was not declared in this scope
         TISR_LOGWARN3(F("_count ="), (uint32_t) (_timerCount >> 32), F("-"), (uint32_t) (_timerCount));
                                   ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:90:96: note: in definition of macro 'TISR_LOGWARN3'
 #define TISR_LOGWARN3(x,y,z,w)   if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINT(y); TISR_PRINT_SP; TISR_PRINT(z); TISR_PRINT_SP; TISR_PRINTLN(w); }
                                                                                                ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:88:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGWARN1(x,y)       if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINTLN(y); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:360:9: note: in expansion of macro 'TISR_LOGWARN1'
         TISR_LOGWARN1(F("timer_set_alarm_value ="), TIMER_SCALE / frequency);
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:360:50: error: 'F' was not declared in this scope
         TISR_LOGWARN1(F("timer_set_alarm_value ="), TIMER_SCALE / frequency);
                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:88:96: note: in definition of macro 'TISR_LOGWARN1'
 #define TISR_LOGWARN1(x,y)       if(_TIMERINTERRUPT_LOGLEVEL_>1) { TISR_PRINT_MARK; TISR_PRINT(x); TISR_PRINT_SP; TISR_PRINTLN(y); }
                                                                                                ^
In file included from src/main.cpp:1:0:
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:379:100: error: 'timer_isr_callback_add' was not declared in this scope
         timer_isr_callback_add(_timerGroup, _timerIndex, _callback, (void *) (uint32_t) _timerNo, 0);
                                                                                                    ^
In file included from .pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:110:0,
                 from src/main.cpp:1:
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:52:30: error: 'Serial' was not declared in this scope
   #define TISR_DBG_PORT      Serial
                              ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:73:27: note: in expansion of macro 'TISR_DBG_PORT'
 #define TISR_PRINT        TISR_DBG_PORT.print
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:70:27: note: in expansion of macro 'TISR_PRINT'
 #define TISR_PRINT_MARK   TISR_PRINT(TISR_MARK)
                           ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:78:68: note: in expansion of macro 'TISR_PRINT_MARK'
 #define TISR_LOGERROR(x)         if(_TIMERINTERRUPT_LOGLEVEL_>0) { TISR_PRINT_MARK; TISR_PRINTLN(x); }
                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:390:9: note: in expansion of macro 'TISR_LOGERROR'
         TISR_LOGERROR(F("Error. Timer must be 0-3"));
         ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:390:51: error: 'F' was not declared in this scope
         TISR_LOGERROR(F("Error. Timer must be 0-3"));
                                                   ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/TimerInterrupt_Generic_Debug.h:78:98: note: in definition of macro 'TISR_LOGERROR'
 #define TISR_LOGERROR(x)         if(_TIMERINTERRUPT_LOGLEVEL_>0) { TISR_PRINT_MARK; TISR_PRINTLN(x); }
                                                                                                  ^
In file included from src/main.cpp:1:0:
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::detachInterrupt()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:66: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
Compiling .pio/build/ESP32/FrameworkArduino/WMath.cpp.o
                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:82: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::disableTimer()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:430:66: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:430:82: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::reattachInterrupt()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:440:65: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:440:81: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::enableTimer()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:450:65: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:450:81: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                 ^
Compiling .pio/build/ESP32/FrameworkArduino/WString.cpp.o
Compiling .pio/build/ESP32/FrameworkArduino/base64.cpp.o
Compiling .pio/build/ESP32/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-bt.c.o
*** [.pio/build/ESP32/src/main.cpp.o] Error 1
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-cpu.c.o
====================================================================================== [FAILED] Took 1.66 seconds ======================================================================================

Environment    Status    Duration
-------------  --------  ------------
ESP32          FAILED    00:00:01.665
================================================================================ 1 failed, 0 succeeded in 00:00:01.665 ================================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

and this if you use main.ino

 *  Executing task: platformio run 

Processing ESP32 (platform: espressif32; framework: arduino; board: esp32doit-devkit-v1)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.5.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ strict
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP32_New_TimerInterrupt @ 1.5.0
Building in release mode
Compiling .pio/build/ESP32/src/main.ino.cpp.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-log.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-spi.c.o
In file included from /Users/alobato/Documents/PlatformIO/Projects/TIMER INTERRUPT TEST/src/main.ino:1:0:
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'bool ESP32TimerInterrupt::setFrequency(const float&, esp32_timer_callback)':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:379:100: error: 'timer_isr_callback_add' was not declared in this scope
         timer_isr_callback_add(_timerGroup, _timerIndex, _callback, (void *) (uint32_t) _timerNo, 0);
                                                                                                    ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::detachInterrupt()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:66: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:421:82: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::disableTimer()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:430:66: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:430:82: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_disable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                  ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::reattachInterrupt()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:440:65: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:440:81: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h: In member function 'void ESP32TimerInterrupt::enableTimer()':
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:450:65: error: 'TIMER_INTR_T0' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                 ^
.pio/libdeps/ESP32/ESP32_New_TimerInterrupt/src/ESP32_New_TimerInterrupt.h:450:81: error: 'TIMER_INTR_T1' was not declared in this scope
       timer_group_intr_enable(_timerGroup, (_timerIndex == 0) ? TIMER_INTR_T0 : TIMER_INTR_T1);
                                                                                 ^
*** [.pio/build/ESP32/src/main.ino.cpp.o] Error 1
Compiling .pio/build/ESP32/FrameworkArduino/esp32-hal-time.c.o
/Users/alobato/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/Users/alobato/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/Users/alobato/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;
                                        ^
====================================================================================== [FAILED] Took 1.56 seconds ======================================================================================

Environment    Status    Duration
-------------  --------  ------------
ESP32          FAILED    00:00:01.558
================================================================================ 1 failed, 0 succeeded in 00:00:01.558 ================================================================================

 *  The terminal process "platformio 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

Steps to Reproduce

Following this project instructions here: https://github.com/khoih-prog/ESP32_New_TimerInterrupt/tree/main#vs-code--platformio

  • Create a new project on Platform IO
  • Install the library
  • Include the library: #include "ESP32_New_TimerInterrupt.h"
  • compile and obtain the errors above.
  • You will have different errors if using main.cpp or main.ino

This is the content I used:

#include "ESP32_New_TimerInterrupt.h"
void setup(){ 
}
void loop(){
}

Information

Please ensure to specify the following:
Versions below:

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32doit-devkit-v1.html
PLATFORM: Espressif 32 (3.5.0) > DOIT ESP32 DEVKIT V1
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 @ 3.10006.210326 (1.0.6) 
 - tool-esptoolpy @ 1.30100.210531 (3.1.0) 
 - toolchain-xtensa32 @ 2.50200.97 (5.2.0)
Converting main.ino
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain+, Compatibility ~ strict
Found 29 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP32_New_TimerInterrupt @ 1.5.0

Please read Which library should I be using? #7, at least previous issues when you get into a fatal error.

So the suggestions are:

  1. If you're only using core v2.0.0+, such as v2.0.4, or ESP32_S2, ESP32_S3 or ESP32_C3, it's better to use this ESP32_New_TimerInterrupt
  2. If you're using ESP32, and want to be flexible to use either core v1.0.6- or v2.0.0+, use the old ESP32TimerInterrupt

Then you know you have to use ESP32 core v2.0.0+

Thanks for the reply, I had read that and concluded that I should use ESP32_New_TimerInterrupt, I thought I was on the last core version and just realised I'm using 1.6, Platform IO versions are new to me.