annotate examples/c3/burn.c3 @ 305:0615b5308710

Updated docs
author Windel Bouwman
date Fri, 06 Dec 2013 13:50:38 +0100
parents 158068af716c
children
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
284
05184b95fa16 Moved tests to seperate folder
Windel Bouwman
parents: 271
diff changeset
9 module 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
256
225f444019b1 Added build and flash menu option
Windel Bouwman
parents: 251
diff changeset
13 /*
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
14 function void init()
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
15 {
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
16 }
256
225f444019b1 Added build and flash menu option
Windel Bouwman
parents: 251
diff changeset
17 */
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
18
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
19 function void main()
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
20 {
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
21 //init();
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
22 var RCC_Type RCC;
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
23 RCC = cast<RCC_Type>(0x40023800);
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
24
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
25 // Enable the clock to port D:
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
26 RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3);
251
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
27 // Memory mapped control registers:
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
28 var GPIO_Type GPIOD;
6ed3d3a82a63 Added another c3 example. First import attempt
Windel Bouwman
parents: 241
diff changeset
29 GPIOD = cast<GPIO_Type>(0x40020C00);
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
30
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
31 var int pin;
241
ce6d390043a7 Added reset and run at end of flashing
Windel Bouwman
parents: 237
diff changeset
32 pin = 15;
237
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
33 // PD13 == output (01)
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
34 GPIOD->MODER = (1 << (pin << 1));
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
35 GPIOD->ODR = (1 << pin);
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
36
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
37 while(true) {}
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
38 }
81752b0f85a5 Added burn led test program
Windel Bouwman
parents:
diff changeset
39