Skip to content

Commit a1c4892

Browse files
committed
added header, moved verbose
1 parent cfe40f0 commit a1c4892

File tree

2 files changed

+42
-5
lines changed

2 files changed

+42
-5
lines changed

examples/using_autoconnect.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
1+
#! /usr/bin/python3
2+
3+
##-------------------------------------------------------------------------------\
4+
# tinySA_python
5+
# './examples/using_autoconnect.py'
6+
# This is a visual comparison of SCAN and SCANRAW to work out some errors in
7+
# the decode process given that the tinySA is still running during the read,
8+
# we don't expect SCAN and SCANRAW to be exactly the same, but they
9+
# should be relatively similar values when SCANRAW is decoded
10+
#
11+
# Last update: June 18, 2025
12+
##-------------------------------------------------------------------------------\
13+
114
# import tinySA library
215
# (NOTE: check library path relative to script path)
316
from src.tinySA_python import tinySA
417

518
# create a new tinySA object
619
tsa = tinySA()
720

21+
# set the return message preferences
22+
tsa.set_verbose(True) #detailed messages
23+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
24+
25+
826
# attempt to autoconnect
927
found_bool, connected_bool = tsa.autoconnect()
1028

1129
# if port found and connected, then complete task(s) and disconnect
12-
if connected_bool == True: # or if success == True:
30+
if connected_bool == True:
1331
print("device connected")
14-
tsa.set_verbose(True) #detailed messages
15-
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
32+
1633
msg = tsa.get_device_id()
1734
print(msg)
1835

examples/using_command_func.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
1+
#! /usr/bin/python3
2+
3+
##-------------------------------------------------------------------------------\
4+
# tinySA_python
5+
# './examples/using_command_func.py'
6+
# The command func can be used for commands or functionalities that exist on the
7+
# tinySA series of devices but arent included in the library yet. There is NO
8+
# built in error checking for this process.
9+
#
10+
# Last update: June 18, 2025
11+
##-------------------------------------------------------------------------------\
12+
13+
114
# import tinySA library
215
# (NOTE: check library path relative to script path)
316
from src.tinySA_python import tinySA
417

518

619
# create a new tinySA object
720
tsa = tinySA()
21+
22+
# set the return message preferences
23+
tsa.set_verbose(True) #detailed messages
24+
tsa.set_error_byte_return(True) #get explicit b'ERROR' if error thrown
25+
26+
827
# attempt to autoconnect
928
found_bool, connected_bool = tsa.autoconnect()
1029

1130
# if port closed, then return error message
1231
if connected_bool == False:
1332
print("ERROR: could not connect to port")
1433
else: # if port found and connected, then complete task(s) and disconnect
15-
# detailed messages turned on
16-
tsa.set_verbose(True)
34+
35+
1736
# set scan values
1837
start = 150e6 # 150 MHz
1938
stop = 200e6 # 200 MHz
2039
pts = 450 # for tinySA Ultra
2140
outmask = 1 # get measured data (y axis)
41+
2242
# scan
2343
data_bytes = tsa.command("scan 150e6 200e6 5 2")
2444

0 commit comments

Comments
 (0)