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

yafm
author Windel Bouwman
date Tue, 03 Dec 2013 18:00:22 +0100
parents test/c3examples/blink.c3@05184b95fa16
children
comparison
equal deleted inserted replaced
299:674789d9ff37 300:158068af716c
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
7 module blink;
8
9 import stm32f4xx;
10
11 // Functions:
12 function void main()
13 {
14 // Memory mapped control registers:
15 var GPIO_Type GPIOD;
16 GPIOD = cast<GPIO_Type>(0x40020C00);
17 var RCC_Type RCC;
18 RCC = cast<RCC_Type>(0x40023800);
19
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
28 while(true) {}
29 }
30