public void ReadFromRegister(Command command) { //Populating the commands bits SetCommand(command); //Dummy data is sent for clock pulse byte dataByte0 = 0x00; byte dataByte1 = 0x00; //Format: 0:Address, 1:Command, 2:Data Byte, 3:Data Byte byte[] data = { 0, 0, 0 }; data[0] = m_cmdReg.ToUInt8(); data[1] = dataByte0; data[2] = dataByte1; m_i2c.Read(m_slaveAddress, data); }
public float ReadChannel() { byte[] data = { 0, 0 }; m_i2c.Read(m_slaveAddress, data); byte channelAddress = (byte)((data[0] & 0xF0) >> 4); byte low = (byte)((data[0] & 0xF)); ushort channelData = (ushort)((data[1] & 0x0FF) << 4 | low); return(channelData * LSB_Volatage); }