Пример #1
0
 // Read a series of bytes from the accelerometer
 private byte[] readBytesACC(byte regAddr, int length)
 {
     byte[] values = new byte[length];
     byte[] buffer = new byte[1];
     buffer[0] = (byte)(0x80 | regAddr);
     I2CACC.WriteRead(buffer, values);
     return(values);
 }
Пример #2
0
 // Read a series of bytes from the magnetometer
 private byte[] readBytesMAG(byte regAddr, int length)
 {
     byte[] values = new byte[length];
     byte[] buffer = new byte[1];
     buffer[0] = (byte)(0x80 | regAddr);
     I2CACC.WriteRead(buffer, values);    // The magnetometer uses the same I2C slave address as the accelerometer
     return(values);
 }
Пример #3
0
 // Write a byte to the magnetometer
 private void writeByteMAG(byte regAddr, byte value)
 {
     byte[] values   = new byte[value];
     byte[] WriteBuf = new byte[] { regAddr, value };
     I2CACC.Write(WriteBuf);      // The magnetometer uses the same I2C slave address as the accelerometer
 }
Пример #4
0
 // Write a byte to the accelerometer
 private void writeByteACC(byte regAddr, byte value)
 {
     byte[] values   = new byte[value];
     byte[] WriteBuf = new byte[] { regAddr, value };
     I2CACC.Write(WriteBuf);
 }
Пример #5
0
 private void MainPage_Unloaded(object sender, object args)
 {
     // Cleanup
     I2CGYR.Dispose();
     I2CACC.Dispose();
 }