您当前的位置: 首页 >  仙剑情缘

NRF52832 clock driver for SDK 15.2.0

仙剑情缘 发布时间:2018-10-31 13:57:48 ,浏览量:6

1.在sdk_config.h加入宏

#ifndef UART_DEFAULT_CONFIG_IRQ_PRIORITY
#define UART_DEFAULT_CONFIG_IRQ_PRIORITY 6
#endif


#ifndef NRF_CLOCK_ENABLED
#define NRF_CLOCK_ENABLED 1
#endif

#ifndef NRFX_CLOCK_CONFIG_IRQ_PRIORITY
#define NRFX_CLOCK_CONFIG_IRQ_PRIORITY 6
#endif


#ifndef NRFX_CLOCK_CONFIG_LF_SRC
#define NRFX_CLOCK_CONFIG_LF_SRC 1
#endif
2.导入nrf_drv_clock.c和nrfx_clock.c文件到工程

3.初时化
      if(!nrf_drv_clock_init_check())
      {
           APP_ERROR_CHECK(nrf_drv_clock_init());    
          printf("\nnrf_drv_clock_init\n");
      }

4.请求低频时钟

 nrf_drv_clock_lfclk_request(NULL);
      nrf_delay_ms(100);
       if(nrf_drv_clock_lfclk_is_running())
      { 
           printf("nrf_drv_clock_lfclk_is_running\n");
      }

6.释放低频时钟

 nrf_drv_clock_lfclk_release();
      nrf_delay_ms(100);
       if(!nrf_drv_clock_lfclk_is_running())
      { 
           printf("nrf_drv_clock_lfclk_is_stop\n");
      }

7.请求高频时钟

nrf_drv_clock_hfclk_request(NULL);
      
      nrf_delay_ms(100);
       if(nrf_drv_clock_hfclk_is_running())
      { 
           printf("nrf_drv_clock_hfclk_is_running\n");
      }

8.释放高频时钟

 nrf_drv_clock_hfclk_release();
      nrf_delay_ms(100);
       if(!nrf_drv_clock_hfclk_is_running())
      { 
           printf("nrf_drv_clock_hfclk_is_stop\n");
      }

关注
打赏
查看更多评论

仙剑情缘

暂无认证

  • 6浏览

    0关注

    138博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文
立即登录/注册

微信扫码登录