-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,233 additions
and
510 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[bumpversion] | ||
tag_name = rc/v{new_version} | ||
current_version = 1.2.17 | ||
current_version = 1.2.21 |
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
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
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
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
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,38 @@ | ||
"""Example reading from ADC using the batched function""" | ||
|
||
import time | ||
|
||
from edgepi.adc.edgepi_adc import EdgePiADC | ||
from edgepi.adc.adc_constants import AnalogIn, ADC1DataRate | ||
|
||
ITER = 50 | ||
|
||
def run_test(): | ||
""" | ||
This test performs 400 Analog input reads, batched 8 reads at a time. | ||
""" | ||
|
||
edgepi_adc = EdgePiADC(enable_cache=False) | ||
|
||
start = time.time() | ||
result_list = [] | ||
adc_choices = [ | ||
AnalogIn.AIN1, AnalogIn.AIN2, AnalogIn.AIN3, AnalogIn.AIN4, | ||
AnalogIn.AIN5, AnalogIn.AIN6, AnalogIn.AIN7, AnalogIn.AIN8, | ||
] | ||
|
||
for _ in range(ITER): | ||
tmp = edgepi_adc.read_samples_adc1_batch( | ||
data_rate=ADC1DataRate.SPS_38400, | ||
analog_in_list=adc_choices, | ||
) | ||
result_list += [tmp] | ||
|
||
elapsed = time.time() - start | ||
|
||
print(result_list[24]) | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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,44 @@ | ||
"""Example reading from from individual ADC pins""" | ||
|
||
import time | ||
|
||
from edgepi.adc.edgepi_adc import EdgePiADC | ||
from edgepi.adc.adc_constants import AnalogIn, ADC1DataRate, DiffMode | ||
|
||
ITER = 50 | ||
|
||
def run_test(): | ||
""" | ||
This test performs 300 analog input reads, with 50 for each of 4 analog pins, and | ||
50 for each of 2 differential analog pairs. | ||
""" | ||
|
||
edgepi_adc = EdgePiADC(enable_cache=False) | ||
|
||
start = time.time() | ||
result_list = [] | ||
adc_choices = [ | ||
AnalogIn.AIN1, AnalogIn.AIN2, | ||
AnalogIn.AIN5, AnalogIn.AIN6, | ||
] | ||
differential_pairs = [ | ||
DiffMode.DIFF_2, | ||
DiffMode.DIFF_4, | ||
] | ||
|
||
for _ in range(ITER): | ||
tmp = edgepi_adc.read_samples_adc1_batch( | ||
ADC1DataRate.SPS_38400, | ||
adc_choices, | ||
differential_pairs, | ||
) | ||
result_list += [tmp] | ||
|
||
elapsed = time.time() - start | ||
|
||
print(result_list[24]) | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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,34 @@ | ||
"""Example reading from DIN using the batched function""" | ||
|
||
import time | ||
|
||
from edgepi.digital_input.digital_input_constants import DinPins | ||
from edgepi.digital_input.edgepi_digital_input import EdgePiDigitalInput | ||
|
||
ITER = 250 | ||
|
||
def run_test(): | ||
""" | ||
This test performs 2000 Digital input reads, batched 8 reads at a time. | ||
""" | ||
digital_input = EdgePiDigitalInput() | ||
|
||
state_list = [] | ||
choices = [ | ||
DinPins.DIN1, DinPins.DIN2, DinPins.DIN3, DinPins.DIN4, | ||
DinPins.DIN5, DinPins.DIN6, DinPins.DIN7, DinPins.DIN8, | ||
] | ||
|
||
start = time.time() | ||
for _ in range(ITER): | ||
pin_states = digital_input.digital_input_state_batch(choices) | ||
state_list += [pin_states] | ||
|
||
elapsed = time.time() - start | ||
|
||
print(f"DIN Pins: {state_list[217]}") | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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,44 @@ | ||
"""Example reading from individual ADC pins""" | ||
|
||
import time | ||
|
||
from edgepi.adc.edgepi_adc import EdgePiADC | ||
from edgepi.adc.adc_constants import AnalogIn, ADC1DataRate, ConvMode | ||
|
||
ITER = 50 | ||
|
||
def run_test(): | ||
""" | ||
This test performs 400 analog input reads, with a total of 50 per ADC pin. | ||
""" | ||
edgepi_adc = EdgePiADC(enable_cache=False) | ||
|
||
start = time.time() | ||
result_list = [] | ||
adc_choices = [ | ||
AnalogIn.AIN1, AnalogIn.AIN2, AnalogIn.AIN3, AnalogIn.AIN4, | ||
AnalogIn.AIN5, AnalogIn.AIN6, AnalogIn.AIN7, AnalogIn.AIN8, | ||
] | ||
|
||
for _ in range(ITER): | ||
tmp_list = [] | ||
for ain in adc_choices: | ||
edgepi_adc.set_config( | ||
adc_1_analog_in=ain, | ||
conversion_mode=ConvMode.PULSE, | ||
adc_1_data_rate=ADC1DataRate.SPS_38400 | ||
) | ||
|
||
voltage = edgepi_adc.single_sample() | ||
tmp_list += [voltage] | ||
|
||
result_list += [tmp_list] | ||
|
||
elapsed = time.time() - start | ||
|
||
print(result_list[24]) | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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,35 @@ | ||
"""Example reading from individual DIN pins""" | ||
|
||
import time | ||
|
||
from edgepi.digital_input.digital_input_constants import DinPins | ||
from edgepi.digital_input.edgepi_digital_input import EdgePiDigitalInput | ||
|
||
ITER = 250 | ||
|
||
def run_test(): | ||
""" | ||
This test performs 2000 Digital input reads, with a total of 250 per DIN pin. | ||
""" | ||
digital_input = EdgePiDigitalInput() | ||
|
||
state_list = [] | ||
choices = [ | ||
DinPins.DIN1, DinPins.DIN2, DinPins.DIN3, DinPins.DIN4, | ||
DinPins.DIN5, DinPins.DIN6, DinPins.DIN7, DinPins.DIN8, | ||
] | ||
|
||
start = time.time() | ||
for _ in range(ITER): | ||
for din in choices: | ||
pin_state = digital_input.digital_input_state(din) | ||
state_list += [pin_state] | ||
|
||
elapsed = time.time() - start | ||
|
||
print(f"DIN Pins: {state_list[-9:-1]}") | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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,41 @@ | ||
"""Example reading from the thermocouple (tc)""" | ||
|
||
import time | ||
|
||
from edgepi.tc.edgepi_tc import EdgePiTC | ||
from edgepi.tc.tc_constants import ConvMode | ||
|
||
ITER = 25 | ||
|
||
def run_test(): | ||
""" | ||
This test | ||
""" | ||
edgepi_tc = EdgePiTC() | ||
edgepi_tc.set_config(conversion_mode=ConvMode.AUTO) | ||
|
||
cj_temperatures = [] | ||
lin_temperatures = [] | ||
|
||
start = time.time() | ||
for _ in range(ITER): | ||
iter_start = time.time() | ||
|
||
# make a single temperature measurement | ||
cold_junction, linearized = edgepi_tc.read_temperatures() | ||
cj_temperatures += [cold_junction] | ||
lin_temperatures += [linearized] | ||
|
||
# It doesn't make sense to read thermocoupler values faster than 10hz as they | ||
# won't be updated. You can try it here if you'd like! | ||
sleep_time = 0.1 - (time.time() - iter_start) | ||
time.sleep(0.0 if sleep_time < 0.0 else sleep_time) | ||
|
||
elapsed = time.time() - start | ||
|
||
print(f"TC Reads: {lin_temperatures}") | ||
print(f"Time elapsed {elapsed/ITER:.6f} s") | ||
print(f"Frequency {ITER/elapsed:.4f} hz") | ||
|
||
if __name__ == "__main__": | ||
run_test() |
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 |
---|---|---|
@@ -1,27 +1 @@ | ||
bleach==5.0.0 | ||
build==0.7.0 | ||
certifi==2021.10.8 | ||
charset-normalizer==2.0.12 | ||
colorama==0.4.4 | ||
commonmark==0.9.1 | ||
docutils==0.18.1 | ||
idna==3.3 | ||
importlib-metadata==4.11.3 | ||
keyring==23.5.0 | ||
packaging==21.3 | ||
pep517==0.12.0 | ||
pkginfo==1.8.2 | ||
Pygments==2.12.0 | ||
pyparsing==3.0.9 | ||
pywin32-ctypes==0.2.0 | ||
readme-renderer==35.0 | ||
requests==2.27.1 | ||
requests-toolbelt==0.9.1 | ||
rfc3986==2.0.0 | ||
rich==12.4.1 | ||
six==1.16.0 | ||
tomli==2.0.1 | ||
twine==4.0.0 | ||
urllib3==1.26.9 | ||
webencodings==0.5.1 | ||
zipp==3.8.0 |
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
|
||
setuptools.setup( | ||
name="edgepi-python-sdk", | ||
version="1.2.17", | ||
version="1.2.21", | ||
author="S.Park", | ||
author_email="[email protected]", | ||
description="EdgePi Python SDK package", | ||
|
Oops, something went wrong.