blob: 0365c80b75110990cf8bf2d541008a1156aacd41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#include "stm32f0xx.h"
// Quick and dirty delay
static void delay (unsigned int time) {
for (unsigned int i = 0; i < time; i++)
for (volatile unsigned int j = 0; j < 2000; j++);
}
int main (void) {
// Turn on the GPIOC peripheral
RCC->AHBENR |= RCC_AHBENR_GPIOCEN;
// Put pin 13 in general purpose output mode
GPIOC->MODER |= GPIO_MODER_MODER13_0;
while (1) {
// Reset the state of pin 13 to output low
GPIOC->BSRR = GPIO_BSRR_BR_13;
delay(500);
// Set the state of pin 13 to output high
GPIOC->BSRR = GPIO_BSRR_BS_13;
delay(500);
}
// Return 0 to satisfy compiler
return 0;
}
|