private bool init(bool rfe, bool pa) { hasRFE = rfe; hasPA = pa; JanusAudio.initOzy(); IntPtr OzyHandle = JanusAudio.OzyOpen(); if (OzyHandle != (IntPtr)0) { usbDevHandle = JanusAudio.OzyHandleToRealHandle(OzyHandle); } else { usbDevHandle = IntPtr.Zero; } if (usbDevHandle.Equals(IntPtr.Zero)) { System.Console.WriteLine("Ozy init fails"); return(false); } /* else */ // System.Console.WriteLine("Ozy init succeeds"); return(true); }
public void ExtCtrlEnable(bool enable, Band band, bool tx) { if (!enable) { JanusAudio.SetPennyOCBits(0); } else { UpdateExtCtrl(band, tx); } }
private int sr_load(byte reg, byte data) { int rc = JanusAudio.WriteControlMsg(usbDevHandle, VRT_VENDOR_OUT, VRQ_SDR1K_CTL, SDR1KCTRL_SR_LOAD, (reg << 8) | data, null, 0, 1000); // Thread.Sleep(10); // System.Console.WriteLine("sr_load: reg:" + reg + " data: " + data + " rc: " + rc); return(rc); }
private int dds_write(byte addr, byte data) { int rc = JanusAudio.WriteControlMsg(usbDevHandle, VRT_VENDOR_OUT, VRQ_SDR1K_CTL, SDR1KCTRL_DDS_WRITE, (addr << 8) | data, null, 0, 1000); // Thread.Sleep(10); // System.Console.WriteLine("dds_write: addr:" + addr + " data: " + data + " rc: " + rc); return(rc); }
private int dds_reset() { int rc = JanusAudio.WriteControlMsg(usbDevHandle, VRT_VENDOR_OUT, VRQ_SDR1K_CTL, SDR1KCTRL_DDS_RESET, 0, null, 0, 1000); // Thread.Sleep(10); // System.Console.WriteLine("dds_reset: rc: " + rc); return(rc); }
private int latch(byte latchid, byte data) { int rc = 0; JanusAudio.WriteControlMsg(usbDevHandle, VRT_VENDOR_OUT, VRQ_SDR1K_CTL, SDR1KCTRL_LATCH, (latchid << 8) | data, null, 0, 1000); // Thread.Sleep(10); // System.Console.WriteLine("latch: latchid: " + latchid + " data: " + data + " rc: " + rc); return(rc); }
public void UpdateExtCtrl(Band band, Band bandb, bool tx) { if (!tx && (int)band < 12) // if !tx ignore given band and round off to nearest band based on freq { band = Alex.AntBandFromFreq(); } if (!tx && (int)bandb < 12) { bandb = Alex.AntBandFromFreqB(); } int idx = (int)band - (int)Band.B160M; int idxb = (int)bandb - (int)Band.B160M; int bits; if (idx < 0 || idx > 26) { bits = 0; } else { if (SplitPins) { bits = tx ? (TXABitMasks[idx] & 0xf) | TXBBitMasks[idxb] : (RXABitMasks[idx] & 0xf) | RXBBitMasks[idxb]; } else { if (tx && VFOTBX) { bits = TXABitMasks[idxb]; } else if (tx) { bits = TXABitMasks[idx]; } else { bits = RXABitMasks[idx]; } } } System.Console.WriteLine("Bits: " + bits + " Band: " + (int)band + " Band: " + (int)bandb); JanusAudio.SetPennyOCBits(bits); }
private int get_status_port() { byte[] buf = new byte[1]; int rc = JanusAudio.WriteControlMsg(usbDevHandle, VRT_VENDOR_IN, VRQ_SDR1K_CTL, SDR1KCTRL_READ_STATUS, 0, buf, buf.Length, 1000); if (rc == buf.Length) { rc = (int)((uint)(buf[0])); rc = swizzleStatusBits(rc); #if false ++read_ok_count; #endif } else { rc = -1; #if false ++read_notok_count; #endif } // Thread.Sleep(10); #if false if (dbgGate == 100) { System.Console.WriteLine("get_status: data: 0x" + rc.ToString("X") + " read_ok: " + read_ok_count + " read_not_ok: " + read_notok_count); } ++dbgGate; if (dbgGate >= 101) { dbgGate = 0; read_ok_count = 0; read_notok_count = 0; } #endif return(rc); }
public void UpdateExtCtrl(Band band, bool tx) { if (!tx && (int)band < 12) // if !tx ignore given band and round off to nearest band based on freq { band = Alex.AntBandFromFreq(); } int idx = (int)band - (int)Band.B160M; int bits; if (idx < 0 || idx > 26) { bits = 0; } else { bits = tx ? TXBitMasks[idx] : RXBitMasks[idx]; } System.Console.WriteLine("Bits: " + bits + " Band: " + (int)band); JanusAudio.SetPennyOCBits(bits); }
public void UpdateExtCtrl(Band band, bool tx) { int idx = (int)band - (int)Band.B160M; int bits; if (idx < 0 || idx > 11) { bits = 0; } else { if (tx) { bits = TXBitMasks[idx]; } else { bits = RXBitMasks[idx]; } } System.Console.WriteLine("Bits: " + bits + " Band: " + (int)band); JanusAudio.SetPennyOCBits(bits); }