public void Send_Reset_Instruction() { var mcp25xxxSpiDevice = new Mcp25xxxSpiDevice(); Mcp25xxx mcp25xxx = new Mcp25625(mcp25xxxSpiDevice); mcp25xxx.Reset(); Assert.Equal(0b1100_0000, mcp25xxxSpiDevice.LastWriteByte); }
public void Send_Read_Instruction_By_Address(Address address) { byte[] expectedWriteBuffer = new byte[] { 0b0000_0011, (byte)address, 0b0000_0000 }; var mcp25xxxSpiDevice = new Mcp25xxxSpiDevice(); Mcp25xxx mcp25xxx = new Mcp25625(mcp25xxxSpiDevice); mcp25xxx.Read(address); Assert.Equal(expectedWriteBuffer, mcp25xxxSpiDevice.LastWriteBuffer); Assert.Equal(3, mcp25xxxSpiDevice.LastReadBuffer.Length); }
public void Send_ReadRxBuffer_Instruction(byte instructionFormat, RxBufferAddressPointer addressPointer, int byteCount) { byte[] expectedWriteBuffer = new byte[byteCount + 1]; expectedWriteBuffer[0] = instructionFormat; var mcp25xxxSpiDevice = new Mcp25xxxSpiDevice(); Mcp25xxx mcp25xxx = new Mcp25625(mcp25xxxSpiDevice); mcp25xxx.ReadRxBuffer(addressPointer, byteCount); Assert.Equal(expectedWriteBuffer, mcp25xxxSpiDevice.LastWriteBuffer); Assert.Equal(byteCount, mcp25xxxSpiDevice.LastReadBuffer.Length - 1); }