annotate python/stm32f4/burn.c3 @ 251:6ed3d3a82a63

Added another c3 example. First import attempt
author Windel Bouwman
date Mon, 29 Jul 2013 20:23:13 +0200
parents ce6d390043a7
children 225f444019b1
rev   line source
241
ce6d390043a7 Added reset and run at end of flashing
Windel Bouwman
parents: 237
diff changeset
1 /*
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
2
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
3 This file blinks a LED on the STM32F4 discovery board.
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
4
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
5 the board has 4 leds on PD12, PD13, PD14 and PD15
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
6
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
7 */
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
8
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
9 package burn;
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
10
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
11 import stm32f4xx;
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
12
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
13 function void init()
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
14 {
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
15 }
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
16
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
17 function void main()
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
18 {
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
19 //init();
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
20 var RCC_Type RCC;
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
21 RCC = cast<RCC_Type>(0x40023800);
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
22
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
23 // Enable the clock to port D:
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
24 RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3);
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
25 // Memory mapped control registers:
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
26 var GPIO_Type GPIOD;
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
27 GPIOD = cast<GPIO_Type>(0x40020C00);
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
28
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
29 var int pin;
241
ce6d390043a7 Added reset and run at end of flashing
Windel Bouwman
parents: 237
diff changeset
30 pin = 15;
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
31 // PD13 == output (01)
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
32 GPIOD->MODER = (1 << (pin << 1));
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
33 GPIOD->ODR = (1 << pin);
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
34
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
35 while(true) {}
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
36 }
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
37