Mercurial > ~darius > hgwebdir.cgi > sirf
annotate test.py @ 1:c623f8832fd7
Tidy up, take cmd line args.
author | darius@Inchoate |
---|---|
date | Wed, 02 Sep 2009 13:24:44 +0930 |
parents | 6503256a3fc4 |
children | 387e6e928567 |
rev | line source |
---|---|
1 | 1 import serial, sirf, sys |
2 | |
0 | 3 |
4 if __name__ == "__main__": | |
1 | 5 if len(sys.argv) > 1: |
6 port = sys.argv[1] | |
7 else: | |
8 port = '/dev/rfcomm1' | |
9 | |
10 s = serial.Serial(port = port, baudrate = 9600) | |
0 | 11 |
12 s.setBaudrate(4800) | |
13 s.flush() | |
14 # Switch to SiRF and 9600 baud | |
15 s.write(sirf.nmea2sirf) | |
16 s.flush() | |
17 s.setBaudrate(9600) | |
18 s.flush() | |
19 | |
20 p = sirf.Parser() | |
1 | 21 |
22 sirf.disablemsgs(s) | |
23 sirf.enablemsgs(s) | |
24 p.dumpmsgs(s) |