stm32 低功耗设计[操作寄存器+库函数]
时间:11-25
来源:互联网
点击:
125 126 //RCC_AHBPeriphClockCmd(RCC_AHBPeriph_DMA1, ENABLE); 127 128 RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR,ENABLE); 129 //RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR|RCC_APB1Periph_BKP|RCC_APB1Periph_WWDG, ENABLE); 130 131 } 132 133 134 voidUSART_Configuration(void) 135 { 136 USART_InitTypeDef USART_InitStructure; 137 USART_ClockInitTypeDef USART_ClockInitStructure; 138 139 USART_ClockInitStructure.USART_Clock = USART_Clock_Disable; 140 USART_ClockInitStructure.USART_CPOL = USART_CPOL_Low; 141 USART_ClockInitStructure.USART_CPHA = USART_CPHA_2Edge; 142 USART_ClockInitStructure.USART_LastBit = USART_LastBit_Disable; 143 USART_ClockInit(USART1 , &USART_ClockInitStructure); 144 145 USART_InitStructure.USART_BaudRate = 9600; 146 USART_InitStructure.USART_WordLength = USART_WordLength_8b; 147 USART_InitStructure.USART_StopBits = USART_StopBits_1; 148 USART_InitStructure.USART_Parity = USART_Parity_No; 149 USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; 150 USART_InitStructure.USART_Mode = USART_Mode_Rx|USART_Mode_Tx; 151 USART_Init(USART1,&USART_InitStructure); 152 153 USART_Cmd(USART1,ENABLE); 154 } 155 156 voidEXTI_Configuration(void) 157 { 158 EXTI_InitTypeDef EXTI_InitStructure; 159 160 EXTI_InitStructure.EXTI_Line = EXTI_Line0; 161 EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; 162 EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; 163 EXTI_InitStructure.EXTI_LineCmd = ENABLE; 164 165 EXTI_Init(&EXTI_InitStructure); 166 167 } 168 169 voidNVIC_Configuration(void) 170 { 171 NVIC_InitTypeDef NVIC_InitStructure; 172 173 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_0); 174 175 NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn; 176 NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0; 177 NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0; 178 NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; 179 NVIC_Init(&NVIC_InitStructure); 180 } 181 182 #if PRINTF_ON 183 184 intfputc(intch,FILE*f) 185 { 186 USART_SendData(USART1,(u8) ch); 187 while(USART_GetFlagStatus(USART1,USART_FLAG_TC) == RESET); 188 returnch; 189 } 190 191 #endif stm32f10x_it.c
view source
print?
01 #include "stm32f10x_it.h" 02 03 #include "stdio.h" 04 05 06 voidEXTI0_IRQHandler(void) 07 { 08 GPIO_WriteBit(GPIOA,GPIO_Pin_7,Bit_SET); 09 10 //EXTI_ClearFlag(EXTI_Line0); //清除此中断标志位,系统由于唤醒将直接复位 11 12 } 13 14 voidSysTick_Handler(void) 15 { 16 GPIO_WriteBit(GPIOA,GPIO_Pin_4,(BitAction)(1-GPIO_ReadOutputDataBit(GPIOA,GPIO_Pin_4))); 17 }
stm32低功耗设计操作寄存器库函 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)