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

while merging blinky + timer , found an error nrfx_config.h: No such file or directory

hi.........

 i am tried to merge the blinky and timer sample program , i am getting this error , even i have included all files .h , .c files

nrfx_config.h: No such file or directory

Parents Reply Children
  • I am using SDK 15.2.0-PCA10040-S132

    I merge Blinky code into timer code.

    Its showing 0 error.

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf.h"
    #include "nrf_drv_timer.h"
    #include "bsp.h"
    #include "app_error.h"
    
    
    #include "boards.h"
    
    
    const nrf_drv_timer_t TIMER_LED = NRF_DRV_TIMER_INSTANCE(0);
    #define nrf_delay_us(us_time) NRFX_DELAY_US(us_time)
    
    __STATIC_INLINE void nrf_delay_ms(uint32_t ms_time)
    {
        if (ms_time == 0)
        {
            return;
        }
    
        do {
            nrf_delay_us(1000);
        } while (--ms_time);
    }
    /**
     * @brief Handler for timer events.
     */
    void timer_led_event_handler(nrf_timer_event_t event_type, void* p_context)
    {
        static uint32_t i;
        uint32_t led_to_invert = ((i++) % LEDS_NUMBER);
    
        switch (event_type)
        {
            case NRF_TIMER_EVENT_COMPARE0:
                bsp_board_led_invert(led_to_invert);
                break;
    
            default:
                //Do nothing.
                break;
        }
    }
    
    
    /**
     * @brief Function for main application entry.
     */
    int main(void)
    {
        uint32_t time_ms = 500; //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);
    
        while (1)
        {
    			      bsp_board_led_invert(0);
                nrf_delay_ms(500);
            __WFI();
        }
    }

    ...

  • good , but what mistake in my file i used application timer 

  • I am using Keil tool. I didn't check your file?

    Above code working from my side.

    Please Post your code. I can't understand your problem?

    application timer 

    which example it is?

    Please explain clearly.

  • look at this code 

    #include <stdbool.h>
    #include <stdint.h>
    #include "nrf_delay.h"
    #include "boards.h"
    #include "nrf_delay.h"
    #include "app_timer.h"
    #include "nrf_drv_timer.h"
    
    
    
    #define APP_TIMER_DE(m_led_a_timer_id);
    
    static void timer_sensor_event_handler(nrf_timer_event_t event_type, void* p_context)
    {
    
    void bsp_board_leds_on(void)
    {
        uint32_t i;
        for (i = 0; i < LEDS_NUMBER; ++i)
        {
            bsp_board_led_on(i);
        }
    }
    }
    
    static void create_timers(void)
    {  
       uint32_t err_code;
    
        // Create timers
      
     
    
        err_code = app_timer_create(&m_led_a_timer_id,
                                    APP_TIMER_MODE_REPEATED,
                                   timer_sensor_event_handler);
      APP_ERROR_CHECK(err_code);
    }
    
    static timer_start(void)
    {
       uint32_t err_code;
        //uint32_t APP_TIMER_TICKS(50000);
       
           
        // Start application timers
        err_code = app_timer_start(m_led_a_timer_id, APP_TIMER_TICKS(50000), NULL);
        APP_ERROR_CHECK(err_code);
         NRF_LOG_INFO("SUCCESS1");          
    
    }
    
    
    
    /**@brief Function for application main entry.
     */
    int main(void)
    {
        // Initialize.
    app_timer_init();
         create_timers();
        
        // Enter main loop.
        for (;;)
        {
            idle_state_handle();
        }
    }
    

    tell me if you can't understand this 

Related