jecrespo / RadioHead

RadioHead Packet Radio library for embedded microprocessors from http://www.airspayce.com/mikem/arduino/RadioHead/
Other
12 stars 5 forks source link

Timer API changed for ESP32 core v2.X to 3.0.0 #6

Open jmwislez opened 4 months ago

jmwislez commented 4 months ago

RH_ASK compilation gives the following errors when compiled with ESP32 core v3.0.0:

c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp: In member function 'void RH_ASK::timerSetup()':
c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:533:23: error: too many arguments to function 'hw_timer_t* timerBegin(uint32_t)'
  533 |     timer = timerBegin(0, 80, true); // Alarm value will be in in us
      |             ~~~~~~~~~~^~~~~~~~~~~~~
In file included from C:\Users\jmw\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal.h:84,
                 from C:\Users\jmw\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/Arduino.h:36,
                 from c:\Users\jmw\Documents\Arduino\libraries\RadioHead/RadioHead.h:1556,
                 from c:\Users\jmw\Documents\Arduino\libraries\RadioHead/RHGenericDriver.h:9,
                 from c:\Users\jmw\Documents\Arduino\libraries\RadioHead/RH_ASK.h:9,
                 from c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:6:
C:\Users\jmw\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:35:13: note: declared here
   35 | hw_timer_t *timerBegin(uint32_t frequency);
      |             ^~~~~~~~~~
c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:534:25: error: too many arguments to function 'void timerAttachInterrupt(hw_timer_t*, void (*)())'
  534 |     timerAttachInterrupt(timer, &esp32_timer_interrupt_handler, true);
      |     ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\jmw\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.2\cores\esp32/esp32-hal-timer.h:50:6: note: declared here
   50 | void timerAttachInterrupt(hw_timer_t *timer, void (*userFunc)(void));
      |      ^~~~~~~~~~~~~~~~~~~~
c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:535:5: error: 'timerAlarmWrite' was not declared in this scope; did you mean 'timerWrite'?
  535 |     timerAlarmWrite(timer, 1000000 / _speed / 8, true);
      |     ^~~~~~~~~~~~~~~
      |     timerWrite
c:\Users\jmw\Documents\Arduino\libraries\RadioHead\RH_ASK.cpp:536:5: error: 'timerAlarmEnable' was not declared in this scope; did you mean 'timerAlarm'?
  536 |     timerAlarmEnable(timer);
      |     ^~~~~~~~~~~~~~~~
      |     timerAlarm
exit status 1

Compilation error: exit status 1

The API changes are described here:

https://docs.espressif.com/projects/arduino-esp32/en/latest/migration_guides/2.x_to_3.0.html

Vorms commented 3 months ago

Yes radio heau is a very nice library. But we NEED it working with Espressif version 3.x

Best regards

jmwislez commented 2 months ago

A maintained version is available here: http://www.airspayce.com/mikem/arduino/RadioHead/ Technically it would be a matter of merging that one periodically.