private static void EnableLine(MpsseDevice mpsse) { FtdiPin PinState = FtdiPin.GPIOL0 | FtdiPin.GPIOL1; FtdiPin PinDirection = (FtdiPin)(FtdiPin.TCK | FtdiPin.TDI | FtdiPin.TMS | FtdiPin.GPIOL0 | FtdiPin.GPIOL1); mpsse.SetDataBitsLowByte(PinState, PinDirection); }
public Gpio(MpsseDevice mpsse) { _mpsse = mpsse; _mpsse.AdBusDirection.Mask(false, false, true, true, true, null, null, null); _mpsse.AdBusValue.Set((byte)0x0); _mpsse.Enqueue(MpsseCommand.SetDataBitsLowByte(_mpsse.AdBusValue, _mpsse.AdBusDirection)); _mpsse.ExecuteBuffer(); }
protected void spiWrite(byte[] data) { using (MpsseDevice mpsse = deviceConnect()) { SpiDevice spi = new SpiDevice(mpsse); DebugWrite("transmitRaw: ", data); spi.write(data); } }
protected byte[] spiReadWrite(byte[] data) { using (MpsseDevice mpsse = deviceConnect()) { SpiDevice spi = new SpiDevice(mpsse); DebugWrite("transmitRaw: ", data); byte[] rcvd = spi.readWrite(data); DebugWrite("receivedRaw: ", rcvd); return(rcvd); } }
public I2cBus(MpsseDevice mpsse) { _mpsse = mpsse; _mpsse.Enqueue(MpsseCommand.DisableClkDivideBy5()); _mpsse.Enqueue(MpsseCommand.TurnOffAdaptiveClocking()); _mpsse.Enqueue(MpsseCommand.Enable3PhaseDataClocking()); _mpsse.Enqueue(MpsseCommand.SetClkDivisor(mpsse.ClkDivisor)); _mpsse.Enqueue(MpsseCommand.DisconnectTdiTdoLoopback()); _mpsse.Enqueue(MpsseCommand.SetIoToOnlyDriveOn0andTristateOn1(FtdiPin.DO | FtdiPin.DI | FtdiPin.CK, FtdiPin.None)); _mpsse.AdBusDirection.SetBit(0).SetBit(1); _mpsse.AdBusValue.SetBit(0).SetBit(1); _mpsse.Enqueue(MpsseCommand.SetDataBitsLowByte(_mpsse.AdBusValue, _mpsse.AdBusDirection)); _mpsse.ExecuteBuffer(); }
private void button1_Click_1(object sender, EventArgs e) { try { mpsse = new FT232H(selectedSerialNumber); spi = new SpiDevice(mpsse); mpsse.Loopback = loopBackCheckBox.Checked; status_label.Text = CONNECTED; connectButton.BackColor = Color.Lime; otextBox.Text = "Succesful connection!" + Environment.NewLine + "Frequency = 100kHz"; otextBox.Text = "Succesful connection!" + Environment.NewLine + "Frequency = 100kHz"; // Repetition needed to make this appear?? connected = true; } catch (Exception ex) { Console.Write("Exception occured!...Disconnecting"); status_label.Text = DISCONNECTED; connectButton.BackColor = Color.Red; otextBox.Text = "Failed to connect!"; connected = false; } }
public SpiDevice(MpsseDevice mpsse, SpiParams param) { this.mpsse = mpsse; this.param = param; switch (param.Mode) { default: case SpiMode.Mode0: writeCommand = mpsse.BytesOutOnMinusEdgeWithMsbFirst; readWriteCommand = mpsse.BytesInOnPlusOutOnMinusWithMsbFirst; break; case SpiMode.Mode2: writeCommand = mpsse.BytesOutOnPlusEdgeWithMsbFirst; readWriteCommand = mpsse.BytesInOnMinusOutOnPlusWithMsbFirst; break; } //pin init values switch (param.ChipSelectPolicy) { default: case CsPolicy.CsActiveLow: case CsPolicy.CsDefaultHigh: CS = Bit.One; break; case CsPolicy.CsActiveHigh: case CsPolicy.CsDefaultLow: CS = Bit.Zero; break; } Debug.WriteLine("SPI initial successful : " + mpsse.ClockFrequency); }
public SpiDevice(MpsseDevice mpsse) : this(mpsse, new SpiParams()) { }