Hi all,
I am sorry if this is a rookie question. I had researched and tried the methods shown online, including:
- added $(ProjectDir)/flash_placement.xml to the linker section > section placement file of the project option
- editing the sdk_config.h by correcting CLOCK_ENABLED and TIMER_ENABLED from 0 to 1
- #include <timer.h> on the top and defined the t_latency with type clock_t
I will post my codes and the error messages in the following:
in main.c:
static void client_status_cb(const generic_on_off_client_t * p_self, generic_on_off_status_t status, uint16_t src) { __LOG(LOG_SRC_APP, LOG_LEVEL_ERROR, "server status received \n"); // Stop time for measuring latency t_latency_stop = clock(); latency = t_latency_stop - t_latency_start; ... ... ... ... void GPIOTE_IRQHandler(void) { NRF_GPIOTE->EVENTS_PORT = 0; /* Check that the event was generated by a button press, and reject if it's too soon (debounce). * NOTE: There is a bug with this at the wrap-around for the RTC0 where the button could be * pressed before HAL_BUTTON_PRESS_FREQUENCY has passed a single time. It doesn't matter practically. */ if( TIMER_DIFF(m_last_button_press, NRF_RTC0->COUNTER) > HAL_BUTTON_PRESS_FREQUENCY) { m_last_button_press = NRF_RTC0->COUNTER; // Start time for measuring latency t_latency_start = clock(); button_event_handler(0); } }