comparison examples/c3/burn.c3 @ 300:158068af716c

yafm
author Windel Bouwman
date Tue, 03 Dec 2013 18:00:22 +0100
parents test/c3examples/burn.c3@05184b95fa16
children
comparison
equal deleted inserted replaced
299:674789d9ff37 300:158068af716c
1 /*
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
9 module burn;
10
11 import stm32f4xx;
12
13 /*
14 function void init()
15 {
16 }
17 */
18
19 function void main()
20 {
21 //init();
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);
27 // Memory mapped control registers:
28 var GPIO_Type GPIOD;
29 GPIOD = cast<GPIO_Type>(0x40020C00);
30
31 var int pin;
32 pin = 15;
33 // PD13 == output (01)
34 GPIOD->MODER = (1 << (pin << 1));
35 GPIOD->ODR = (1 << pin);
36
37 while(true) {}
38 }
39