Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Won't Compile (using ESP32 Feather with RFM69HCW wing) #79

Open
chuckberrypi opened this issue Dec 31, 2023 · 3 comments
Open

Won't Compile (using ESP32 Feather with RFM69HCW wing) #79

chuckberrypi opened this issue Dec 31, 2023 · 3 comments

Comments

@chuckberrypi
Copy link

After striking out getting the LowPowerLabs RFM69 library working on this hardware setup, I thought I'd switch tacks and try RadioHead. I can't even get it to compile. Here's the error messages I get when I try to compile:

~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.cpp:528:23: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
  528 |     timer = timerBegin(0, 80, true); // Alarm value will be in in us
      |             ~~~~~~~~~~^~~~~~~~~~~~~
In file included from ~/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-alpha3/cores/esp32/esp32-hal.h:84,
                 from ~/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-alpha3/cores/esp32/Arduino.h:36,
                 from ~/Documents/Arduino/libraries/RadioHead-master/RadioHead.h:1544,
                 from ~/Documents/Arduino/libraries/RadioHead-master/RHGenericDriver.h:9,
                 from ~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.h:9,
                 from ~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.cpp:6:
~/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-alpha3/cores/esp32/esp32-hal-timer.h:35:14: note: declared here
   35 | hw_timer_t * timerBegin(uint32_t frequency);
      |              ^~~~~~~~~~
~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.cpp:529:25: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
  529 |     timerAttachInterrupt(timer, &esp32_timer_interrupt_handler, true);
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~/Library/Arduino15/packages/esp32/hardware/esp32/3.0.0-alpha3/cores/esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t * timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.cpp:530:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
  530 |     timerAlarmWrite(timer, 1000000 / _speed / 8, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
~/Documents/Arduino/libraries/RadioHead-master/RH_ASK.cpp:531:5: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
  531 |     timerAlarmEnable(timer);
      |     ^~~~~~~~~~~~~~~~
      |     timerAlarm

exit status 1

Compilation error: exit status 1```

Any suggestions for getting this off the ground? Do I need to change the library code? Pretty frustrating that I can't get the wing to work with the ESP32 feather. 
@AniSerNik
Copy link

AniSerNik commented Feb 4, 2024

Hi. This happened because ESPRESSIF changed the Timer API in version 3.0.0.
More about the situation here: espressif/arduino-esp32#8796 and https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html
As a temporary solution, I changed lines 563-566 in RH_ASK.cpp. I cannot claim that this is absolutely true, but I have not found any errors in my projects. Tested on RH_RF95 and ESP32-C6.
Old code:

#elif (RH_PLATFORM == RH_PLATFORM_ESP32)
     void RH_INTERRUPT_ATTR esp32_timer_interrupt_handler(); // Forward declaration
     timer = timerBegin(0, 80, true); // Alarm value will be in in us
     timerAttachInterrupt(timer, &esp32_timer_interrupt_handler, true);
     timerAlarmWrite(timer, 1000000 / _speed / 8, true);
     timerAlarmEnable(timer);
 #endif

New code:

#elif (RH_PLATFORM == RH_PLATFORM_ESP32)
    void RH_INTERRUPT_ATTR esp32_timer_interrupt_handler(); // Forward declaration
    timer = timerBegin(1000000);
    timerAttachInterrupt(timer, &esp32_timer_interrupt_handler);
    timerAlarm(timer, 1000000 / _speed / 8, true, 0);
#endif

You can also go back to the previous version 2.0.11 esp32 as a solution.

@StillVoidingWarranties
Copy link

Just encountered the same problem and the changed timer call from @AniSerNik worked. Thank you very much.

@Osmoztech-io
Copy link

hw_timer_t *timer = timerBegin(1000000);
timerAttachInterrupt(timer, &onTimer);
timerAlarm(timer, 10000, true, 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants