diff python/c3/examples/blink.c3 @ 271:cf7d5fb7d9c8

Reorganization
author Windel Bouwman
date Tue, 20 Aug 2013 18:56:02 +0200
parents python/stm32f4/blink.c3@6ed3d3a82a63
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/c3/examples/blink.c3	Tue Aug 20 18:56:02 2013 +0200
@@ -0,0 +1,30 @@
+/* This file blinks a LED on the STM32F4 discovery board.
+
+the board has 4 leds on PD12, PD13, PD14 and PD15
+
+*/
+
+package blink;
+
+import stm32f4xx;
+
+// Functions:
+function void main()
+{
+    // Memory mapped control registers:
+    var GPIO_Type GPIOD;
+    GPIOD = cast<GPIO_Type>(0x40020C00);
+    var RCC_Type RCC;
+    RCC = cast<RCC_Type>(0x40023800);
+
+    // Enable the clock to port D:
+    RCC->AHB1ENR = RCC->AHB1ENR | 0x8;
+
+
+    // PD13 == output (01)
+    GPIOD->MODER = (1 << 26);
+    GPIOD->ODR = (1 << 13);
+
+    while(true) {}
+}
+