python-on-a-chip online compiler

Dependencies:   mbed TSI

/media/uploads/va009039/p14p-f446re.png

more info: python-on-a-chip

Revision:
1:28afb064a41c
Parent:
0:65f1469d6bfb
Child:
2:a2bea117e22e
--- a/platform/mbed/main_nat.cpp	Sat Mar 02 11:54:20 2013 +0000
+++ b/platform/mbed/main_nat.cpp	Sun Mar 10 10:13:36 2013 +0000
@@ -4,7 +4,7 @@
  * PyMite usr native function file
  *
  * automatically created by pmImgCreator.py
- * on Sat Mar 02 20:27:03 2013
+ * on Sun Mar 10 18:24:12 2013
  *
  * DO NOT EDIT THIS FILE.
  * ANY CHANGES WILL BE LOST.
@@ -18,11 +18,6 @@
 /* From: mbed.py */
 #include "mbed.h"
 
-static DigitalOut led1(LED1);
-static DigitalOut led2(LED2);
-static DigitalOut led3(LED3);
-static DigitalOut led4(LED4);
-
 /* PinName lookup table.  Converts pin number to PinName. */
 static PinName const pinNumToName[] = {
     NC, LED1, LED2, LED3, LED4, p5, p6, p7, p8, p9,
@@ -54,6 +49,203 @@
         pPmObj_t pn;
         pPmObj_t pattrs;
         PmReturn_t retval = PM_RET_OK;
+        DigitalOut *dout;
+        uint8_t objid;
+
+        /* Raise TypeError if wrong number of args */
+        if (NATIVE_GET_NUM_ARGS() != 2)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pself = NATIVE_GET_LOCAL(0);
+
+        /* Raise TypeError if arg is not the right type */
+        pn = NATIVE_GET_LOCAL(1);
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+
+        /* Instantiate the C++ object */
+        dout = new DigitalOut(pinNumToName[((pPmInt_t)pn)->val]);
+
+        /* Save the pointer to adc as an inaccessible attribute */
+        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = int_new((uint32_t)dout, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        heap_gcPushTempRoot(pn, &objid);
+        retval = dict_setItem(pattrs, PM_NONE, pn);
+        heap_gcPopTempRoot(objid);
+        PM_RETURN_IF_ERROR(retval);
+
+        NATIVE_SET_TOS(PM_NONE);
+        return retval;
+        
+}
+
+PmReturn_t
+nat_02_mbed_write(pPmFrame_t *ppframe)
+{
+
+        pPmObj_t pself;
+        pPmObj_t pn;
+        pPmObj_t pattrs;
+        PmReturn_t retval = PM_RET_OK;
+        DigitalOut *dout;
+
+        /* Raise TypeError if wrong number of args */
+        if (NATIVE_GET_NUM_ARGS() != 2)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pself = NATIVE_GET_LOCAL(0);
+
+        /* Raise TypeError if arg is not the right type */
+        pn = NATIVE_GET_LOCAL(1);
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+
+        /* Get the the C++ instance */
+        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = dict_getItem(pattrs, PM_NONE, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        dout = (DigitalOut *)((pPmInt_t)pn)->val;
+
+        /* Write value to DAC */
+        pn = NATIVE_GET_LOCAL(1);
+        dout->write(((pPmInt_t)pn)->val);
+
+        NATIVE_SET_TOS(PM_NONE);
+        return retval;
+        
+}
+
+PmReturn_t
+nat_03_mbed_read(pPmFrame_t *ppframe)
+{
+
+        pPmObj_t pself;
+        pPmObj_t pn;
+        pPmObj_t pattrs;
+        PmReturn_t retval = PM_RET_OK;
+        DigitalOut *dout;
+        int32_t n;
+
+        /* If wrong number of args, throw type exception */
+        if (NATIVE_GET_NUM_ARGS() != 1)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pself = NATIVE_GET_LOCAL(0);
+
+        /* Get the the C++ instance */
+        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = dict_getItem(pattrs, PM_NONE, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        dout = (DigitalOut *)((pPmInt_t)pn)->val;
+
+        /* Return input value on the stack */
+        n = dout->read();
+        retval = int_new(n, &pn);
+        NATIVE_SET_TOS(pn);
+
+        return retval;
+        
+}
+
+PmReturn_t
+nat_04_mbed___init__(pPmFrame_t *ppframe)
+{
+
+        pPmObj_t pself;
+        pPmObj_t pn;
+        pPmObj_t pattrs;
+        PmReturn_t retval = PM_RET_OK;
+        DigitalIn *din;
+        uint8_t objid;
+
+        /* Raise TypeError if wrong number of args */
+        if (NATIVE_GET_NUM_ARGS() != 2)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pself = NATIVE_GET_LOCAL(0);
+
+        /* Raise TypeError if arg is not the right type */
+        pn = NATIVE_GET_LOCAL(1);
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+
+        /* Instantiate the C++ object */
+        din = new DigitalIn(pinNumToName[((pPmInt_t)pn)->val]);
+
+        /* Save the pointer to adc as an inaccessible attribute */
+        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = int_new((uint32_t)din, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        heap_gcPushTempRoot(pn, &objid);
+        retval = dict_setItem(pattrs, PM_NONE, pn);
+        heap_gcPopTempRoot(objid);
+        PM_RETURN_IF_ERROR(retval);
+
+        NATIVE_SET_TOS(PM_NONE);
+        return retval;
+        
+}
+
+PmReturn_t
+nat_05_mbed_read(pPmFrame_t *ppframe)
+{
+
+        pPmObj_t pself;
+        pPmObj_t pn;
+        pPmObj_t pattrs;
+        PmReturn_t retval = PM_RET_OK;
+        DigitalIn *din;
+        int32_t n;
+
+        /* If wrong number of args, throw type exception */
+        if (NATIVE_GET_NUM_ARGS() != 1)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pself = NATIVE_GET_LOCAL(0);
+
+        /* Get the the C++ instance */
+        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = dict_getItem(pattrs, PM_NONE, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        din = (DigitalIn *)((pPmInt_t)pn)->val;
+
+        /* Return input value on the stack */
+        n = din->read();
+        retval = int_new(n, &pn);
+        NATIVE_SET_TOS(pn);
+
+        return retval;
+        
+}
+
+PmReturn_t
+nat_06_mbed___init__(pPmFrame_t *ppframe)
+{
+
+        pPmObj_t pself;
+        pPmObj_t pn;
+        pPmObj_t pattrs;
+        PmReturn_t retval = PM_RET_OK;
         AnalogIn *adc;
         uint8_t objid;
 
@@ -91,7 +283,7 @@
 }
 
 PmReturn_t
-nat_02_mbed_read_u16(pPmFrame_t *ppframe)
+nat_07_mbed_read_u16(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -125,7 +317,7 @@
 }
 
 PmReturn_t
-nat_03_mbed_read(pPmFrame_t *ppframe)
+nat_08_mbed_read(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -159,7 +351,7 @@
 }
 
 PmReturn_t
-nat_04_mbed___init__(pPmFrame_t *ppframe)
+nat_09_mbed___init__(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -204,7 +396,7 @@
 }
 
 PmReturn_t
-nat_05_mbed_write_u16(pPmFrame_t *ppframe)
+nat_10_mbed_write_u16(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -245,7 +437,7 @@
 }
 
 PmReturn_t
-nat_06_mbed_write(pPmFrame_t *ppframe)
+nat_11_mbed_write(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -296,7 +488,7 @@
 }
 
 PmReturn_t
-nat_07_mbed_read(pPmFrame_t *ppframe)
+nat_12_mbed_read(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -330,203 +522,6 @@
 }
 
 PmReturn_t
-nat_08_mbed___init__(pPmFrame_t *ppframe)
-{
-
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
-        PmReturn_t retval = PM_RET_OK;
-        DigitalIn *din;
-        uint8_t objid;
-
-        /* Raise TypeError if wrong number of args */
-        if (NATIVE_GET_NUM_ARGS() != 2)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-        pself = NATIVE_GET_LOCAL(0);
-
-        /* Raise TypeError if arg is not the right type */
-        pn = NATIVE_GET_LOCAL(1);
-        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-
-        /* Instantiate the C++ object */
-        din = new DigitalIn(pinNumToName[((pPmInt_t)pn)->val]);
-
-        /* Save the pointer to adc as an inaccessible attribute */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
-        retval = int_new((uint32_t)din, &pn);
-        PM_RETURN_IF_ERROR(retval);
-        heap_gcPushTempRoot(pn, &objid);
-        retval = dict_setItem(pattrs, PM_NONE, pn);
-        heap_gcPopTempRoot(objid);
-        PM_RETURN_IF_ERROR(retval);
-
-        NATIVE_SET_TOS(PM_NONE);
-        return retval;
-        
-}
-
-PmReturn_t
-nat_09_mbed_read(pPmFrame_t *ppframe)
-{
-
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
-        PmReturn_t retval = PM_RET_OK;
-        DigitalIn *din;
-        int32_t n;
-
-        /* If wrong number of args, throw type exception */
-        if (NATIVE_GET_NUM_ARGS() != 1)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-        pself = NATIVE_GET_LOCAL(0);
-
-        /* Get the the C++ instance */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
-        retval = dict_getItem(pattrs, PM_NONE, &pn);
-        PM_RETURN_IF_ERROR(retval);
-        din = (DigitalIn *)((pPmInt_t)pn)->val;
-
-        /* Return input value on the stack */
-        n = din->read();
-        retval = int_new(n, &pn);
-        NATIVE_SET_TOS(pn);
-
-        return retval;
-        
-}
-
-PmReturn_t
-nat_10_mbed___init__(pPmFrame_t *ppframe)
-{
-
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
-        PmReturn_t retval = PM_RET_OK;
-        DigitalOut *dout;
-        uint8_t objid;
-
-        /* Raise TypeError if wrong number of args */
-        if (NATIVE_GET_NUM_ARGS() != 2)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-        pself = NATIVE_GET_LOCAL(0);
-
-        /* Raise TypeError if arg is not the right type */
-        pn = NATIVE_GET_LOCAL(1);
-        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-
-        /* Instantiate the C++ object */
-        dout = new DigitalOut(pinNumToName[((pPmInt_t)pn)->val]);
-
-        /* Save the pointer to adc as an inaccessible attribute */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
-        retval = int_new((uint32_t)dout, &pn);
-        PM_RETURN_IF_ERROR(retval);
-        heap_gcPushTempRoot(pn, &objid);
-        retval = dict_setItem(pattrs, PM_NONE, pn);
-        heap_gcPopTempRoot(objid);
-        PM_RETURN_IF_ERROR(retval);
-
-        NATIVE_SET_TOS(PM_NONE);
-        return retval;
-        
-}
-
-PmReturn_t
-nat_11_mbed_read(pPmFrame_t *ppframe)
-{
-
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
-        PmReturn_t retval = PM_RET_OK;
-        DigitalOut *dout;
-        int32_t n;
-
-        /* If wrong number of args, throw type exception */
-        if (NATIVE_GET_NUM_ARGS() != 1)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-        pself = NATIVE_GET_LOCAL(0);
-
-        /* Get the the C++ instance */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
-        retval = dict_getItem(pattrs, PM_NONE, &pn);
-        PM_RETURN_IF_ERROR(retval);
-        dout = (DigitalOut *)((pPmInt_t)pn)->val;
-
-        /* Return input value on the stack */
-        n = dout->read();
-        retval = int_new(n, &pn);
-        NATIVE_SET_TOS(pn);
-
-        return retval;
-        
-}
-
-PmReturn_t
-nat_12_mbed_write(pPmFrame_t *ppframe)
-{
-
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
-        PmReturn_t retval = PM_RET_OK;
-        DigitalOut *dout;
-
-        /* Raise TypeError if wrong number of args */
-        if (NATIVE_GET_NUM_ARGS() != 2)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-        pself = NATIVE_GET_LOCAL(0);
-
-        /* Raise TypeError if arg is not the right type */
-        pn = NATIVE_GET_LOCAL(1);
-        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
-        {
-            PM_RAISE(retval, PM_RET_EX_TYPE);
-            return retval;
-        }
-
-        /* Get the the C++ instance */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
-        retval = dict_getItem(pattrs, PM_NONE, &pn);
-        PM_RETURN_IF_ERROR(retval);
-        dout = (DigitalOut *)((pPmInt_t)pn)->val;
-
-        /* Write value to DAC */
-        pn = NATIVE_GET_LOCAL(1);
-        dout->write(((pPmInt_t)pn)->val);
-
-        NATIVE_SET_TOS(PM_NONE);
-        return retval;
-        
-}
-
-PmReturn_t
 nat_13_mbed___init__(pPmFrame_t *ppframe)
 {
 
@@ -571,7 +566,44 @@
 }
 
 PmReturn_t
-nat_14_mbed_read(pPmFrame_t *ppframe)
+nat_14_mbed_write(pPmFrame_t *ppframe)
+{
+
+        PmReturn_t retval = PM_RET_OK;
+
+        /* Raise TypeError if wrong number of args */
+        if (NATIVE_GET_NUM_ARGS() != 2)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+        pPmObj_t pself = NATIVE_GET_LOCAL(0);
+
+        /* Raise TypeError if arg is not the right type */
+        pPmObj_t pn = NATIVE_GET_LOCAL(1);
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_FLT)
+        {
+            PM_RAISE(retval, PM_RET_EX_TYPE);
+            return retval;
+        }
+
+        /* Get the the C++ instance */
+        pPmObj_t pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        retval = dict_getItem(pattrs, PM_NONE, &pn);
+        PM_RETURN_IF_ERROR(retval);
+        PwmOut* pwm = (PwmOut *)((pPmInt_t)pn)->val;
+
+        pn = NATIVE_GET_LOCAL(1);
+        float n = ((pPmFloat_t)pn)->val;
+        pwm->write(n);
+
+        NATIVE_SET_TOS(PM_NONE);
+        return retval;
+        
+}
+
+PmReturn_t
+nat_15_mbed_read(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -605,14 +637,10 @@
 }
 
 PmReturn_t
-nat_15_mbed_period(pPmFrame_t *ppframe)
+nat_16_mbed_period(pPmFrame_t *ppframe)
 {
 
-        pPmObj_t pself;
-        pPmObj_t pn;
-        pPmObj_t pattrs;
         PmReturn_t retval = PM_RET_OK;
-        PwmOut *pwm;
 
         /* Raise TypeError if wrong number of args */
         if (NATIVE_GET_NUM_ARGS() != 2)
@@ -620,25 +648,24 @@
             PM_RAISE(retval, PM_RET_EX_TYPE);
             return retval;
         }
-        pself = NATIVE_GET_LOCAL(0);
+        pPmObj_t pself = NATIVE_GET_LOCAL(0);
 
         /* Raise TypeError if arg is not the right type */
-        pn = NATIVE_GET_LOCAL(1);
-        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
+        pPmObj_t pn = NATIVE_GET_LOCAL(1);
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_FLT)
         {
             PM_RAISE(retval, PM_RET_EX_TYPE);
             return retval;
         }
 
         /* Get the the C++ instance */
-        pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
+        pPmObj_t pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
         retval = dict_getItem(pattrs, PM_NONE, &pn);
         PM_RETURN_IF_ERROR(retval);
-        pwm = (PwmOut *)((pPmInt_t)pn)->val;
+        PwmOut* pwm = (PwmOut *)((pPmInt_t)pn)->val;
 
-        /* Write value to DAC */
         pn = NATIVE_GET_LOCAL(1);
-        pwm->period(((pPmInt_t)pn)->val);
+        pwm->period(((pPmFloat_t)pn)->val);
 
         NATIVE_SET_TOS(PM_NONE);
         return retval;
@@ -646,7 +673,7 @@
 }
 
 PmReturn_t
-nat_16_mbed_period_ms(pPmFrame_t *ppframe)
+nat_17_mbed_period_ms(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -677,7 +704,6 @@
         PM_RETURN_IF_ERROR(retval);
         pwm = (PwmOut *)((pPmInt_t)pn)->val;
 
-        /* Write value to DAC */
         pn = NATIVE_GET_LOCAL(1);
         pwm->period_ms(((pPmInt_t)pn)->val);
 
@@ -687,7 +713,7 @@
 }
 
 PmReturn_t
-nat_17_mbed_period_us(pPmFrame_t *ppframe)
+nat_18_mbed_period_us(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -718,7 +744,6 @@
         PM_RETURN_IF_ERROR(retval);
         pwm = (PwmOut *)((pPmInt_t)pn)->val;
 
-        /* Write value to DAC */
         pn = NATIVE_GET_LOCAL(1);
         pwm->period_us(((pPmInt_t)pn)->val);
 
@@ -728,14 +753,13 @@
 }
 
 PmReturn_t
-nat_18_mbed_pulsewidth(pPmFrame_t *ppframe)
+nat_19_mbed_pulsewidth(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
         pPmObj_t pn;
         pPmObj_t pattrs;
         PmReturn_t retval = PM_RET_OK;
-        PwmOut *pwm;
 
         /* Raise TypeError if wrong number of args */
         if (NATIVE_GET_NUM_ARGS() != 2)
@@ -747,7 +771,7 @@
 
         /* Raise TypeError if arg is not the right type */
         pn = NATIVE_GET_LOCAL(1);
-        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_INT)
+        if (OBJ_GET_TYPE(pn) != OBJ_TYPE_FLT)
         {
             PM_RAISE(retval, PM_RET_EX_TYPE);
             return retval;
@@ -757,11 +781,10 @@
         pattrs = (pPmObj_t)((pPmInstance_t)pself)->cli_attrs;
         retval = dict_getItem(pattrs, PM_NONE, &pn);
         PM_RETURN_IF_ERROR(retval);
-        pwm = (PwmOut *)((pPmInt_t)pn)->val;
+        PwmOut* pwm = (PwmOut *)((pPmInt_t)pn)->val;
 
-        /* Write value to DAC */
         pn = NATIVE_GET_LOCAL(1);
-        pwm->pulsewidth(((pPmInt_t)pn)->val);
+        pwm->pulsewidth(((pPmFloat_t)pn)->val);
 
         NATIVE_SET_TOS(PM_NONE);
         return retval;
@@ -769,7 +792,7 @@
 }
 
 PmReturn_t
-nat_19_mbed_puslewidth_ms(pPmFrame_t *ppframe)
+nat_20_mbed_puslewidth_ms(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -810,7 +833,7 @@
 }
 
 PmReturn_t
-nat_20_mbed_pulsewidth_us(pPmFrame_t *ppframe)
+nat_21_mbed_pulsewidth_us(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -841,7 +864,6 @@
         PM_RETURN_IF_ERROR(retval);
         pwm = (PwmOut *)((pPmInt_t)pn)->val;
 
-        /* Write value to DAC */
         pn = NATIVE_GET_LOCAL(1);
         pwm->pulsewidth_us(((pPmInt_t)pn)->val);
 
@@ -851,7 +873,7 @@
 }
 
 PmReturn_t
-nat_21_mbed___init__(pPmFrame_t *ppframe)
+nat_22_mbed___init__(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -900,7 +922,7 @@
 }
 
 PmReturn_t
-nat_22_mbed_putc(pPmFrame_t *ppframe)
+nat_23_mbed_putc(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -941,7 +963,7 @@
 }
 
 PmReturn_t
-nat_23_mbed_puts(pPmFrame_t *ppframe)
+nat_24_mbed_puts(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -982,7 +1004,7 @@
 }
 
 PmReturn_t
-nat_24_mbed_getc(pPmFrame_t *ppframe)
+nat_25_mbed_getc(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1016,7 +1038,7 @@
 }
 
 PmReturn_t
-nat_25_mbed___init__(pPmFrame_t *ppframe)
+nat_26_mbed___init__(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1069,7 +1091,7 @@
 }
 
 PmReturn_t
-nat_26_mbed_format(pPmFrame_t *ppframe)
+nat_27_mbed_format(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1118,7 +1140,7 @@
 }
 
 PmReturn_t
-nat_27_mbed_frequency(pPmFrame_t *ppframe)
+nat_28_mbed_frequency(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1159,7 +1181,7 @@
 }
 
 PmReturn_t
-nat_28_mbed_write(pPmFrame_t *ppframe)
+nat_29_mbed_write(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1201,7 +1223,7 @@
 }
 
 PmReturn_t
-nat_29_mbed___init__(pPmFrame_t *ppframe)
+nat_30_mbed___init__(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1250,7 +1272,7 @@
 }
 
 PmReturn_t
-nat_30_mbed_frequency(pPmFrame_t *ppframe)
+nat_31_mbed_frequency(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1291,7 +1313,7 @@
 }
 
 PmReturn_t
-nat_31_mbed_read(pPmFrame_t *ppframe)
+nat_32_mbed_read(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1340,7 +1362,7 @@
 }
 
 PmReturn_t
-nat_32_mbed_write(pPmFrame_t *ppframe)
+nat_33_mbed_write(pPmFrame_t *ppframe)
 {
 
         pPmObj_t pself;
@@ -1387,86 +1409,41 @@
         
 }
 
-PmReturn_t
-nat_33_mbed_set_led(pPmFrame_t *ppframe)
-{
-
-    pPmObj_t pled;
-    pPmObj_t pval;
-    int32_t nled;
-    int32_t nval;
-    PmReturn_t retval = PM_RET_OK;
-
-    /* If wrong number of args, raise TypeError */
-    if (NATIVE_GET_NUM_ARGS() > 2)
-    {
-        PM_RAISE(retval, PM_RET_EX_TYPE);
-        return retval;
-    }
-
-    /* If arg is not an int, raise TypeError */
-    pled = NATIVE_GET_LOCAL(0);
-    pval = NATIVE_GET_LOCAL(1);
-    if ((OBJ_GET_TYPE(pled) != OBJ_TYPE_INT)
-        || (OBJ_GET_TYPE(pval) != OBJ_TYPE_INT))
-    {
-        PM_RAISE(retval, PM_RET_EX_TYPE);
-        return retval;
-    }
-
-    /* Get int value from the arg */
-    nled = ((pPmInt_t)pled)->val;
-    nval = ((pPmInt_t)pval)->val;
-
-    /* Set the LED to the given value */
-    switch (nled)
-    {
-        case 1: led1 = nval; break;
-        case 2: led2 = nval; break;
-        case 3: led3 = nval; break;
-        case 4: led4 = nval; break;
-    }
-
-    NATIVE_SET_TOS(PM_NONE);
-    return retval;
-    
-}
-
 /* Native function lookup table */
 pPmNativeFxn_t const usr_nat_fxn_table[] =
 {
     nat_placeholder_func,
     nat_01_mbed___init__,
-    nat_02_mbed_read_u16,
+    nat_02_mbed_write,
     nat_03_mbed_read,
     nat_04_mbed___init__,
-    nat_05_mbed_write_u16,
-    nat_06_mbed_write,
-    nat_07_mbed_read,
-    nat_08_mbed___init__,
-    nat_09_mbed_read,
-    nat_10_mbed___init__,
-    nat_11_mbed_read,
-    nat_12_mbed_write,
+    nat_05_mbed_read,
+    nat_06_mbed___init__,
+    nat_07_mbed_read_u16,
+    nat_08_mbed_read,
+    nat_09_mbed___init__,
+    nat_10_mbed_write_u16,
+    nat_11_mbed_write,
+    nat_12_mbed_read,
     nat_13_mbed___init__,
-    nat_14_mbed_read,
-    nat_15_mbed_period,
-    nat_16_mbed_period_ms,
-    nat_17_mbed_period_us,
-    nat_18_mbed_pulsewidth,
-    nat_19_mbed_puslewidth_ms,
-    nat_20_mbed_pulsewidth_us,
-    nat_21_mbed___init__,
-    nat_22_mbed_putc,
-    nat_23_mbed_puts,
-    nat_24_mbed_getc,
-    nat_25_mbed___init__,
-    nat_26_mbed_format,
-    nat_27_mbed_frequency,
-    nat_28_mbed_write,
-    nat_29_mbed___init__,
-    nat_30_mbed_frequency,
-    nat_31_mbed_read,
-    nat_32_mbed_write,
-    nat_33_mbed_set_led,
+    nat_14_mbed_write,
+    nat_15_mbed_read,
+    nat_16_mbed_period,
+    nat_17_mbed_period_ms,
+    nat_18_mbed_period_us,
+    nat_19_mbed_pulsewidth,
+    nat_20_mbed_puslewidth_ms,
+    nat_21_mbed_pulsewidth_us,
+    nat_22_mbed___init__,
+    nat_23_mbed_putc,
+    nat_24_mbed_puts,
+    nat_25_mbed_getc,
+    nat_26_mbed___init__,
+    nat_27_mbed_format,
+    nat_28_mbed_frequency,
+    nat_29_mbed_write,
+    nat_30_mbed___init__,
+    nat_31_mbed_frequency,
+    nat_32_mbed_read,
+    nat_33_mbed_write,
 };