Mercurial > lcfOS
annotate test/c3examples/burn.c3 @ 286:d9df72971cbf
Changed package to module
author | Windel Bouwman |
---|---|
date | Fri, 15 Nov 2013 13:52:32 +0100 |
parents | 05184b95fa16 |
children |
rev | line source |
---|---|
241 | 1 /* |
237 | 2 |
3 This file blinks a LED on the STM32F4 discovery board. | |
4 | |
5 the board has 4 leds on PD12, PD13, PD14 and PD15 | |
6 | |
7 */ | |
8 | |
284 | 9 module burn; |
237 | 10 |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
241
diff
changeset
|
11 import stm32f4xx; |
237 | 12 |
256 | 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 | 17 */ |
237 | 18 |
19 function void main() | |
20 { | |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
241
diff
changeset
|
21 //init(); |
237 | 22 var RCC_Type RCC; |
23 RCC = cast<RCC_Type>(0x40023800); | |
24 | |
25 // Enable the clock to port D: | |
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 | 30 |
31 var int pin; | |
241 | 32 pin = 15; |
237 | 33 // PD13 == output (01) |
34 GPIOD->MODER = (1 << (pin << 1)); | |
35 GPIOD->ODR = (1 << pin); | |
36 | |
37 while(true) {} | |
38 } | |
39 |