Beispiel #1
0
 private static void BlinkLedFor20Seconds(CompiledCode code)
 {
     //Because the code will be running as an interrupt, we need to keep the array pinned
       unsafe {
     fixed(short* fix=code.OpCodes) {
       code.Invoke(500000, (int)Pins.ONBOARD_LED); //on for 1/2 second, off for 1/2 second
       Thread.Sleep(20*1000); //sleep for 20 seconds
       code.Invoke(0); //abort timer so we can safely exit this fixed block
     }
       }
 }
Beispiel #2
0
        public int Invoke(int intParam0=0, int intParam1=0, int intParam2=0, int intParam3=0,
      byte[] byteArrayParam4=null, byte[] byteArrayParam5=null, byte[] byteArrayParam6=null, byte[] byteArrayParam7=null,
      int[] intArrayParam8=null, int[] intArrayParam9=null, int[] intArrayParam10=null, int[] intArrayParam11=null,
      CompiledCode ccParam12=null, CompiledCode ccParam13=null, CompiledCode ccParam14=null, CompiledCode ccParam15=null)
        {
            if(!checkedVersion) {
            var versionNumber=NativeInterface.GetInfo(0);
            if(versionNumber!=expectedVersionNumber) {
              throw new Exception("version number mismatch");
            }
            checkedVersion=true;
              }

              return NativeInterface.Execute(OpCodes,
            intParam0, intParam1, intParam2, intParam3,
            byteArrayParam4, byteArrayParam5, byteArrayParam6, byteArrayParam7,
            intArrayParam8, intArrayParam9, intArrayParam10, intArrayParam11,
            GetArrayHelper(ccParam12), GetArrayHelper(ccParam13), GetArrayHelper(ccParam14), GetArrayHelper(ccParam15)
            );
        }
Beispiel #3
0
        public int Invoke(int intParam0          = 0, int intParam1 = 0, int intParam2 = 0, int intParam3 = 0,
                          byte[] byteArrayParam4 = null, byte[] byteArrayParam5 = null, byte[] byteArrayParam6 = null, byte[] byteArrayParam7 = null,
                          int[] intArrayParam8   = null, int[] intArrayParam9   = null, int[] intArrayParam10  = null, int[] intArrayParam11  = null,
                          CompiledCode ccParam12 = null, CompiledCode ccParam13 = null, CompiledCode ccParam14 = null, CompiledCode ccParam15 = null)
        {
            if (!checkedVersion)
            {
                var versionNumber = NativeInterface.GetInfo(0);
                if (versionNumber != expectedVersionNumber)
                {
                    throw new Exception("version number mismatch");
                }
                checkedVersion = true;
            }

            return(NativeInterface.Execute(OpCodes,
                                           intParam0, intParam1, intParam2, intParam3,
                                           byteArrayParam4, byteArrayParam5, byteArrayParam6, byteArrayParam7,
                                           intArrayParam8, intArrayParam9, intArrayParam10, intArrayParam11,
                                           GetArrayHelper(ccParam12), GetArrayHelper(ccParam13), GetArrayHelper(ccParam14), GetArrayHelper(ccParam15)
                                           ));
        }
Beispiel #4
0
 private static short[] GetArrayHelper(CompiledCode cc)
 {
     return(cc == null ? null : cc.OpCodes);
 }
Beispiel #5
0
 private static short[] GetArrayHelper(CompiledCode cc)
 {
     return cc==null ? null : cc.OpCodes;
 }