ArmDeveloperEcosystem / lorawan-library-for-pico

Enable LoRaWAN communications on your Raspberry Pi Pico or any RP2040 based board. 📡
BSD 3-Clause "New" or "Revised" License
125 stars 47 forks source link

add #include "pico/time.h" to fix compiler error #33

Closed jerryneedell closed 1 year ago

jerryneedell commented 1 year ago

compiling the pico_lorawan_otaa_temperature_led example failed with the following error also see #32

many lines removed

/Users/jerryneedell/projects/pico-lorawan/src/lorawan.c: In function 'lorawan_process_timeout_ms':
/Users/jerryneedell/projects/pico-lorawan/src/lorawan.c:297:36: warning: implicit declaration of function 'make_timeout_time_ms' [-Wimplicit-function-declaration]
  297 |     absolute_time_t timeout_time = make_timeout_time_ms(timeout_ms);
      |                                    ^~~~~~~~~~~~~~~~~~~~
/Users/jerryneedell/projects/pico-lorawan/src/lorawan.c:309:15: warning: implicit declaration of function 'best_effort_wfe_or_timeout' [-Wimplicit-function-declaration]
  309 |     } while (!best_effort_wfe_or_timeout(timeout_time));
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~~

many lines removed

/Users/jerryneedell/bin/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: CMakeFiles/pico_lorawan_otaa_temperature_led.dir/__/__/src/lorawan.c.obj: in function `lorawan_process_timeout_ms':
lorawan.c:(.text.lorawan_process_timeout_ms+0xa): undefined reference to `make_timeout_time_ms'
collect2: error: ld returned 1 exit status
make[2]: *** [examples/otaa_temperature_led/pico_lorawan_otaa_temperature_led.elf] Error 1
make[1]: *** [examples/otaa_temperature_led/CMakeFiles/pico_lorawan_otaa_temperature_led.dir/all] Error 2
make: *** [all] Error 2

adding `#include "pico/time.h" to lorawan.c appears to fix the problem.

It now compiles OK.

sandeepmistry commented 1 year ago

@jerryneedell thanks for taking the time to make this pull request!

jerryneedell commented 1 year ago

You're welcome. Thank you for all your great code examples!