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

problem in merging the timer and twi sensor

hi.....folks

i am using nrf52832  and have merged the twi sensor with uart and timer but i am getting , i dono where to add my timer in main loop , see the code 

help me out

 

int main(void)

{

    

                                                                                                    
    bool erase_bonds;

    // Initialize.
    uart_init();
    log_init();
    timers_init();
    buttons_leds_init(&erase_bonds);
    power_management_init();
    ble_stack_init();
    gap_params_init();
    gatt_init();
    services_init();
    advertising_init();
    conn_params_init();

    // Start execution.
    printf("\r\nUART started.\r\n");
    NRF_LOG_INFO("Debug logging for UART over RTT started.");
    advertising_start();
   twi_init();
  LM75B_set_mode();
    timer_sensor();

 
    char str[80];
    
      
  uint32_t time_ms = 60000; //Time(in miliseconds) between consecutive compare events.
    uint32_t time_ticks;
    uint32_t err_code = NRF_SUCCESS;
    NRF_LOG_INFO("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_SENSOR , &timer_cfg,  timer_temp_event_handler);
    APP_ERROR_CHECK(err_code);

    time_ticks = nrf_drv_timer_ms_to_ticks(&TIMER_SENSOR , time_ms);

    nrf_drv_timer_extended_compare(
         &TIMER_SENSOR , NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);

    nrf_drv_timer_enable(&TIMER_SENSOR );
      while (true)
    {
    while (m_xfer_done == false);
     m_xfer_done = false;

        nrf_delay_ms(1000);

       
		
		NRF_LOG_FLUSH();



      }
      }

Related