public RaspSPI(SPIMode DataMode, SPIBitOrder BitOrder, SPIClockDivider ClockDivider, ChipSelect ChipSelect, bool ChipSelectPolarity) { RaspExtern.SPI.bcm2835_spi_begin(); this.DataMode = DataMode; this.BitOrder = BitOrder; this.ClockDivider = ClockDivider; this.ChipSelect = ChipSelect; this.ChipSelectPolarity = ChipSelectPolarity; }
public MAX7219(int numberOfPanels = 1, Rotate rotate = Rotate.None, Transform transform = Transform.None, ChipSelect chipSelect = ChipSelect.CE0, string SPIControllerName = "SPI0") { this.PanelsPerFrame = numberOfPanels < 0 ? 0 : numberOfPanels; this.rotate = rotate; this.transform = transform; this.chipSelect = chipSelect; this.SPIControllerName = SPIControllerName; SendDataBytes = new byte[2 * PanelsPerFrame]; Task.Run(() => InitSpi()).Wait(); InitDisplay(); }
public void EnableSPI(SPIMode DataMode = SPIMode.MODE1, SPIBitOrder BitOrder = SPIBitOrder.Order_MSBFIRST, SPIClockDivider ClockDivider = SPIClockDivider.Divider_256, ChipSelect ChipSelect = ChipSelect.CS0, bool ChipSelectPolarity = false) { if (spi != null) { spi.Dispose(); } spi = new RaspSPI(DataMode, BitOrder, ClockDivider, ChipSelect, ChipSelectPolarity); }
public MAX7219(int numberOfPanels = 1, Rotate rotate = Rotate.None, Transform transform = Transform.None, ChipSelect chipSelect = ChipSelect.CE0, BusId busId = BusId.BusId0) { this.PanelsPerFrame = numberOfPanels < 0 ? 0 : numberOfPanels; this.rotate = rotate; this.transform = transform; this.chipSelect = chipSelect; this.busId = busId; SendDataBytes = new byte[2 * PanelsPerFrame]; InitializeSpi(); InitializeDisplay(); }
private async Task InitSPI(ChipSelect cs) { try { var settings = new SpiConnectionSettings((int)cs); settings.ClockFrequency = 500000;// 10000000; settings.Mode = SpiMode.Mode0; //Mode3; string spiAqs = SpiDevice.GetDeviceSelector(SPI_CONTROLLER_NAME); var deviceInfo = await DeviceInformation.FindAllAsync(spiAqs); SpiMCP3200 = await SpiDevice.FromIdAsync(deviceInfo[0].Id, settings); } /* If initialization fails, display the exception and stop running */ catch (Exception ex) { throw new Exception("SPI Initialization Failed", ex); } }
private async Task InitSPI(ChipSelect cs) { try { var settings = new SpiConnectionSettings((int)cs); settings.ClockFrequency = 500000; // 10000000; settings.Mode = SpiMode.Mode0; //Mode3; string spiAqs = SpiDevice.GetDeviceSelector(SPI_CONTROLLER_NAME); var deviceInfo = await DeviceInformation.FindAllAsync(spiAqs); SpiMCP3200 = await SpiDevice.FromIdAsync(deviceInfo[0].Id, settings); } /* If initialization fails, display the exception and stop running */ catch (Exception ex) { throw new Exception("SPI Initialization Failed", ex); } }
public MCP3002(ChipSelect cs) { Task.Run(() => InitSPI(cs)).Wait(); }
public static void BeginSpi(ChipSelect cs, ushort clkDivider) { bcm2835_spi_begin (); bcm2835_spi_chipSelect ((byte)cs); bcm2835_spi_setClockDivider (clkDivider); }
public static extern void bcm2835_spi_setChipSelectPolarity(ChipSelect cs, byte active);
public static extern void bcm2835_spi_chipSelect(ChipSelect cs);