aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Scripts/test.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Stubs Collection/stubs/Scripts/test.cs')
-rw-r--r--Software/Stubs Collection/stubs/Scripts/test.cs76
1 files changed, 76 insertions, 0 deletions
diff --git a/Software/Stubs Collection/stubs/Scripts/test.cs b/Software/Stubs Collection/stubs/Scripts/test.cs
new file mode 100644
index 000000000..a0aebf743
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Scripts/test.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Text;
+using System.Linq;
+using System.Drawing;
+using System.Diagnostics;
+using System.Windows.Forms;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+//----------------------
+
+//----------------------
+const Int32 I2C_ID = 3; //MCU_I2C2
+const Int32 TCA9548A_address = 0xe2; //or 0xE0 or 0xE4
+const Int32 I2C_Slave_Add = 0xc0; // /MPC9600 address
+//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46
+//----------------------
+
+
+int disable_all_channel1()
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = 0xe0;
+
+// UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x10);//enable all 8 i2c channel
+
+ stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+ Thread.Sleep(10);
+
+ return 1;
+ }
+int disable_all_channel2()
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = 0xe2;
+
+// UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//enable all 8 i2c channel
+
+ stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+ Thread.Sleep(10);
+
+ return 1;
+ }
+
+int disable_all_channel3()
+ {
+ StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest();
+ stubI2CWriteBytesRequest.I2CId = I2C_ID;
+ stubI2CWriteBytesRequest.SlaveAddress = 0xe4;
+
+// UInt32 uInt32 = new UInt32();
+ stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//enable all 8 i2c channel
+
+ stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest);
+ Thread.Sleep(10);
+
+ return 1;
+ }
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ disable_all_channel1();
+ disable_all_channel2();
+ disable_all_channel3();
+
+
+} \ No newline at end of file