Hello , I have a timer ad a value that increments every 1ms and I want to send this value to the central but I don't know how to do it.
here my timer code :
void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context){
int i=0;
switch (event_type)
{
case NRF_TIMER_EVENT_COMPARE0:
compteur++;
tab[i] = compteur;
NRF_LOG_INFO("tab = %d" , tab[i]);
i++;
break;
default:
//Do nothing.
break;
} }
void test(){
NRF_LOG_INFO("test");
uint32_t time_ms = 1; //Time(in miliseconds) between consecutive compare events.
uint32_t time_ticks;
uint32_t err_code = NRF_SUCCESS;
//Configure all leds on board.
bsp_board_init(BSP_INIT_LEDS);
//Configure TIMER_LED for generating simple light effect - leds on board will invert his state one after the other.
nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err_code = nrf_drv_timer_init(&TIMER_LED, &timer_cfg, timer_led_event_handler);
APP_ERROR_CHECK(err_code);
time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_LED, time_ms);
nrf_drv_timer_extended_compare(
&TIMER_LED, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
nrf_drv_timer_enable(&TIMER_LED);
}
thank you