Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Includes */
- #include <stddef.h>
- #include "stm32f10x.h"
- GPIO_InitTypeDef GPIO_InitStructure;
- void delayLoop() {
- volatile uint32_t delayCount = 1000000;
- while (delayCount > 0) {
- delayCount--;
- }
- }
- int main(void)
- {
- SystemInit();
- RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_11;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_15;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
- GPIO_Init(GPIOA, &GPIO_InitStructure);
- while(1) {
- GPIOA->BSRR = GPIO_Pin_0;
- GPIOA->BSRR = GPIO_Pin_1;
- GPIOA->BSRR = GPIO_Pin_2;
- GPIOA->BSRR = GPIO_Pin_3;
- GPIOA->BSRR = GPIO_Pin_10;
- GPIOA->BSRR = GPIO_Pin_11;
- GPIOA->BSRR = GPIO_Pin_12;
- GPIOA->BSRR = GPIO_Pin_15;// LED On
- delayLoop();
- GPIOA->BRR = GPIO_Pin_0;
- GPIOA->BRR = GPIO_Pin_1;
- GPIOA->BRR = GPIO_Pin_2;
- GPIOA->BRR = GPIO_Pin_3;
- GPIOA->BRR = GPIO_Pin_10;
- GPIOA->BRR = GPIO_Pin_11;
- GPIOA->BRR = GPIO_Pin_12;
- GPIOA->BRR = GPIO_Pin_15; // LED Off
- delayLoop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement