Mercurial > lcfOS
annotate examples/c3/blink.c3 @ 365:98ff43cfdd36
Nasty bug in adr instruction
author | Windel Bouwman |
---|---|
date | Wed, 19 Mar 2014 22:32:04 +0100 |
parents | 158068af716c |
children |
rev | line source |
---|---|
232 | 1 /* This file blinks a LED on the STM32F4 discovery board. |
2 | |
3 the board has 4 leds on PD12, PD13, PD14 and PD15 | |
4 | |
5 */ | |
6 | |
284 | 7 module blink; |
204 | 8 |
251
6ed3d3a82a63
Added another c3 example. First import attempt
Windel Bouwman
parents:
232
diff
changeset
|
9 import stm32f4xx; |
204 | 10 |
11 // Functions: | |
12 function void main() | |
13 { | |
232 | 14 // Memory mapped control registers: |
231 | 15 var GPIO_Type GPIOD; |
232 | 16 GPIOD = cast<GPIO_Type>(0x40020C00); |
17 var RCC_Type RCC; | |
18 RCC = cast<RCC_Type>(0x40023800); | |
228 | 19 |
232 | 20 // Enable the clock to port D: |
21 RCC->AHB1ENR = RCC->AHB1ENR | 0x8; | |
22 | |
23 | |
24 // PD13 == output (01) | |
25 GPIOD->MODER = (1 << 26); | |
26 GPIOD->ODR = (1 << 13); | |
27 | |
205 | 28 while(true) {} |
204 | 29 } |
30 |