public UserControlPlotDUT() { InitializeComponent(); DataContext = this; this.fx3FirmwarePath = "FX3_Firmware.img"; this.fx3BootloaderPath = "boot_fw.img"; this.fx3ProgrammerPath = "USBFlashProg.img"; // UI initialization. Will be replace by VMMV //IsAttachedTextBox.Text = false.ToString(); //ConnectToggleButton.IsChecked = false; // FirmwarePath, set target to "FX3_Firmware.img" // BootloaderPath, set target to "boot_fw.img" // ProgrammerPath, set target to "USBFlashProg.img" fX3Connection = new FX3Connection(this.fx3FirmwarePath, fx3BootloaderPath, fx3ProgrammerPath, DeviceType.IMU); _evalBoard = new ADXL345EB(fX3Connection); boardDataM = new BoardDataModel(); boardDataVM = new BoardDataViewModel(boardDataM); fX3Connection.PartType = DUTType.ADcmXL3021; Dut = new AdcmInterface3Axis(fX3Connection); InitializePlot(); RegistersComboBox.ItemsSource = Enum.GetValues(typeof(ADXL345EB.RegisterAddress)); AxisComboBox.ItemsSource = Enum.GetValues(typeof(AccelerometerAxis)); PresetComboBox.ItemsSource = Enum.GetValues(typeof(ADXL345EB.Presets)); CheckIfAttached(); }
/// <summary> /// Wrapper constructor. Loads resources and connects to FX3 /// </summary> /// <param name="FX3ResourcePath">Path the FX3 firmware binaries</param> /// <param name="RegMapPath">Path to register map file</param> /// <param name="Type"></param> public Wrapper(string FX3ResourcePath, string RegMapPath, SensorType Type) { FX3 = new FX3Connection(FX3ResourcePath, FX3ResourcePath, FX3ResourcePath); ConnectToBoard(); UpdateDutType(Type); UpdateRegMap(RegMapPath); }
public void ImagePathsTest() { int exCount; Console.WriteLine("Starting firmware image path validation test..."); Assert.AreEqual(ResourcePath + @"\FX3_Firmware.img", FX3.FirmwarePath, "ERROR: Invalid firmware path"); Assert.AreEqual(ResourcePath + @"\boot_fw.img", FX3.BootloaderPath, "ERROR: Invalid firmware path"); Assert.AreEqual(ResourcePath + @"\USBFlashProg.img", FX3.FlashProgrammerPath, "ERROR: Invalid firmware path"); try { exCount = 0; FX3Connection temp = new FX3Connection("bad.img", ResourcePath, ResourcePath, DeviceType.IMU); } catch (Exception e) { Console.WriteLine(e.Message); Assert.True(e is FX3ConfigurationException, "ERROR: Expected FX3 configuration exception to be thrown"); exCount = 1; } Assert.AreEqual(1, exCount, "ERROR: Expected exception to be thrown for bad firmware image path"); try { exCount = 0; FX3Connection temp = new FX3Connection(ResourcePath, "bad.img", ResourcePath, DeviceType.IMU); } catch (Exception e) { Console.WriteLine(e.Message); Assert.True(e is FX3ConfigurationException, "ERROR: Expected FX3 configuration exception to be thrown"); exCount = 1; } Assert.AreEqual(1, exCount, "ERROR: Expected exception to be thrown for bad bootloader image path"); try { exCount = 0; FX3Connection temp = new FX3Connection(ResourcePath, ResourcePath, "bad.img", DeviceType.IMU); } catch (Exception e) { Console.WriteLine(e.Message); Assert.True(e is FX3ConfigurationException, "ERROR: Expected FX3 configuration exception to be thrown"); exCount = 1; } Assert.AreEqual(1, exCount, "ERROR: Expected exception to be thrown for bad flash programmer image path"); }
public void TestFixtureSetup() { Console.WriteLine("Starting test fixture setup..."); string exePath = System.AppDomain.CurrentDomain.BaseDirectory; Console.WriteLine("Tests executing from " + exePath); ResourcePath = Path.GetFullPath(Path.Combine(exePath, @"..\..\..\")); ResourcePath = Path.Combine(ResourcePath, "Resources"); Assert.True(Directory.Exists(ResourcePath), "ERROR: Resource path not found. Build process may have failed!"); FX3 = new FX3Connection(ResourcePath, ResourcePath, ResourcePath, DeviceType.IMU); Connect(); Console.WriteLine("FX3 Connected! FX3 API Info: " + Environment.NewLine + FX3.GetFX3ApiInfo.ToString()); Console.WriteLine("FX3 Board Info: " + Environment.NewLine + FX3.ActiveFX3.ToString()); Console.WriteLine("Test fixture setup complete"); }