Mercurial > lcfOS
view python/c3/examples/burn2.c3 @ 280:02385f62f250
Rework from str interface to Instruction interface
author | Windel Bouwman |
---|---|
date | Sat, 02 Nov 2013 10:03:26 +0100 |
parents | 2ccd57b1d78c |
children |
line wrap: on
line source
/* 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 int add(int a, int b) { return a + b; } function void init(int pin) { if (pin < 12) { return; } /*if (pin > 15) { return; }*/ 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); // PD13 == output (01) GPIOD->MODER = (1 << (pin << 1)); GPIOD->ODR = (1 << pin); } function void main() { // Vary between 12 and 15: init(13); var int a; a = 0 while (a < 1000) { a = a + 1; } while(true) {} }