Mercurial > lcfOS
diff python/stm32f4/burn2.c3 @ 262:ed14e077124c
Added conditional branch instructions
author | Windel Bouwman |
---|---|
date | Fri, 09 Aug 2013 11:30:11 +0200 |
parents | |
children | 5ec7580976d9 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/python/stm32f4/burn2.c3 Fri Aug 09 11:30:11 2013 +0200 @@ -0,0 +1,45 @@ +/* + +This file blinks a LED on the STM32F4 discovery board. + +the board has 4 leds on PD12, PD13, PD14 and PD15 + +*/ + +package burn2; + +import stm32f4xx; + +function void init() +{ + var RCC_Type RCC; + RCC = cast<RCC_Type>(0x40023800); + + // Enable the clock to port D: + RCC->AHB1ENR = RCC->AHB1ENR | (1 << 3); + // Memory mapped control registers: + var GPIO_Type GPIOD; + GPIOD = cast<GPIO_Type>(0x40020C00); + + var int pin; + pin = 15; + // PD13 == output (01) + GPIOD->MODER = (1 << (pin << 1)); + GPIOD->ODR = (1 << pin); +} + + +function void main() +{ + init(); + + var int a; + a = 0 + while (a < 1000) + { + a = a + 1; + } + + while(true) {} +} +