// Filter stuff public int GetFilterCount() { byte[] buf = new byte[1]; lock (Lock) { if (!I2CDevice.I2CWriteByte(BusID, 0x64)) { return(0); } if (!I2CDevice.I2CReadByte(BusID, buf)) { return(0); } } return((int)buf[0]); }
public bool OpenTuner() { if (DeviceTypeDisabled) { return(false); } if (!I2cDevice.I2CDeviceAck(BusID)) { return(false); } byte[] buffer = new byte[32]; if (!I2cDevice.I2CWriteByte(BusID, 211)) { return(false); } if (!I2cDevice.I2CReadBytes(BusID, buffer)) { return(false); } byte[] wordBuffer = new byte[4]; /* read PFD - 4 byte LSB first */ if (!I2cDevice.I2CWriteByte(BusID, 215)) { return(false); } if (!I2cDevice.I2CReadBytes(BusID, wordBuffer)) { return(false); } PFD = (wordBuffer[3] << 24) | (wordBuffer[2] << 16) | (wordBuffer[1] << 8) | wordBuffer[0]; /* read Modulus - 1 byte */ if (!I2cDevice.I2CWriteByte(BusID, 217)) { return(false); } if (!I2cDevice.I2CReadByte(BusID, wordBuffer)) { return(false); } Modulus = wordBuffer[0]; /* enable LNA */ if (!I2cDevice.I2CWriteByte(BusID, 229)) { return(false); } /* disable ATT */ if (!I2cDevice.I2CWriteBytes(BusID, new byte[] { 231, 0 })) { return(false); } if (PFD == 0) { PFD = 20000000; } if (Modulus == 0) { Modulus = 40; } long oldFreq = GetStartupFrequency(); Init(); SetFrequency(oldFreq); return(true); }