diff 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 diff
--- a/python/c3/examples/burn2.c3	Sat Oct 12 09:56:23 2013 +0200
+++ b/python/c3/examples/burn2.c3	Sat Nov 02 10:03:26 2013 +0100
@@ -10,8 +10,24 @@
 
 import stm32f4xx;
 
-function void init()
+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);
 
@@ -21,8 +37,6 @@
     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);
@@ -31,13 +45,14 @@
 
 function void main()
 {
-    init();
+    // Vary between 12 and 15:
+    init(13);
 
     var int a;
     a = 0
     while (a < 1000)
     {
-      a = a + 1;
+        a = a + 1;
     }
 
     while(true) {}