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

timer in microsecond on nRF52840

hello , i'am working actually on the timer of nRF52840 S140  

my timer look like this: 

#define COMPTEUR_INTERVAL     APP_TIMER_TICKS(1)                   /**< Tick / Ms */

APP_TIMER_DEF(sd_timer_id);

static void lfclk_request(void)
{
    ret_code_t err_code;// = nrf_drv_clock_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_clock_lfclk_request(NULL);
	NRF_LOG_INFO("LFCLK: OFF");
    
    if(nrf_drv_clock_lfclk_is_running()){
		NRF_LOG_INFO("LFCLK: ON");
			
	}
}

void test(){
	
	ret_code_t err_code;
	
	// Create timers
	err_code = app_timer_create(&sd_timer_id,APP_TIMER_MODE_REPEATED,timer_sd_handler);
	lfclk_request();
	APP_ERROR_CHECK(err_code);
	NRF_LOG_INFO("Timer_sd_start");
	err_code = app_timer_start(sd_timer_id, COMPTEUR_INTERVAL, NULL);
	NRF_LOG_INFO("%d",err_code);
	APP_ERROR_CHECK(err_code);
}

static void timer_sd_handler(void * p_context){
	
	compteur++;
	
}

but  how to switch from millisecond resolution to microsecond resolution ? ( APP_TIMER_TICKS) 

thank's

Related