| Line 5... |
Line 5... |
| 5 |
import time |
5 |
import time |
| 6 |
import datetime |
6 |
import datetime |
| 7 |
import sys |
7 |
import sys |
| 8 |
from pymlab import config |
8 |
from pymlab import config |
| 9 |
|
9 |
|
| 10 |
#### Script Arguments ############################################### |
10 |
req_freq = 286.0788 # required local oscillator frequency in MHz. |
| 11 |
|
11 |
|
| 12 |
if (len(sys.argv) > 3) or (len(sys.argv) < 2): |
- |
|
| 13 |
sys.stderr.write("Invalid number of arguments.\n") |
- |
|
| 14 |
sys.stderr.write("Usage: %s PORT_ADDRESS [REQUIERED_MHz]\n" % (sys.argv[0], )) |
- |
|
| 15 |
sys.exit(1) |
- |
|
| 16 |
|
- |
|
| 17 |
port = eval(sys.argv[1]) |
- |
|
| 18 |
#### Sensor Configuration ########################################### |
12 |
#### Sensor Configuration ########################################### |
| 19 |
|
13 |
|
| 20 |
cfg = config.Config( |
14 |
cfg = config.Config( |
| 21 |
i2c = { |
15 |
i2c = { |
| 22 |
"port": port, |
16 |
"port": 1, |
| 23 |
}, |
17 |
}, |
| 24 |
bus = [ |
18 |
bus = [ |
| 25 |
{ |
19 |
{ |
| 26 |
"type": "i2chub", |
20 |
"type": "i2chub", |
| 27 |
"address": 0x70, |
21 |
"address": 0x70, |
| Line 40... |
Line 34... |
| 40 |
time.sleep(0.5) |
34 |
time.sleep(0.5) |
| 41 |
frequency = fcount.get_freq() |
35 |
frequency = fcount.get_freq() |
| 42 |
rfreq = fgen.get_rfreq() |
36 |
rfreq = fgen.get_rfreq() |
| 43 |
hsdiv = fgen.get_hs_div() |
37 |
hsdiv = fgen.get_hs_div() |
| 44 |
n1 = fgen.get_n1_div() |
38 |
n1 = fgen.get_n1_div() |
| 45 |
#fdco = 0 |
- |
|
| 46 |
#fxtal = 0 |
- |
|
| 47 |
#regs = [0, 0, 0] |
- |
|
| 48 |
|
39 |
|
| 49 |
''' |
40 |
''' |
| 50 |
# sample GPS configuration |
41 |
# sample GPS configuration |
| 51 |
fcount.conf_GPS(0,5) # length of the GPS configurtion sentence |
42 |
fcount.conf_GPS(0,5) # length of the GPS configurtion sentence |
| 52 |
fcount.conf_GPS(1,ord('a')) # the first byte of GPS configuration sentence |
43 |
fcount.conf_GPS(1,ord('a')) # the first byte of GPS configuration sentence |
| Line 64... |
Line 55... |
| 64 |
while True: |
55 |
while True: |
| 65 |
now = datetime.datetime.now() |
56 |
now = datetime.datetime.now() |
| 66 |
if (now.second == 15) or (now.second == 35) or (now.second == 55): |
57 |
if (now.second == 15) or (now.second == 35) or (now.second == 55): |
| 67 |
frequency = fcount.get_freq() |
58 |
frequency = fcount.get_freq() |
| 68 |
if (len(sys.argv) == 3): |
59 |
if (len(sys.argv) == 3): |
| 69 |
regs = fgen.set_freq(frequency/1e6, float(eval(sys.argv[2]))) |
60 |
regs = fgen.set_freq(frequency/1e6, float(req_freq)) |
| 70 |
now = datetime.datetime.now() |
61 |
now = datetime.datetime.now() |
| 71 |
|
62 |
|
| 72 |
rfreq = fgen.get_rfreq() |
63 |
rfreq = fgen.get_rfreq() |
| 73 |
hsdiv = fgen.get_hs_div() |
64 |
hsdiv = fgen.get_hs_div() |
| 74 |
n1 = fgen.get_n1_div() |
65 |
n1 = fgen.get_n1_div() |