Beispiel #1
0
 public void Write(Speed speed, UInt16 address, byte[] buffer, int offset = 0, UInt16 length = 0)
 {
     lock (Daq) {
         int byteCount = buffer.Length;
         if (length != 0 && length < buffer.Length)
         {
             byteCount = length;
         }
         if (byteCount > offset)
         {
             byteCount -= offset;
         }
         while (byteCount != 0)
         {
             UInt16 byteChunk = (UInt16)Math.Min(MaxByteChunk, byteCount);
             BasicTypeSerializer.Put(SendContext, (byte)NwazetDAQ.Command.I2c);
             BasicTypeSerializer.Put(SendContext, (byte)Command.Write);
             BasicTypeSerializer.Put(SendContext, (byte)speed);
             BasicTypeSerializer.Put(SendContext, (UInt16)address);
             BasicTypeSerializer.Put(SendContext, byteChunk);
             SendContext.Store(buffer, offset, byteChunk);
             Daq.Execute();
             Daq.Receive();
             CheckResult();
             offset    += byteChunk;
             byteCount -= byteChunk;
         }
     }
 }
Beispiel #2
0
 public void SetConfig(UsartConfig config)
 {
     lock (Daq) {
         BasicTypeSerializer.Put(SendContext, (byte)NwazetDAQ.Command.Usart);
         BasicTypeSerializer.Put(SendContext, (byte)Command.SetConfig);
         config.Put(SendContext);
         Daq.Execute();
         Daq.Receive();
         config.CheckResult(BasicTypeDeSerializer.Get(ReceiveContext));
     }
 }
Beispiel #3
0
 //
 // Volume functions
 //
 public void Mount()
 {
     lock (Daq) {
         BasicTypeSerializer.Put(SendContext, (byte)NwazetDAQ.Command.FileSystem);
         BasicTypeSerializer.Put(SendContext, (byte)Command.Mount);
         Daq.Execute();
         Daq.Receive();
         CheckResult();
     }
 }