zoukankan      html  css  js  c++  java
  • STM32F4寄存器初始化系列:时钟开启

     1 static void RCC_Init(void)
     2 {
     3   RCC->APB1ENR|=1<<17;  //使能串口2时钟 
     4   RCC->APB1ENR|=1<<14;//SPI2时钟使能 
     5   RCC->APB2ENR|=1<<12;//使能SPI1时钟
     6   RCC->APB2ENR|=1<<8;    //使能ADC1
     7   RCC->APB2ENR|=1<<9;    //使能ADC2
     8   RCC->APB2ENR|=1<<10;    //使能ADC3
     9   RCC->APB2ENR|=1<<14;    //使能SYSCFG时钟
    10   
    11   RCC->AHB1ENR|=1;    //使能PORTA时钟
    12   RCC->AHB1ENR|=1<<1;    //使能PORTB时钟 
    13   RCC->AHB1ENR|=1<<2;    //使能PORTC时钟
    14   RCC->AHB1ENR|=1<<3;    //使能PORTD时钟
    15   RCC->AHB1ENR|=1<<4;     //使能PORTE时钟
    16   RCC->AHB1ENR|=1<<5;     //使能PORTE时钟
    17   RCC->AHB1ENR|=1<<6;    //使能PORTG时钟
    18   
    19   RCC->APB1ENR|=1<<20;      //使能串口5时钟 
    20   RCC->APB1ENR|=1<<19;      //使能串口4时钟 
    21   RCC->APB1ENR|=1<<18;      //使能串口3时钟 
    22   RCC->APB1ENR|=1<<17;      //使能串口2时钟 
    23   
    24   //DMA
    25   RCC->AHB1ENR|=1<<21;//DMA1时钟使能  
    26   RCC->AHB1ENR|=1<<22;//DMA2时钟使能
    27   
    28   RCC->APB1ENR|=1<<1;         //TIM3时钟使能  
    29   RCC->APB1ENR|=1<<2;         //TIM4时钟使能   
    30   RCC->APB2ENR|=1<<0;        //TIM1时钟使能 
    31   RCC->APB2ENR|=1<<1;        //TIM8时钟使能
    32 }
  • 相关阅读:
    vim 命令详解
    vim基础命令
    JSP取得绝对路径
    sigar开发(java)
    HDU-5273
    HDU-1671
    HDU-1251
    POJ-1743
    POJ-2774
    hihocoder 1145 : 幻想乡的日常
  • 原文地址:https://www.cnblogs.com/penuel/p/11265260.html
Copyright © 2011-2022 走看看