comparison python/c3/examples/burn2.c3 @ 271:cf7d5fb7d9c8

Reorganization
author Windel Bouwman
date Tue, 20 Aug 2013 18:56:02 +0200
parents python/stm32f4/burn2.c3@5ec7580976d9
children 2ccd57b1d78c
comparison
equal deleted inserted replaced
270:cdc76d183bcc 271:cf7d5fb7d9c8
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 package burn2;
10
11 import stm32f4xx;
12
13 function void init()
14 {
15 var RCC_Type RCC;
16 RCC = cast<RCC_Type>(0x40023800);
17
18 // Enable the clock to port D:
19 RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3);
20 // Memory mapped control registers:
21 var GPIO_Type GPIOD;
22 GPIOD = cast<GPIO_Type>(0x40020C00);
23
24 var int pin;
25 pin = 15;
26 // PD13 == output (01)
27 GPIOD->MODER = (1 << (pin * 2));
28 GPIOD->ODR = (1 << pin);
29 }
30
31
32 function void main()
33 {
34 init();
35
36 var int a;
37 a = 0
38 while (a < 1000)
39 {
40 a = a + 1;
41 }
42
43 while(true) {}
44 }
45