Mercurial > lcfOS
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 | 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 | |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
241
diff
changeset
|
9 package burn; |
237 | 10 |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
241
diff
changeset
|
11 import stm32f4xx; |
237 | 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 | 16 |
17 function void main() | |
18 { | |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
241
diff
changeset
|
19 //init(); |
237 | 20 var RCC_Type RCC; |
21 RCC = cast<RCC_Type>(0x40023800); | |
22 | |
23 // Enable the clock to port D: | |
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 | 28 |
29 var int pin; | |
241 | 30 pin = 15; |
237 | 31 // PD13 == output (01) |
32 GPIOD->MODER = (1 << (pin << 1)); | |
33 GPIOD->ODR = (1 << pin); | |
34 | |
35 while(true) {} | |
36 } | |
37 |