comparison test/c3examples/blink.c3 @ 284:05184b95fa16

Moved tests to seperate folder
author Windel Bouwman
date Fri, 15 Nov 2013 13:43:22 +0100
parents python/c3/examples/blink.c3@cf7d5fb7d9c8
children
comparison
equal deleted inserted replaced
283:c9781c73e7e2 284:05184b95fa16
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