This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

how to add the "hal_time_get()" API's library?

Hi, 

I would like to use hal_time_get()  [hal_timer.h] in my project, and I try to add below library into Makefile.

but I got an error.  "error: implicit declaration of function 'hal_time_get'"

how can I call the "hal_time_get()" API on my project?

Thank you.

# Libraries common to all targets
LIB_FILES += \
  $(SDK_ROOT)/components/802_15_4/secure/802_15_4_lib_gcc.a \

  • GCC
  • ubuntu 12.04 (64 bit)
  • nRF52 (PCA10056, nRF52840) 
  • nRF5_SDK_15.2.0_9412b96
  • base on the serial_uartes_pca10056 sample code
Parents Reply Children
  • That is about the location of the include... Did you add

    '#include "hal_timer.h"' in your source file?

    If no... you should Slight smile

    If yes, then ther is probably another header file using the same include guard (HAL_TIMER_H_INCLUDED)

  • Hi Ray,

    Thank you.

    I have included "hal_timer.h" but still compile error.

    In file included from ../../../sdk/nordic/nRF5_SDK_15.2.0_9412b96/components/libraries/log/nrf_log.h:81,
                     from ../../../source//include/sc_lib.h:23,
                     from ../../../source//include/sc_app.h:4,
                     from ../../../source//common/log/sc_log.c:1:
    ../../../source//common/log/sc_log.c: In function 'SHTC1_I2C_Read':
    ../../../source//common/log/sc_log.c:300:30: error: implicit declaration of function 'hal_time_get'; did you mean 'handle_timeout'? [-Werror=implicit-function-declaration]
      sc_printf("get time: %llu", hal_time_get());
    

    and I grep my source code, the "HAL_TIMER_H_INCLUDED" only used in hal_timer.h

    ./sdk/nordic/nRF5_SDK_15.2.0_9412b96/components/802_15_4/api/HAL/hal_timer.h:#ifndef HAL_TIMER_H_INCLUDED
    ./sdk/nordic/nRF5_SDK_15.2.0_9412b96/components/802_15_4/api/HAL/hal_timer.h:#define HAL_TIMER_H_INCLUDED
    ./sdk/nordic/nRF5_SDK_15.2.0_9412b96/components/802_15_4/api/HAL/hal_timer.h:#endif /* HAL_TIMER_H_INCLUDED */
    

  • Hi.

    implicit declaration of function 'hal_time_get' means that you are using the function hal_timer_get before the compiler has seen the declaration ("prototype").

    Check that you don't call it before you declare it.

    Best regards,

    Andreas

Related