-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
e4efe7a
commit d586e74
Showing
14 changed files
with
519 additions
and
264 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,10 +1,16 @@ | ||
## v1.0.1 | ||
|
||
* Removed numpy dependency | ||
* Changed maximum line length from 80 to 120. This change does not apply to the code's documentation | ||
* Using "not in" and "is not None" | ||
* Correcting firmware version in eeprom_firmware | ||
* Adding callbacks | ||
* Setting logger name to 'rava' | ||
* Changed health startup results format | ||
* Including hardware float generation (and moved software double to examples) | ||
* Including hardware float generation | ||
|
||
|
||
## v1.0.2 | ||
* Checking for n > 0 in data generation | ||
* Max n of pulse counts, bytes, ints, and floats changed to 2^16 (instead of 2^32) | ||
* Improved the disconnection detection methodology | ||
* Corrected the int_delta in integers generation |
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 +1,2 @@ | ||
include CHANGELOG.md | ||
include examples/*.py |
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,67 @@ | ||
''' | ||
This example showcases the generation of a binary file containing random bytes. | ||
This example code is in the public domain. | ||
Author: Gabriel Guerrer | ||
''' | ||
|
||
import itertools | ||
import rng_rava as rava | ||
|
||
# Variables | ||
FILE_OUTPUT = 'random.bin' | ||
N_BYTES = 1000000 # 1MB | ||
N_CHUNK = 10000 | ||
|
||
# Find RAVA device and connect | ||
rng = rava.RAVA_RNG() | ||
dev_sns = rava.find_rava_sns() | ||
if len(dev_sns): | ||
rng.connect(serial_number=dev_sns[0]) | ||
else: | ||
rava.lg.error('No device found') | ||
exit() | ||
|
||
# Calculate n measurements | ||
n_measurements = N_BYTES // N_CHUNK | ||
n_bytes_remmaining = (N_BYTES % N_CHUNK) | ||
|
||
# Open file | ||
with open(FILE_OUTPUT, mode='bw') as f: | ||
|
||
# Loop over n measurements | ||
for i in range(n_measurements): | ||
print('{:.0f}%'.format(i / n_measurements * 100)) | ||
|
||
# Generate bytes | ||
bytes_a, bytes_b = rng.get_rng_bytes(n_bytes=N_CHUNK // 2, | ||
postproc_id=rava.D_RNG_POSTPROC['NONE'], | ||
list_output=False, | ||
timeout=None) | ||
|
||
# Alternate RNG A and B bytes | ||
bytes_ab = bytes(itertools.chain.from_iterable(zip(bytes_a, bytes_b))) | ||
|
||
# Write to file | ||
f.write(bytes_ab) | ||
|
||
# Remaining bytes | ||
if n_bytes_remmaining: | ||
|
||
# Generate bytes | ||
bytes_a, bytes_b = rng.get_rng_bytes(n_bytes=n_bytes_remmaining // 2, | ||
postproc_id=rava.D_RNG_POSTPROC['NONE'], | ||
list_output=False, | ||
timeout=None) | ||
|
||
# Alternate RNG A and B bytes | ||
bytes_ab = bytes(itertools.chain.from_iterable(zip(bytes_a, bytes_b))) | ||
|
||
# Write to file | ||
f.write(bytes_ab) | ||
|
||
# Finished | ||
print('100%') | ||
|
||
# Close device | ||
rng.close() |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "rng_rava" | ||
version = "1.0.1" | ||
version = "1.0.2" | ||
authors = [ | ||
{ name="Gabriel Guerrer", email="[email protected]" }, | ||
] | ||
|
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
Oops, something went wrong.