예제 #1
0
 /// <summary> Reads 8-bit data from the device at the given address. </summary>
 /// <param name="Address"> The address of the device to read from. </param>
 /// <param name="DataLength"> How many bytes to read. </param>
 public byte[] Read(byte Address, int DataLength)
 {
     CheckDev(Address);
     byte[] Buffer = new byte[DataLength];
     lock (this.BusLock)
     {
         for (int i = 0; i < DataLength; i++)
         {
             Buffer[i] = RaspberryPi.I2CRead(this.DeviceIDs[Address]);
         }
     }
     return(Buffer);
 }
예제 #2
0
 public byte[] Read(byte Address, int DataLength)
 {
     if (this.DeviceIDs[Address] < 1)
     {
         this.DeviceIDs[Address] = RaspberryPi.I2CSetup(Address);
     }
     byte[] Buffer = new byte[DataLength];
     for (int i = 0; i < DataLength; i++)
     {
         Buffer[i] = RaspberryPi.I2CRead(this.DeviceIDs[Address]);
     }
     return(Buffer);
 }