annotate python/stm32f4/blink.c3 @ 217:8b2e5f3cd579

Removed some stale python source files
author Windel Bouwman
date Fri, 05 Jul 2013 14:13:59 +0200
parents 62386bcee1ba
children 1fa3e0050b49
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;
212
62386bcee1ba Added parser combinator lib
Windel Bouwman
parents: 207
diff changeset
11 //const TIM2_s *TIM2;// = (TIM2_s*)0x40004;
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;
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
20 if (divider > 100000)
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 divider = 0;
212
62386bcee1ba Added parser combinator lib
Windel Bouwman
parents: 207
diff changeset
23 //GPIOD->ODR ^= (1 << 13);
204
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 }
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
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
28 function void main()
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 divider = 0;
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 RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
33 RCC->APB1ENR |= RCC_APB1ENR_TIM2EN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
34
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
35 GPIOD->MODER = (1<<26);
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 NVIC->ISER[0] |= 1<< (TIM2_IRQn);
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 TIM2->PSC = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
40 TIM2->DIER |= TIM_DIER_UIE;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
41 TIM2->ARR = 0xE000;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
42 TIM2->CR1 |= TIM_CR1_ARPE | TIM_CR1_CEN;
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
43 TIM2->EGR = 1;
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 */
205
d77cb5962cc5 Added some handcoded arm code generation
Windel Bouwman
parents: 204
diff changeset
46 while(true) {}
204
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
47 }
de3a68f677a5 Added long comment to c3 parser
Windel Bouwman
parents:
diff changeset
48