private byte[] runCommand(byte command, int resultLength) { bus.SetDevice(this.address); bus.WriteData(new byte[] { command }); if (resultLength > 0) { byte[] result = new byte[resultLength]; bus.ReadData(result); return(result); } return(Array.Empty <byte>()); }
public BME280(I2CBus bus, int address = DEFAULTADDRESS) { this.bus = bus; this.address = address; bus.SetDevice(this.address); var chipId = new byte[1]; bus.WriteData(new byte[] { 0xD0 }); bus.ReadData(chipId); System.Console.WriteLine($"Chip id = {chipId[0]} Expected {CHIPID}"); this.getCalibrationData(); this.getHumidityCalibrationData(); }