/// <summary> /// Constructor intializes read and write at 10mhz /// </summary> /// <param name="ChipSelectPin">CS pin</param> /// <param name="HoldPin">HOLD pin</param> public RamStream(Cpu.Pin ChipSelectPin, Cpu.Pin HoldPin) { hold_port = new OutputPort(HoldPin, true); hold_port.Write(true); SPI.Configuration config = new SPI.Configuration(ChipSelectPin, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1); spi_driver = new SPI(config); }
private void Init() { if (!m_initialized) { m_uart = new SPI(new SPI.Configuration(m_chipSelect, false, 10, 10, false, true, 2000, m_spiModule)); WriteRegister(WiflyRegister.LCR, 0x80); // 0x80 to program baudrate if (m_deviceType == DeviceType.crystal_12_288_MHz) { // value = (12.288*1024*1024) / (baudrate*16) WriteRegister(WiflyRegister.DLL, 42); // 4800=167, 9600=83, 19200=42, 38400=21 } else { // value = (14*1024*1024) / (baudrate*16) WriteRegister(WiflyRegister.DLL, 48); // 4800=191, 9600=96, 19200=48, 38400=24 } WriteRegister(WiflyRegister.DLM, 0); WriteRegister(WiflyRegister.LCR, 0xbf); // access EFR register WriteRegister(WiflyRegister.EFR, 0xd0); // enable enhanced registers and enable RTC/CTS on the SPI UART WriteRegister(WiflyRegister.LCR, 3); // 8 data bit, 1 stop bit, no parity WriteRegister(WiflyRegister.FCR, 0x06); // reset TXFIFO, reset RXFIFO, non FIFO mode WriteRegister(WiflyRegister.FCR, 0x01); // enable FIFO mode WriteRegister(WiflyRegister.SPR, 0x55); if (ReadRegister(WiflyRegister.SPR) != 0x55) { throw new Exception("Failed to init SPI<->UART chip"); } m_initialized = true; } }
public OLED_sh1106(Cpu.Pin csPin, OutputPort dcPin, OutputPort rsPin) { displayStr = ""; spiDevice = new SPI(new SPI.Configuration(csPin, false, 0, 0, false, true, 10000, SPI.SPI_module.SPI1)); dataCommandPin = dcPin; resetOutputPort = rsPin; }
private void Initialize(Int32 chipSelect) { adxlSpi = new SPI(chipSelect); adxlSpi.SetMode(Windows.Devices.Spi.SpiMode.Mode3); adxlSpi.SetSharingMode(Windows.Devices.Spi.SpiSharingMode.Shared); byte[] WriteBuf_DataFormat = new byte[] { Convert.ToByte(Register.DATA_FORMAT), 0x00 }; // 0x00 sets range to +- 2Gs byte[] WriteBuf_PowerControl = new byte[] { Convert.ToByte(Register.POWER_CTL), 0x08 }; // 0x08 puts the accelerometer into measurement mode /* Write the register settings */ try { adxlSpi.Write(WriteBuf_DataFormat); adxlSpi.Write(WriteBuf_PowerControl); } /* If the write fails display the error and stop running */ catch (Exception ex) { throw new Exception("Failed to communicate with device: " + ex.Message + "\n\r"); //if (uart != null) //{ // textOut = "Failed to communicate with device: " + ex.Message + "\n\r"; // await rootPage.uart.SendText(textOut); //} //returnValue = 4; } /* Now that everything is initialized, create a timer so we read data every 100mS */ periodicTimer = new Timer(this.TimerCallback, null, 0, 25); }
public EPDBase(Cpu.Pin chipSelectPin, Cpu.Pin dcPin, Cpu.Pin resetPin, Cpu.Pin busyPin, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = (uint)9500) { dataCommandPort = new OutputPort(dcPin, false); resetPort = new OutputPort(resetPin, true); busyPort = new InputPort(busyPin, true, Port.ResistorMode.Disabled); var spiConfig = new SPI.Configuration( SPI_mod: spiModule, ChipSelect_Port: chipSelectPin, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: false, Clock_Edge: true, Clock_RateKHz: speedKHz); spi = new SPI(spiConfig); imageBuffer = new byte[Width * Height / 8]; for (int i = 0; i < Width * Height / 8; i++) { imageBuffer[i] = 0xff; } Initialize(); }
/// <summary> /// Main program loop. /// </summary> public static void Main() { SPI.Configuration spiConfig = new SPI.Configuration( ChipSelect_Port: Pins.GPIO_PIN_D7, // Chip select is digital IO 7. ChipSelect_ActiveState: false, // Chip select is active low. ChipSelect_SetupTime: 0, // Amount of time between selection and the clock starting ChipSelect_HoldTime: 0, // Amount of time the device must be active after the data has been read. Clock_Edge: false, // Sample on the falling edge. Clock_IdleState: false, // Clock is idle when low. Clock_RateKHz: 10, // 10KHz clock speed. SPI_mod: SPI_Devices.SPI1 // Use SPI1 ); SPI spi = new SPI(spiConfig); int count = 0; while (true) { byte[] dataOut = new byte[] { 0 }; byte[] dataIn = new byte[REG_SIZE]; spi.WriteRead(dataOut, dataIn, 1); count++; string message = "Read " + count.ToString() + ":"; for (int index = 0; index < dataIn.Length; index++) { message += " " + Hexadecimal(dataIn[index]); } Debug.Print(message); Debug.Print(DecodeTime(dataIn)); Thread.Sleep(2000); } }
public PCD8544(Cpu.Pin chipSelectPin, Cpu.Pin dcPin, Cpu.Pin resetPin, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = 4000) { spiBuffer = new byte[Width * Height / 8]; dataCommandPort = new OutputPort(dcPin, true); resetPort = new OutputPort(resetPin, true); /* var spiConfig = new SPI.Configuration( * chipSelectPin, // chip select port * false, // IC is accessed when chip select is low * 0, // setup time 1 ms * 0, // hold chip select 1 ms after transfer * false, // clock line is low if device is not selected * true, // data is sampled at leading edge of clock * speedKHz, // clockrate is 4 kHz * spiModule // use first SPI bus * );*/ var spiConfig = new SPI.Configuration( SPI_mod: spiModule, ChipSelect_Port: chipSelectPin, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: false, Clock_Edge: true, Clock_RateKHz: speedKHz); spi = new SPI(spiConfig); Initialize(); }
public DisplayTFTSPIBase(Cpu.Pin chipSelectPin, Cpu.Pin dcPin, Cpu.Pin resetPin, uint width, uint height, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = 9500, bool idleClockState = false) { _width = width; _height = height; spiBuffer = new byte[_width * _height * sizeof(ushort)]; dataCommandPort = new OutputPort(dcPin, false); resetPort = new OutputPort(resetPin, true); var spiConfig = new SPI.Configuration( SPI_mod: spiModule, ChipSelect_Port: chipSelectPin, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: idleClockState, Clock_Edge: true, Clock_RateKHz: speedKHz); spi = new SPI(spiConfig); }
public static void Main() { //OutputPort reset = new OutputPort(Pins.GPIO_PIN_D9, true); OutputPort chipSelect = null; //chipSelect = new OutputPort(Pins.GPIO_PIN_D10, true); //SPI spiPort = new SPI(new SPI.Configuration(Pins.GPIO_NONE, false, 0, 0, true, true, 500, SPI.SPI_module.SPI1)); SPI spiPort = new SPI(new SPI.Configuration(Pins.GPIO_PIN_D10, false, 0, 0, false, true, 500, SPI.SPI_module.SPI1)); Thread.Sleep(100); while (true) { //byte[] writeBuffer = new byte[] { 0x42 }; // RegVersion exptecing 0x12 byte[] writeBuffer = new byte[] { 0x06 }; // RegFreqMsb expecting 0x6C //byte[] writeBuffer = new byte[] { 0x07 }; // RegFreqMid expecting 0x80 //byte[] writeBuffer = new byte[] { 0x08 }; // RegFreqLsb expecting 0x00 byte[] readBuffer = new byte[1]; if (chipSelect != null) { chipSelect.Write(false); } spiPort.WriteRead(writeBuffer, readBuffer, 1); if (chipSelect != null) { chipSelect.Write(true); } Debug.Print("Value = 0x" + BytesToHexString(readBuffer)); Thread.Sleep(1000); } }
/// <summary> /// Create a new SPIBus operating in the specified mode. /// </summary> /// <remarks> /// Mode CPOL CPHA /// 0 0 0 /// 1 0 1 /// 2 1 0 /// 3 1 1 /// </remarks> /// <param name="module">SPI module to configure.</param> /// <param name="chipSelect">Chip select pin.</param> /// <param name="mode">SPI Bus Mode - should be in the range 0 - 3.</param> /// <param name="speed">Speed of the SPI bus.</param> public SPIBus(SPI.SPI_module module, Cpu.Pin chipSelect, byte mode, ushort speed) { if (mode > 3) { throw new ArgumentException("SPI Mode should be in the range 0 - 3."); } byte cpha = 0; byte cpol = 0; switch (mode) { case 1: cpha = 1; break; case 2: cpol = 1; break; case 3: cpol = 1; cpha = 1; break; } Configure(module, chipSelect, cpha, cpol, speed); _spi = new SPI(_configuration); }
public OLED_sh1106(ref SPI globalSPIDevice, OutputPort dcPin, OutputPort rsPin) { displayStr = ""; spiDevice = globalSPIDevice; dataCommandPin = dcPin; resetOutputPort = rsPin; }
/// <summary> /// Method for initializing the decoder. Must be called before ANY other method. /// </summary> public static void Initialize() { cancelPlayback = false; SPI.SPI_module spi_module; spi_module = SPI.SPI_module.SPI1; dataConfig = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di2, false, 0, 0, false, true, 2000, spi_module); cmdConfig = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di9, false, 0, 0, false, true, 2000, spi_module); DREQ = new InputPort((Cpu.Pin)FEZ_Pin.Digital.Di3, false, Port.ResistorMode.PullUp); spi = new SPI(dataConfig); Reset(); SCIWrite(SCI_MODE, SM_SDINEW); SCIWrite(SCI_CLOCKF, 0x98 << 8); SCIWrite(SCI_VOL, 0x2828); //ClearPlayback(); if (SCIRead(SCI_VOL) != (0x2828)) { throw new Exception("VS1053: Failed to initialize MP3 Decoder."); } else { Debug.Print("VS1053: Initialized MP3 Decoder."); } }
public static void SystemParametersInfo(SPI uiAction, int uiParam, string pvParam, SPIF fWinIni) { if (!NativeMethods._SystemParametersInfo_String(uiAction, uiParam, pvParam, fWinIni)) { HRESULT.ThrowLastError(); } }
public bool InitCAN(enBaudRate baudrate, UInt16 filter, UInt16 mask) { // Configure SPI var configSPI = new SPI.Configuration(Pins.GPIO_NONE, LOW, 0, 0, HIGH, HIGH, 10000, SPI.SPI_module.SPI1); //a0 D10 spi = new SPI(configSPI); // Write reset to the CAN transceiver. // spi.Write(new byte[] { RESET }); //Read mode and make sure it is config Thread.Sleep(100); // BECKER WHAT IS HAPPENING HERE. // byte mode = (byte)(ReadRegister(CANSTAT)); // >> 5); // if (mode != 0x04) // { // return false; // } // else // Must set the filters and masks while the 2515 is in reset state. //SetMask(mask, filter); //SetCANBaud(baudrate); return(true); }
/// <summary> /// Constructor /// </summary> /// <param name="csPin">CS pin for SPI interface</param> /// <param name="spiModule">SPI module</param> public LIS302DL(Cpu.Pin csPin, SPI.SPI_module spiModule) { //The 302DL is a mode 3 device SPI.Configuration spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, 10000, spiModule); _spi = new SPI(spiConfig); Init(); }
/// <summary> /// Creates a new NeoPixelSPI with a given chip-select pin, using a given SPI module /// </summary> /// <param name="chipSelectPin">chip-select pin</param> /// <param name="spiModule">SPI module</param> public NeoPixelSPI(Cpu.Pin chipSelectPin, SPI.SPI_module spiModule) { uint speed = 6666; // 6.666 MHz SPI.Configuration spiConfig = new SPI.Configuration(chipSelectPin, false, 0, 0, false, true, speed, spiModule); this.spi = new SPI(spiConfig); }
public static extern int SystemParametersInfo ( SPI Action, uint Param, ref int result, int updateIni );
/// <summary>Initialize the CAN transceiver.</summary> /// <param name="baudrate">The selected baud rate.</param> /// <returns>True if configuration was successful.</returns> /// <remarks>Transceiver needs to be set to normal mode before starting TX/RX operations.</remarks> public bool InitCAN(SPI.SPI_module spiModule, Cpu.Pin chipSelect, byte[] baudrate) { if (baudrate.Length != 3) { throw new Exception("Baudrate settings should be 3-byte array of CNF1,2,3 registers."); } // Configure SPI var configSPI = new SPI.Configuration(chipSelect, LOW, 0, 0, HIGH, HIGH, 10000, spiModule); spi = new SPI(configSPI); // Write reset to the CAN transceiver. spi.Write(new byte[] { RESET }); //Read mode and make sure it is config Thread.Sleep(100); byte mode = (byte)(ReadRegister(CANSTAT) >> 5); if (mode != 0x04) { return(false); } else { SetCANBaud(baudrate); return(true); } }
public AdaFruitLPD8806(int width, int height, Cpu.Pin chipSelect, SPI.SPI_module spiModule = SPI.SPI_module.SPI1, uint speedKHz = 10000) { Width = width; Height = height; PixelCount = Width * Height; PixelBufferEnd = (PixelCount - 1) * BytesPerPixel; FrameSize = Width * Height * BytesPerPixel; var spiConfig = new SPI.Configuration( SPI_mod: spiModule, ChipSelect_Port: chipSelect, ChipSelect_ActiveState: false, ChipSelect_SetupTime: 0, ChipSelect_HoldTime: 0, Clock_IdleState: false, Clock_Edge: true, Clock_RateKHz: speedKHz ); spi = new SPI(spiConfig); pixelBuffer = new byte[PixelCount * BytesPerPixel]; SetBackgroundColor(0, 0, 0); }
public unsafe static int SystemParametersInfoInt(SPI uiAction) { int value = 0; SystemParametersInfoW(uiAction, ref value); return(value); }
protected void Dispose(bool disposing) { if (null != _fifoPort) { _fifoPort.Dispose(); _fifoPort = null; } if (null != _fifopInterrupt) { _fifopInterrupt.Dispose(); _fifopInterrupt = null; } if (null != _sfdInterrupt) { _sfdInterrupt.Dispose(); _sfdInterrupt = null; } if (null != _resetPort) { _resetPort.Dispose(); _resetPort = null; } if (null != _ccaPort) { _ccaPort.Dispose(); _ccaPort = null; } if (null != _powerPort) { _powerPort.Dispose(); _powerPort = null; } if (null != _spi) { lock (_spi) { _spi.Dispose(); _spi = null; } } }
public static void Main() { SerialPort UART = new SerialPort("COM1", 9600); SPI.Configuration config = new SPI.Configuration((Cpu.Pin)FEZ_Pin.Digital.Di10, false, 0, 0, true, true, 250, SPI.SPI_module.SPI1); SPI Spi = new SPI(config); UART.Open(); string Datoreaded = ""; byte[] datain = new byte[1]; byte[] dataout = new byte[1]; while (true) { // Sleep for 500 milliseconds Thread.Sleep(500); dataout[0] = (byte)0x55; datain[0] = (byte)0; Spi.WriteRead(dataout, datain); Datoreaded = datain[0].ToString(); Datoreaded += "\n\r"; byte[] buffer = Encoding.UTF8.GetBytes(Datoreaded); UART.Write(buffer, 0, buffer.Length); } }
public unsafe static bool SystemParametersInfoW <T>(SPI uiAction, ref T value) where T : unmanaged { fixed(void *p = &value) { return(SystemParametersInfoW(uiAction, 0, p, 0)); } }
public ADC124S101(Cpu.Pin chipSelectPin, float supplyVoltage, uint clockRateKHz, SPI.SPI_module spiModule) { if (chipSelectPin == Cpu.Pin.GPIO_NONE) { throw new ArgumentOutOfRangeException("chipSelectPin"); } if (supplyVoltage <= 0.0f) { throw new ArgumentOutOfRangeException("supplyVoltage"); } this.chipSelectPin = chipSelectPin; this.supplyVoltage = supplyVoltage; SPI.Configuration config = new SPI.Configuration( chipSelectPin, //chip select port false, //IC is accessed when chip select is low 1, //setup time 1 ms, is actually min 10 ns 1, //hold chip select 1 ms after transfer true, //clock line is high if device is not selected false, //data is sampled at falling edge of clock clockRateKHz, //possible 10000 - 20000 KHz spiModule //select SPI bus ); this.spi = new SPI(config); }
public Nokia_5110(bool useBacklight, Cpu.Pin latch, Cpu.Pin backlight, Cpu.Pin reset, Cpu.Pin dataCommand) { if (useBacklight) { this.backlight = new PWM(backlight); } SPI.Configuration spiConfiguration = new SPI.Configuration( latch, // chip select port false, // IC is accessed when chip select is low 0, // setup time 1 ms 0, // hold chip select 1 ms after transfer false, // clock line is low if device is not selected true, // data is sampled at leading edge of clock 4000, // clockrate is 15 MHz SPI.SPI_module.SPI1 // use first SPI bus ); spi = new SPI(spiConfiguration); this.reset = new OutputPort(reset, true); this.dataMode = new OutputPort(dataCommand, true); Initialize(); }
public void Dispose() { spi.Dispose(); spi = null; dataCommandPort = null; resetPort = null; }
/// <summary> /// Constructor /// </summary> /// <param name="csPin">CS pin for SPI interface</param> /// <param name="spiModule">SPI module</param> /// <param name="clockRateKhz">SPI clock rate (defaults to 1MHZ in other constructors)</param> public LIS302DL(Cpu.Pin csPin, SPI.SPI_module spiModule, uint clockRateKhz) { var spiConfig = new SPI.Configuration(csPin, false, 0, 0, true, true, clockRateKhz, spiModule); _spi = new SPI(spiConfig); Init(); }
private byte[] _tmpPixel = new byte[12]; // Temporary buffer #endregion #region Constructor and Destructor /// <summary> /// WS2811Led constructor. /// </summary> /// <param name="striplength">Number of leds in the strip. Warning : will alocate a memory buffer 12 times this number.</param> /// <param name="SPImodule">The SPI module the strip is connected to. Only the MOSI line is used. SPI1 is used if parameter omited.</param> /// <param name="speed">The Hardwired speed of the strip. 800Khz is used if parameter is omited.</param> /// <param name="linearizationfactor">If set to a value >0 (default value=2.25) will build the lookup table using human linear perceived luminosity instead of direct PWM values.</param> public WS2811Led(int striplength, SPI.SPI_module SPImodule = SPI.SPI_module.SPI1, WS2811Speed speed = WS2811Speed.S800KHZ, double linearizationfactor = 2.25) { _StripLength = striplength; _StripLightNb = striplength * 3; //For later speed optimizations _StripBufferLen = striplength * 12; //For later speed optimizations // Initialize SPI // Set clock edge to false to remove the failing initial LED _WS2811SPIConfig = new SPI.Configuration(Cpu.Pin.GPIO_NONE, false, 0, 0, false, false, (uint)speed, SPImodule); try { _WS2811SPI = new SPI(_WS2811SPIConfig); } catch (Exception ex) { Debug.Print(ex.Message); throw; } // SPI Transmit buffer = 4 output byte per color, 3 colors per light _WS2811Buffer = new byte[4 * 3 * striplength]; // Compute fast byte to SPI lookup table. By default the linearisation of human perceived luminosity is on (Weber–Fechner law) _WS2811Table = new byte[1024]; BuildTable(linearizationfactor); //Clear all leds Clear(); Transmit(); }
private void WRITE_cmd(Byte[] cmd) { //SPI.Send(cmd); SPI.Write(cmd, 0x00, cmd.Length); lastCmd = cmd; LOG_cmdSent(cmd); }
public unsafe static bool SystemParametersInfoBool(SPI uiAction) { bool value = false; SystemParametersInfoW(uiAction, ref value); return(value); }
public NavXMXP_SPI(SPI.Port port, byte updateRate = 50) { m_spi = new SPI(port); Thread.Sleep(250); //Read(DeviceRegister.WHOAMI, 2); //Read(DeviceRegister.WHOAMI, 2); Thread.Sleep(250); }
public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, ref ANIMATIONINFO pvParam, SPIF fWinIni);
public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, String pvParam, SPIF fWinIni);
public static void SystemParametersInfo(SPI uiAction, int uiParam, string pvParam, SPIF fWinIni) { if (!_SystemParametersInfo_String(uiAction, uiParam, pvParam, fWinIni)) { HRESULT.ThrowLastError(); } }
/// <summary> /// c'tor /// </summary> /// <param name="socket">the Gadgeteer socket that the strip is on</param> /// <param name="numLeds">the number of LEDs in the strip</param> public LedStripLPD8806(GT.Socket socket, int numLeds) { var spiConfig = new SPI.Configuration(Cpu.Pin.GPIO_NONE, false, // chip select active state 0, // chip select setup time 0, // chip select hold time false, // clock idle state true, // clock edge (true = rising) 2000, // 2mhz SPI.SPI_module.SPI1 ); // the protocol seems to be that we need to write 1 + (1 per 64 LEDs) bytes // at the end of each update (I've only tested this on a 32-LED strip) int latchBytes = ((numLeds + 63) / 64) * 3; mLedByteCount = numLeds * 3; mData = new byte[mLedByteCount + latchBytes]; mNumLeds = numLeds; // mLedStrip = new SPI(socket, spiConfig, SPI.Sharing.Exclusive, null); mLedStrip = new SPI(spiConfig); // start with all the LEDs off for (int i = 0; i < mLedByteCount; i++) { mData[i] = MASK; } // give the strip an inital poke of the latch bytes (no idea // why this is needed) mLedStrip.Write(new byte[latchBytes]); // push the initial values (all off) to the strip SendUpdate(); }
private static extern bool _SystemParametersInfo_NONCLIENTMETRICS(SPI uiAction, int uiParam, [In, Out] ref NONCLIENTMETRICS pvParam, SPIF fWinIni);
public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, ref RECT pvParam, uint fWinIni);
public RegisterIO_SPI(SPI spi_port, int bitrate) { port = spi_port; this.bitrate = bitrate; }
public byte Wiper_Reg; //Wiper Register public MCP4131(Cpu.Pin cs_pin, SPI.SPI_module mod) { MCP4131_Config = new SPI.Configuration(cs_pin, false, 0, 0, false, true, 800, mod); MCP4131_SPI = new SPI(MCP4131_Config); }
public static extern int SystemParametersInfo( SPI Action, uint Param, ref int result, int updateIni );
public RegisterIO_SPI(SPI spi_port) { port = spi_port; bitrate = DEFAULT_SPI_BITRATE_HZ; }
public TestADXRS450(SPI.Port port) { m_gyro = new ADXRS450_Gyro(port); m_port = (int)port; started = true; }
public TestADXL362(SPI.Port port) { m_accel = new ADXL362(port, AccelerometerRange.k2G); m_port = (int) port; started = true; }
/// <summary> /// �R���X�g���N�^ /// </summary> /// <param name="pin">SS�s��</param> /// <param name="module">SPI���W���[��</param> public SpiController(Cpu.Pin pin, SPI.SPI_module module) { SPI.Configuration config = new SPI.Configuration(pin, false, 1, 1, false, true, 200, module); spi = new SPI(config); }
private static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, IntPtr pvParam, SPIF fWinIni);
private static extern bool _SystemParametersInfo_HIGHCONTRAST(SPI uiAction, int uiParam, [In, Out] ref HIGHCONTRAST pvParam, SPIF fWinIni);
public static extern bool SystemParametersInfo(SPI uiAction, uint uiParam, ref MINIMIZEDMETRICS pvParam, uint fWinIni);
private static extern bool _SystemParametersInfo_String(SPI uiAction, int uiParam, [MarshalAs(UnmanagedType.LPWStr)] string pvParam, SPIF fWinIni);
/// <summary> /// Constructs the AHRS class using SPI Communication, overriding the SPI bitrate. /// </summary> /// <remarks> /// The update rate may be between 4 Hz and 60 Hz, representing the number /// of updates per second sent by the sensor. /// <para/> /// This constructor should be used if communicating via SPI. /// <para/> /// Note that increasing the update rate may increase the CPU utilization. /// </remarks> /// <param name="spiPortId">The <see cref="SPI.Port">SPI Port</see> to use.</param> /// <param name="spiBitrate">The SPI bitrate to use (bits/seconds) (Maximum: 2,000,000)</param> /// <param name="updateRateHz">The Update Rate (Hz) [4..60] (Default 50)</param> public AHRS(SPI.Port spiPortId, int spiBitrate, byte updateRateHz = NavxDefaultUpdateRateHz) { CommonInit(updateRateHz); if (RobotBase.IsSimulation) { m_io = new SimulatorIO(updateRateHz, m_ioCompleteSink, m_boardCapabilities); } else { m_io = new RegisterIO(new RegisterIO_SPI(new SPI(spiPortId), spiBitrate), updateRateHz, m_ioCompleteSink, m_boardCapabilities); } m_ioThread.Start(); }