@jtarrio/webrtlsdr 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +203 -0
- package/README.md +69 -0
- package/dist/audio/player.d.ts +24 -0
- package/dist/audio/player.d.ts.map +1 -0
- package/dist/audio/player.js +68 -0
- package/dist/audio/player.js.map +1 -0
- package/dist/demod/demodulator.d.ts +59 -0
- package/dist/demod/demodulator.d.ts.map +1 -0
- package/dist/demod/demodulator.js +150 -0
- package/dist/demod/demodulator.js.map +1 -0
- package/dist/demod/sample-counter.d.ts +18 -0
- package/dist/demod/sample-counter.d.ts.map +1 -0
- package/dist/demod/sample-counter.js +43 -0
- package/dist/demod/sample-counter.js.map +1 -0
- package/dist/demod/scheme-am.d.ts +32 -0
- package/dist/demod/scheme-am.d.ts.map +1 -0
- package/dist/demod/scheme-am.js +75 -0
- package/dist/demod/scheme-am.js.map +1 -0
- package/dist/demod/scheme-cw.d.ts +22 -0
- package/dist/demod/scheme-cw.d.ts.map +1 -0
- package/dist/demod/scheme-cw.js +68 -0
- package/dist/demod/scheme-cw.js.map +1 -0
- package/dist/demod/scheme-nbfm.d.ts +32 -0
- package/dist/demod/scheme-nbfm.d.ts.map +1 -0
- package/dist/demod/scheme-nbfm.js +76 -0
- package/dist/demod/scheme-nbfm.js.map +1 -0
- package/dist/demod/scheme-ssb.d.ts +33 -0
- package/dist/demod/scheme-ssb.d.ts.map +1 -0
- package/dist/demod/scheme-ssb.js +75 -0
- package/dist/demod/scheme-ssb.js.map +1 -0
- package/dist/demod/scheme-wbfm.d.ts +38 -0
- package/dist/demod/scheme-wbfm.d.ts.map +1 -0
- package/dist/demod/scheme-wbfm.js +106 -0
- package/dist/demod/scheme-wbfm.js.map +1 -0
- package/dist/demod/scheme.d.ts +78 -0
- package/dist/demod/scheme.d.ts.map +1 -0
- package/dist/demod/scheme.js +96 -0
- package/dist/demod/scheme.js.map +1 -0
- package/dist/demod/spectrum.d.ts +18 -0
- package/dist/demod/spectrum.d.ts.map +1 -0
- package/dist/demod/spectrum.js +76 -0
- package/dist/demod/spectrum.js.map +1 -0
- package/dist/dsp/buffers.d.ts +72 -0
- package/dist/dsp/buffers.d.ts.map +1 -0
- package/dist/dsp/buffers.js +109 -0
- package/dist/dsp/buffers.js.map +1 -0
- package/dist/dsp/coefficients.d.ts +22 -0
- package/dist/dsp/coefficients.d.ts.map +1 -0
- package/dist/dsp/coefficients.js +77 -0
- package/dist/dsp/coefficients.js.map +1 -0
- package/dist/dsp/converters.d.ts +15 -0
- package/dist/dsp/converters.d.ts.map +1 -0
- package/dist/dsp/converters.js +43 -0
- package/dist/dsp/converters.js.map +1 -0
- package/dist/dsp/demodulators.d.ts +72 -0
- package/dist/dsp/demodulators.d.ts.map +1 -0
- package/dist/dsp/demodulators.js +245 -0
- package/dist/dsp/demodulators.js.map +1 -0
- package/dist/dsp/fft.d.ts +53 -0
- package/dist/dsp/fft.d.ts.map +1 -0
- package/dist/dsp/fft.js +175 -0
- package/dist/dsp/fft.js.map +1 -0
- package/dist/dsp/filters.d.ts +91 -0
- package/dist/dsp/filters.d.ts.map +1 -0
- package/dist/dsp/filters.js +250 -0
- package/dist/dsp/filters.js.map +1 -0
- package/dist/dsp/power.d.ts +2 -0
- package/dist/dsp/power.d.ts.map +1 -0
- package/dist/dsp/power.js +10 -0
- package/dist/dsp/power.js.map +1 -0
- package/dist/dsp/resamplers.d.ts +33 -0
- package/dist/dsp/resamplers.d.ts.map +1 -0
- package/dist/dsp/resamplers.js +91 -0
- package/dist/dsp/resamplers.js.map +1 -0
- package/dist/errors.d.ts +19 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -0
- package/dist/radio/msgqueue.d.ts +23 -0
- package/dist/radio/msgqueue.d.ts.map +1 -0
- package/dist/radio/msgqueue.js +52 -0
- package/dist/radio/msgqueue.js.map +1 -0
- package/dist/radio/radio.d.ts +81 -0
- package/dist/radio/radio.d.ts.map +1 -0
- package/dist/radio/radio.js +305 -0
- package/dist/radio/radio.js.map +1 -0
- package/dist/radio/sample_receiver.d.ts +11 -0
- package/dist/radio/sample_receiver.d.ts.map +1 -0
- package/dist/radio/sample_receiver.js +49 -0
- package/dist/radio/sample_receiver.js.map +1 -0
- package/dist/rtlsdr/r820t.d.ts +18 -0
- package/dist/rtlsdr/r820t.d.ts.map +1 -0
- package/dist/rtlsdr/r820t.js +39 -0
- package/dist/rtlsdr/r820t.js.map +1 -0
- package/dist/rtlsdr/r828d.d.ts +28 -0
- package/dist/rtlsdr/r828d.d.ts.map +1 -0
- package/dist/rtlsdr/r828d.js +120 -0
- package/dist/rtlsdr/r828d.js.map +1 -0
- package/dist/rtlsdr/r8xx.d.ts +90 -0
- package/dist/rtlsdr/r8xx.d.ts.map +1 -0
- package/dist/rtlsdr/r8xx.js +468 -0
- package/dist/rtlsdr/r8xx.js.map +1 -0
- package/dist/rtlsdr/rtl2832u.d.ts +74 -0
- package/dist/rtlsdr/rtl2832u.d.ts.map +1 -0
- package/dist/rtlsdr/rtl2832u.js +342 -0
- package/dist/rtlsdr/rtl2832u.js.map +1 -0
- package/dist/rtlsdr/rtlcom.d.ts +144 -0
- package/dist/rtlsdr/rtlcom.d.ts.map +1 -0
- package/dist/rtlsdr/rtlcom.js +299 -0
- package/dist/rtlsdr/rtlcom.js.map +1 -0
- package/dist/rtlsdr/rtldevice.d.ts +53 -0
- package/dist/rtlsdr/rtldevice.d.ts.map +1 -0
- package/dist/rtlsdr/rtldevice.js +24 -0
- package/dist/rtlsdr/rtldevice.js.map +1 -0
- package/dist/rtlsdr/tuner.d.ts +20 -0
- package/dist/rtlsdr/tuner.d.ts.map +1 -0
- package/dist/rtlsdr/tuner.js +15 -0
- package/dist/rtlsdr/tuner.js.map +1 -0
- package/package.json +20 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Interface for classes that get samples from a Radio class. */
|
|
2
|
+
export interface SampleReceiver {
|
|
3
|
+
/** Sets the sample rate. */
|
|
4
|
+
setSampleRate(sampleRate: number): void;
|
|
5
|
+
/** Receives samples that should be demodulated. */
|
|
6
|
+
receiveSamples(I: Float32Array, Q: Float32Array, frequency: number): void;
|
|
7
|
+
/** Sets a sample receiver to be executed right after this one. */
|
|
8
|
+
andThen(next: SampleReceiver): SampleReceiver;
|
|
9
|
+
}
|
|
10
|
+
export declare function concatenateReceivers(prev: SampleReceiver, next: SampleReceiver): SampleReceiver;
|
|
11
|
+
//# sourceMappingURL=sample_receiver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample_receiver.d.ts","sourceRoot":"","sources":["../../src/radio/sample_receiver.ts"],"names":[],"mappings":"AAcA,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,4BAA4B;IAC5B,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC,mDAAmD;IACnD,cAAc,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1E,kEAAkE;IAClE,OAAO,CAAC,IAAI,EAAE,cAAc,GAAG,cAAc,CAAC;CAC/C;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,cAAc,EACpB,IAAI,EAAE,cAAc,GACnB,cAAc,CAahB"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
export function concatenateReceivers(prev, next) {
|
|
15
|
+
let list = [];
|
|
16
|
+
if (prev instanceof ReceiverSequence) {
|
|
17
|
+
list.push(...prev.receivers);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
list.push(prev);
|
|
21
|
+
}
|
|
22
|
+
if (next instanceof ReceiverSequence) {
|
|
23
|
+
list.push(...next.receivers);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
list.push(next);
|
|
27
|
+
}
|
|
28
|
+
return new ReceiverSequence(list);
|
|
29
|
+
}
|
|
30
|
+
class ReceiverSequence {
|
|
31
|
+
receivers;
|
|
32
|
+
constructor(receivers) {
|
|
33
|
+
this.receivers = receivers;
|
|
34
|
+
}
|
|
35
|
+
setSampleRate(sampleRate) {
|
|
36
|
+
for (let receiver of this.receivers) {
|
|
37
|
+
receiver.setSampleRate(sampleRate);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
receiveSamples(I, Q, frequency) {
|
|
41
|
+
for (let receiver of this.receivers) {
|
|
42
|
+
receiver.receiveSamples(I, Q, frequency);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
andThen(next) {
|
|
46
|
+
return concatenateReceivers(this, next);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=sample_receiver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample_receiver.js","sourceRoot":"","sources":["../../src/radio/sample_receiver.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAcjC,MAAM,UAAU,oBAAoB,CAClC,IAAoB,EACpB,IAAoB;IAEpB,IAAI,IAAI,GAAG,EAAE,CAAC;IACd,IAAI,IAAI,YAAY,gBAAgB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,IAAI,IAAI,YAAY,gBAAgB,EAAE,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,gBAAgB,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC;AAED,MAAM,gBAAgB;IACD;IAAnB,YAAmB,SAA2B;QAA3B,cAAS,GAAT,SAAS,CAAkB;IAAG,CAAC;IAElD,aAAa,CAAC,UAAkB;QAC9B,KAAK,IAAI,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,cAAc,CAAC,CAAe,EAAE,CAAe,EAAE,SAAiB;QAChE,KAAK,IAAI,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACpC,QAAQ,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,IAAoB;QAC1B,OAAO,oBAAoB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { R8xx } from "./r8xx";
|
|
2
|
+
import { RtlCom } from "./rtlcom";
|
|
3
|
+
import { Tuner } from "./tuner";
|
|
4
|
+
/** Operations on the R820T tuner chip. */
|
|
5
|
+
export declare class R820T extends R8xx implements Tuner {
|
|
6
|
+
/**
|
|
7
|
+
* Initializes the R820T tuner, if present.
|
|
8
|
+
* @param com The RTL communications object.
|
|
9
|
+
* @returns a promise that resolves to the tuner, or null if not present.
|
|
10
|
+
*/
|
|
11
|
+
static maybeInit(com: RtlCom): Promise<Tuner | null>;
|
|
12
|
+
/**
|
|
13
|
+
* @param com The RTL communications object.
|
|
14
|
+
* @param xtalFreq The frequency of the oscillator crystal.
|
|
15
|
+
*/
|
|
16
|
+
private constructor();
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=r820t.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r820t.d.ts","sourceRoot":"","sources":["../../src/rtlsdr/r820t.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,IAAI,EAAgB,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,0CAA0C;AAC1C,qBAAa,KAAM,SAAQ,IAAK,YAAW,KAAK;IAC9C;;;;OAIG;WACU,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAQ1D;;;OAGG;IACH,OAAO;CAGR"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
+
// Copyright 2013 Google Inc. All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
import { R8xx, STD_MUX_CFGS } from "./r8xx";
|
|
16
|
+
/** Operations on the R820T tuner chip. */
|
|
17
|
+
export class R820T extends R8xx {
|
|
18
|
+
/**
|
|
19
|
+
* Initializes the R820T tuner, if present.
|
|
20
|
+
* @param com The RTL communications object.
|
|
21
|
+
* @returns a promise that resolves to the tuner, or null if not present.
|
|
22
|
+
*/
|
|
23
|
+
static async maybeInit(com) {
|
|
24
|
+
let found = await R8xx.check(com, 0x34);
|
|
25
|
+
if (!found)
|
|
26
|
+
return null;
|
|
27
|
+
let tuner = new R820T(com);
|
|
28
|
+
await tuner.open();
|
|
29
|
+
return tuner;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @param com The RTL communications object.
|
|
33
|
+
* @param xtalFreq The frequency of the oscillator crystal.
|
|
34
|
+
*/
|
|
35
|
+
constructor(com) {
|
|
36
|
+
super(com, 0x34, STD_MUX_CFGS, 2);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=r820t.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r820t.js","sourceRoot":"","sources":["../../src/rtlsdr/r820t.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,kDAAkD;AAClD,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI5C,0CAA0C;AAC1C,MAAM,OAAO,KAAM,SAAQ,IAAI;IAC7B;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,GAAW;QAChC,IAAI,KAAK,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,IAAI,KAAK,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3B,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACH,YAAoB,GAAW;QAC7B,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;IACpC,CAAC;CACF"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { R8xx } from "./r8xx";
|
|
2
|
+
import { RtlCom } from "./rtlcom";
|
|
3
|
+
import { Tuner } from "./tuner";
|
|
4
|
+
/** Operations on the R828D tuner chip. */
|
|
5
|
+
export declare class R828D extends R8xx implements Tuner {
|
|
6
|
+
private isRtlSdrBlogV4;
|
|
7
|
+
/** Current input; 0=air, 1=cable1, 2=cable2. */
|
|
8
|
+
private input;
|
|
9
|
+
/**
|
|
10
|
+
* Initializes the R828D tuner, if present.
|
|
11
|
+
* @param com The RTL communications object.
|
|
12
|
+
* @returns a promise that resolves to the tuner, or null if not present.
|
|
13
|
+
*/
|
|
14
|
+
static maybeInit(com: RtlCom): Promise<Tuner | null>;
|
|
15
|
+
/**
|
|
16
|
+
* @param com The RTL communications object.
|
|
17
|
+
* @param xtalFreq The frequency of the oscillator crystal.
|
|
18
|
+
*/
|
|
19
|
+
private constructor();
|
|
20
|
+
/**
|
|
21
|
+
* Sets the tuner's frequency.
|
|
22
|
+
* @param freq The frequency to tune to.
|
|
23
|
+
* @returns a promise that resolves to the actual tuned frequency.
|
|
24
|
+
*/
|
|
25
|
+
setFrequency(freq: number): Promise<number>;
|
|
26
|
+
getMinimumFrequency(): number;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=r828d.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r828d.d.ts","sourceRoot":"","sources":["../../src/rtlsdr/r828d.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,IAAI,EAAgB,MAAM,QAAQ,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,0CAA0C;AAC1C,qBAAa,KAAM,SAAQ,IAAK,YAAW,KAAK;IAyB5C,OAAO,CAAC,cAAc;IAxBxB,gDAAgD;IAChD,OAAO,CAAC,KAAK,CAAS;IAEtB;;;;OAIG;WACU,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC;IAU1D;;;OAGG;IACH,OAAO;IAQP;;;;OAIG;IACG,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmCjD,mBAAmB,IAAI,MAAM;CAG9B"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Copyright 2024 Jacobo Tarrio Barreiro. All rights reserved.
|
|
2
|
+
//
|
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
// you may not use this file except in compliance with the License.
|
|
5
|
+
// You may obtain a copy of the License at
|
|
6
|
+
//
|
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
//
|
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
// See the License for the specific language governing permissions and
|
|
13
|
+
// limitations under the License.
|
|
14
|
+
import { R8xx, STD_MUX_CFGS } from "./r8xx";
|
|
15
|
+
/** Operations on the R828D tuner chip. */
|
|
16
|
+
export class R828D extends R8xx {
|
|
17
|
+
isRtlSdrBlogV4;
|
|
18
|
+
/** Current input; 0=air, 1=cable1, 2=cable2. */
|
|
19
|
+
input;
|
|
20
|
+
/**
|
|
21
|
+
* Initializes the R828D tuner, if present.
|
|
22
|
+
* @param com The RTL communications object.
|
|
23
|
+
* @returns a promise that resolves to the tuner, or null if not present.
|
|
24
|
+
*/
|
|
25
|
+
static async maybeInit(com) {
|
|
26
|
+
let found = R8xx.check(com, 0x74);
|
|
27
|
+
if (!found)
|
|
28
|
+
return null;
|
|
29
|
+
let { manufacturer, model } = com.getBranding();
|
|
30
|
+
let isRtlSdrBlogV4 = manufacturer == "RTLSDRBlog" && model == "Blog V4";
|
|
31
|
+
let tuner = new R828D(com, isRtlSdrBlogV4);
|
|
32
|
+
await tuner.open();
|
|
33
|
+
return tuner;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @param com The RTL communications object.
|
|
37
|
+
* @param xtalFreq The frequency of the oscillator crystal.
|
|
38
|
+
*/
|
|
39
|
+
constructor(com, isRtlSdrBlogV4) {
|
|
40
|
+
super(com, 0x74, isRtlSdrBlogV4 ? MUX_CFGS_RTLSDRBLOGV4 : STD_MUX_CFGS, 1);
|
|
41
|
+
this.isRtlSdrBlogV4 = isRtlSdrBlogV4;
|
|
42
|
+
this.input = 0;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Sets the tuner's frequency.
|
|
46
|
+
* @param freq The frequency to tune to.
|
|
47
|
+
* @returns a promise that resolves to the actual tuned frequency.
|
|
48
|
+
*/
|
|
49
|
+
async setFrequency(freq) {
|
|
50
|
+
let upconvert = 0;
|
|
51
|
+
if (this.isRtlSdrBlogV4 && freq < 28800000) {
|
|
52
|
+
upconvert = 28800000;
|
|
53
|
+
}
|
|
54
|
+
let actual = await super.setFrequency(freq + upconvert);
|
|
55
|
+
if (this.isRtlSdrBlogV4) {
|
|
56
|
+
let input = freq <= 28800000 ? 2 : freq < 250000000 ? 1 : 0;
|
|
57
|
+
if (this.input != input) {
|
|
58
|
+
this.input = input;
|
|
59
|
+
if (input == 0) {
|
|
60
|
+
await this._writeRegMask(0x06, 0x00, 0x08);
|
|
61
|
+
await this._writeRegMask(0x05, 0x00, 0x60);
|
|
62
|
+
}
|
|
63
|
+
else if (input == 1) {
|
|
64
|
+
await this._writeRegMask(0x06, 0x00, 0x08);
|
|
65
|
+
await this._writeRegMask(0x05, 0x60, 0x60);
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
await this._writeRegMask(0x06, 0x08, 0x08);
|
|
69
|
+
await this._writeRegMask(0x05, 0x20, 0x60);
|
|
70
|
+
}
|
|
71
|
+
// Turn the upconverter on or off.
|
|
72
|
+
await this.com.setGpioOutput(5);
|
|
73
|
+
await this.com.setGpioBit(5, input == 2 ? 0 : 1);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
// Turn cable 1 LNA off above 345MHz, on below
|
|
78
|
+
let input = freq > 345000000 ? 0 : 1;
|
|
79
|
+
if (this.input != input) {
|
|
80
|
+
this.input = input;
|
|
81
|
+
await this._writeRegMask(0x05, input == 0 ? 0x00 : 0x60, 0x60);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return actual - upconvert;
|
|
85
|
+
}
|
|
86
|
+
getMinimumFrequency() {
|
|
87
|
+
return this.isRtlSdrBlogV4 ? 0 : super.getMinimumFrequency();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* RTL-SDR Blog v4 specific configurations for the multiplexer in different frequency bands. */
|
|
92
|
+
const MUX_CFGS_RTLSDRBLOGV4 = [
|
|
93
|
+
[0, 0b0000, 0b00000010, 0b11011111],
|
|
94
|
+
[2.2, 0b1000, 0b00000010, 0b11011111],
|
|
95
|
+
[50, 0b1000, 0b00000010, 0b10111110],
|
|
96
|
+
[55, 0b1000, 0b00000010, 0b10001011],
|
|
97
|
+
[60, 0b1000, 0b00000010, 0b01111011],
|
|
98
|
+
[65, 0b1000, 0b00000010, 0b01101001],
|
|
99
|
+
[70, 0b1000, 0b00000010, 0b01011000],
|
|
100
|
+
[75, 0b1000, 0b00000010, 0b01000100],
|
|
101
|
+
[85, 0b0000, 0b00000010, 0b01000100],
|
|
102
|
+
[90, 0b0000, 0b00000010, 0b00110100],
|
|
103
|
+
[110, 0b0000, 0b00000010, 0b00100100],
|
|
104
|
+
[112, 0b1000, 0b00000010, 0b00100100],
|
|
105
|
+
[140, 0b1000, 0b00000010, 0b00010100],
|
|
106
|
+
[172, 0b0000, 0b00000010, 0b00010100],
|
|
107
|
+
[180, 0b0000, 0b00000010, 0b00010011],
|
|
108
|
+
[242, 0b1000, 0b00000010, 0b00010011],
|
|
109
|
+
[250, 0b1000, 0b00000010, 0b00010001],
|
|
110
|
+
[280, 0b1000, 0b00000010, 0b00000000],
|
|
111
|
+
[310, 0b1000, 0b01000001, 0b00000000],
|
|
112
|
+
[588, 0b1000, 0b01000000, 0b00000000],
|
|
113
|
+
// ^ ^^ ^^ ^^^^^^^^
|
|
114
|
+
// | || || ||||++++- LPF (0000: highest)
|
|
115
|
+
// | || || ++++- LPNF (0000: highest)
|
|
116
|
+
// | || ++- RF filter (00: high, 01: med, 10: low)
|
|
117
|
+
// | ++- tracking filter (01: bypass)
|
|
118
|
+
// +- open drain (1: low Z)
|
|
119
|
+
];
|
|
120
|
+
//# sourceMappingURL=r828d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r828d.js","sourceRoot":"","sources":["../../src/rtlsdr/r828d.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,iDAAiD;AACjD,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;AAEjC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAI5C,0CAA0C;AAC1C,MAAM,OAAO,KAAM,SAAQ,IAAI;IAyBnB;IAxBV,gDAAgD;IAC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,EAAE,UAAU,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;IACrC,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC;IACrC,oCAAoC;IACpC,yDAAyD;IACzD,sDAAsD;IACtD,gEAAgE;IAChE,gDAAgD;IAChD,gCAAgC;CACjC,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { RtlCom } from "./rtlcom";
|
|
2
|
+
import { Tuner } from "./tuner";
|
|
3
|
+
/** Standard configurations for the multiplexer in different frequency bands. */
|
|
4
|
+
export declare const STD_MUX_CFGS: [number, number, number, number][];
|
|
5
|
+
/** Operations on R820/R828/R860 style tuner chips. */
|
|
6
|
+
export declare class R8xx implements Tuner {
|
|
7
|
+
protected com: RtlCom;
|
|
8
|
+
private i2c;
|
|
9
|
+
private muxCfgs;
|
|
10
|
+
private vcoPowerRef;
|
|
11
|
+
/** Frequency of the oscillator crystal. */
|
|
12
|
+
static XTAL_FREQ: number;
|
|
13
|
+
/** Initial values for registers 0x05-0x1f. */
|
|
14
|
+
static REGISTERS: number[];
|
|
15
|
+
/** A bit mask to reverse the bits in a byte. */
|
|
16
|
+
static BIT_REVS: number[];
|
|
17
|
+
/** This tuner's intermediate frequency. */
|
|
18
|
+
static IF_FREQ: number;
|
|
19
|
+
/** The frequency of the oscillator crystal. */
|
|
20
|
+
private xtalFreq;
|
|
21
|
+
/** Whether the PLL in the tuner is locked. */
|
|
22
|
+
private hasPllLock;
|
|
23
|
+
/** Shadow registers 0x05-0x1f, for setting values using masks. */
|
|
24
|
+
private shadowRegs;
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a R8xx tuner is present.
|
|
27
|
+
*/
|
|
28
|
+
static check(com: RtlCom, i2c: number): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* @param com The RTL communications object.
|
|
31
|
+
* @param i2c The tuner's I2C address.
|
|
32
|
+
* @param muxCfgs The tuner's multiplexer configurations.
|
|
33
|
+
*/
|
|
34
|
+
constructor(com: RtlCom, i2c: number, muxCfgs: [number, number, number, number][], vcoPowerRef: number);
|
|
35
|
+
/**
|
|
36
|
+
* Sets the tuner's frequency.
|
|
37
|
+
* @param freq The frequency to tune to.
|
|
38
|
+
* @returns a promise that resolves to the actual tuned frequency.
|
|
39
|
+
*/
|
|
40
|
+
setFrequency(freq: number): Promise<number>;
|
|
41
|
+
/** Starts the tuner. */
|
|
42
|
+
open(): Promise<void>;
|
|
43
|
+
/** Stops the tuner. */
|
|
44
|
+
close(): Promise<void>;
|
|
45
|
+
/** Sets the tuner to automatic gain. */
|
|
46
|
+
setAutoGain(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Sets the tuner's manual gain.
|
|
49
|
+
* @param gain The tuner's gain, in dB.
|
|
50
|
+
*/
|
|
51
|
+
setManualGain(gain: number): Promise<void>;
|
|
52
|
+
setXtalFrequency(xtalFreq: number): void;
|
|
53
|
+
getIntermediateFrequency(): number;
|
|
54
|
+
getMinimumFrequency(): number;
|
|
55
|
+
/** Calibrates the filters. */
|
|
56
|
+
private _calibrateFilter;
|
|
57
|
+
/**
|
|
58
|
+
* Sets the multiplexer's frequency.
|
|
59
|
+
* @param freq The frequency to set.
|
|
60
|
+
*/
|
|
61
|
+
private _setMux;
|
|
62
|
+
/**
|
|
63
|
+
* Sets the PLL's frequency.
|
|
64
|
+
* @param freq The frequency to set.
|
|
65
|
+
* @returns a promise that resolves to the actual frequency set, or to 0 if the frequency is not achievable.
|
|
66
|
+
*/
|
|
67
|
+
private _setPll;
|
|
68
|
+
/**
|
|
69
|
+
* Checks whether the PLL has achieved lock.
|
|
70
|
+
* @param firstTry Whether this is the first try to achieve lock.
|
|
71
|
+
*/
|
|
72
|
+
private _getPllLock;
|
|
73
|
+
/** Initializes all the components of the tuner. */
|
|
74
|
+
private _initElectronics;
|
|
75
|
+
/**
|
|
76
|
+
* Reads a series of registers into a buffer.
|
|
77
|
+
* @param addr The first register's address to read.
|
|
78
|
+
* @param length The number of registers to read.
|
|
79
|
+
* @returns a promise that resolves to an ArrayBuffer with the data.
|
|
80
|
+
*/
|
|
81
|
+
protected _readRegBuffer(addr: number, length: number): Promise<ArrayBuffer>;
|
|
82
|
+
/**
|
|
83
|
+
* Writes a masked value into a register.
|
|
84
|
+
* @param addr The address of the register to write into.
|
|
85
|
+
* @param value The value to write.
|
|
86
|
+
* @param mask A mask that specifies which bits to write.
|
|
87
|
+
*/
|
|
88
|
+
protected _writeRegMask(addr: number, value: number, mask: number): Promise<void>;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=r8xx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"r8xx.d.ts","sourceRoot":"","sources":["../../src/rtlsdr/r8xx.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC,gFAAgF;AAChF,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAsB1D,CAAC;AAEF,sDAAsD;AACtD,qBAAa,IAAK,YAAW,KAAK;IAwG9B,SAAS,CAAC,GAAG,EAAE,MAAM;IACrB,OAAO,CAAC,GAAG;IACX,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,WAAW;IA1GrB,2CAA2C;IAC3C,MAAM,CAAC,SAAS,SAAY;IAE5B,8CAA8C;IAC9C,MAAM,CAAC,SAAS,WA2Dd;IAEF,gDAAgD;IAChD,MAAM,CAAC,QAAQ,WAGb;IAEF,2CAA2C;IAC3C,MAAM,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