Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2012
373
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.66 KB | None | 0 0
  1. #include "stm32f10x.h"
  2. #include "stm32f10x_gpio.h"
  3. #include "stm32f10x_rcc.h"
  4.  
  5.  
  6. void main(void)
  7. {
  8.  
  9.     /* Structure for GPIO */
  10.     GPIO_InitTypeDef  GPIO_InitStructure;
  11.    
  12.     /* Initialize PortA and Enable the Clock*/
  13.     RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
  14.  
  15.     /* Configure the GPIO_LED pin (PA1 & PA5) */                  
  16.     GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5|GPIO_Pin_1;
  17.     GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
  18.     GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  19.     GPIO_Init(GPIOA, &GPIO_InitStructure);
  20.  
  21.     /* Toggle LEDs */
  22.     GPIOA->ODR = ((GPIO_Pin_5)|(GPIO_Pin_1));
  23.  
  24.  
  25.     while (1)
  26.     { }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement