Пример #1
0
 public override void Update()
 {
     _twiBus.Read(_i2cConfiguration, _buffer, 100);
     Throttle   = _settings.ThrottleScale.Calculate(BitConverter.ToShort(_buffer, 0));
     Axes.Pitch = _settings.AxesScale.Calculate(BitConverter.ToShort(_buffer, 2)) * _settings.RadioSensitivityFactor;
     Axes.Roll  = _settings.AxesScale.Calculate(BitConverter.ToShort(_buffer, 4)) * _settings.RadioSensitivityFactor;
     Axes.Yaw   = _settings.AxesScale.Calculate(BitConverter.ToShort(_buffer, 6)) * _settings.RadioSensitivityFactor;
     Gear       = BitConverter.ToShort(_buffer, 8) > 1500;
 }
Пример #2
0
 /// <summary>
 /// Reads a 16-bit signed integer from the stream, using the bit converter
 /// for this reader. 2 bytes are read.
 /// </summary>
 /// <returns>The 16-bit integer read</returns>
 public short ReadShort()
 {
     ReadInternal(buffer, 2);
     return(BitConverter.ToShort(buffer, 0));
 }