using System; using System.Text; using System.Threading; using HWModules; using Microsoft.SPOT; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace CPFUnitTests.IsbBoard { [TestClass] class UT_Isb_IO { [TestMethod] public void TestPowerSwitches() { Init(); Debug.Print("ISB Power Test"); WaitForLdr0(); // POS 14 TestPower(MotherBoard.ChannelNames.PositionSensorChannel, "Position Sensor J2"); // GPS 15 TestPower(MotherBoard.ChannelNames.GPSChannel, "GPS J1"); // VALVE 16 TestPower(MotherBoard.ChannelNames.MotorizedValve, "Motorized Valve J3"); // SPARE 17 TestPower(MotherBoard.ChannelNames.Spare1I2C, "Spare 1 I2C J4"); // SPARE TestPower(MotherBoard.ChannelNames.Spare2I2C, "Spare 2 J5"); // SPARE 3 TestPower(MotherBoard.ChannelNames.Spare3SPI, "Spare 3 J6"); } private void TestPower(MotherBoard.ChannelNames chan, string channelName) { Debug.Print(channelName + " Power Test"); WaitForLdr0(); Debug.Print(channelName + " ON"); mb.EnableChannelPower(chan); WaitForLdr0(); mb.DisableChannelPower(chan); Debug.Print(channelName + " OFF"); } private void WaitForLdr0() { Debug.Print("Press LDR0 Button to Continue... \n"); while (!mb.Ldr0Pushed) Thread.Sleep(100); //Clear the state mb.Ldr0Pushed = false; } private MotherBoard mb; void Init() { mb = MotherBoard.Instance; mb.Enable5V(); mb.Enable12V(); EngrLogger.init(new StringBuilder("ISB_IO_UT")); } } }