annotate python/stm32f4/blink.c3 @ 204:de3a68f677a5

Added long comment to c3 parser
author Windel Bouwman
date Fri, 21 Jun 2013 15:01:08 +0200
parents
children d77cb5962cc5
rev   line source
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
1
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
2 // This file blinks a LED on the STM32F4 discovery board.
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
3
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
4 package blink;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
5
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
6 // Globals:
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
7 var int divider;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
8
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
9 // Functions:
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
10 function void tim2_handler()
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
11 {
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
12 divider = 0;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
13 /* if (TIM2->SR & TIM_SR_UIF)
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
14 {
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
15 divider++;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
16 if (divider > 100000)
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
17 {
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
18 divider = 0;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
19 GPIOD->ODR ^= (1 << 13);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
20 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
21 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
22 */
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
23 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
24
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
25 function void main()
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
26 {
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
27 divider = 0;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
28 /*
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
29 RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
30 RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
31
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
32 GPIOD->MODER = (1<<26);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
33
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
34 NVIC->ISER[0] |= 1<< (TIM2_IRQn);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
35
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
36 TIM2->PSC = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
37 TIM2->DIER |= TIM_DIER_UIE;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
38 TIM2->ARR = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
39 TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
40 TIM2->EGR = 1;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
41
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
42 while(1);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
43 */
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
44 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
45