public virtual void spiConfigureMaster(int spiNum, SpiMasterConfig config) { beginBatch(); writeByte((byte)IOIOProtocolCommands.SPI_CONFIGURE_MASTER); writeByte((spiNum << 5) | ScaleDivider.ScaleDiv[(int)config.rate]); // cast enum is horrible C# feature writeByte((config.sampleOnTrailing ? 0x00 : 0x02) | (config.invertClk ? 0x01 : 0x00)); endBatch(); }
/// <summary> /// Do we even need all these parameters? Isn't there only one SpiMaster on the board /// </summary> /// <param name="miso"></param> /// <param name="mosi"></param> /// <param name="clock"></param> /// <param name="slaveSelect"></param> /// <param name="rate"></param> internal SpiMasterConfigureCommand(DigitalInputSpec miso, DigitalOutputSpec mosi, DigitalOutputSpec clock, DigitalOutputSpec[] slaveSelect, SpiMasterConfig rate) { this.Miso = miso; this.Mosi = mosi; this.Clock = Clock; this.SlaveSelect = slaveSelect; this.Rate = rate; throw new NotImplementedException("Post(IOpenSpiMasterTo) not tied together in outgoing protocol"); }