annotate python/stm32f4/blink.c3 @ 210:67b0feafe5ae

Added missing file
author Windel Bouwman
date Sat, 29 Jun 2013 10:09:50 +0200
parents 8b2f20aae086
children 62386bcee1ba
rev   line source
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
1 // This file blinks a LED on the STM32F4 discovery board.
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
2 package blink;
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
3
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
4 // import bla
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
5 //type struct TIM2_s {
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
6 // uint32_t SR;
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
7 //};
204
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 // Globals:
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
10 var int divider;
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
11 //const TIM2_s *TIM2;
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
12
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
13 // Functions:
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
14 function void tim2_handler()
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
15 {
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
16 // if (TIM2->SR & TIM_SR_UIF)
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
17 if (true)
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
18 {
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
19 divider = divider + 1;
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
20 /*
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
21 if (divider > 100000)
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 divider = 0;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
24 GPIOD->ODR ^= (1 << 13);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
25 }
207
8b2f20aae086 cleaning of files
Windel Bouwman
parents: 205
diff changeset
26 */
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
27 }
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
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
30 function void main()
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 divider = 0;
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 RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
35 RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
36
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
37 GPIOD->MODER = (1<<26);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
38
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
39 NVIC->ISER[0] |= 1<< (TIM2_IRQn);
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
40
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
41 TIM2->PSC = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
42 TIM2->DIER |= TIM_DIER_UIE;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
43 TIM2->ARR = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
44 TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
45 TIM2->EGR = 1;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
46
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
47 */
205
d77cb5962cc5 Added some handcoded arm code generation
Windel Bouwman
parents: 204
diff changeset
48 while(true) {}
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
49 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
50