-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add calculator for valid symbol lengths.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Calculates: | ||
// Valid symbol lengths. | ||
// Sample rate to achieve the symbol length. | ||
// Number of channels covered. | ||
// Excess bandwidth outside of the captured channels. | ||
|
||
package main | ||
|
||
import ( | ||
"fmt" | ||
"math" | ||
) | ||
|
||
const ( | ||
DataRate = 32768 | ||
ChannelWidth = 196568 | ||
|
||
// Valid sample rates fall in one of two bands: | ||
// http://cgit.osmocom.org/rtl-sdr/tree/src/librtlsdr.c#n1069 | ||
LowerMin = 225e3 | ||
LowerMax = 300e3 | ||
UpperMin = 900e3 | ||
UpperMax = 3.2e6 | ||
) | ||
|
||
func main() { | ||
for symbolLength := 1; symbolLength < int(math.Ceil(UpperMax/DataRate)); symbolLength++ { | ||
sampleRate := symbolLength * DataRate | ||
if (LowerMin < sampleRate && sampleRate <= LowerMax) || (UpperMin < sampleRate && sampleRate <= UpperMax) { | ||
fmt.Printf("SymbolLength:%d SampleRate:%d Channels:%d ExcessBandwidth:%d\n", symbolLength, sampleRate, sampleRate/ChannelWidth, sampleRate%ChannelWidth) | ||
} | ||
} | ||
} |