comparison examples/c3/burn2.c3 @ 306:b145f8e6050b

Start on c3 rewrite
author Windel Bouwman
date Mon, 09 Dec 2013 19:00:21 +0100
parents 158068af716c
children
comparison
equal deleted inserted replaced
305:0615b5308710 306:b145f8e6050b
25 if (pin > 15) 25 if (pin > 15)
26 { 26 {
27 return; 27 return;
28 } 28 }
29 29
30 var stm32f4xx:RCC_Type RCC; 30 var stm32f4xx.RCC_Type RCC;
31 RCC = cast<stm32f4xx:RCC_Type>(0x40023800); 31 RCC = cast<stm32f4xx.RCC_Type>(0x40023800);
32 32
33 // Enable the clock to port D: 33 // Enable the clock to port D:
34 RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3); 34 RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3);
35 // Memory mapped control registers: 35 // Memory mapped control registers:
36 var stm32f4xx:GPIO_Type GPIOD; 36 var stm32f4xx.GPIO_Type GPIOD;
37 GPIOD = cast<stm32f4xx:GPIO_Type>(0x40020C00); 37 GPIOD = cast<stm32f4xx.GPIO_Type>(0x40020C00);
38 38
39 // PD13 == output (01) 39 // PD13 == output (01)
40 GPIOD->MODER = (1 << (pin << 1)); 40 GPIOD->MODER = (1 << (pin << 1));
41 GPIOD->ODR = (1 << pin); 41 GPIOD->ODR = (1 << pin);
42 } 42 }
46 { 46 {
47 // Vary between 12 and 15: 47 // Vary between 12 and 15:
48 init(13); 48 init(13);
49 49
50 var int a; 50 var int a;
51 a = 0 51 a = 0;
52 while (a < 1000) 52 while (a < 1000)
53 { 53 {
54 a = add(a, 1); 54 a = add(a, 1);
55 } 55 }
56 56