From 670e21811e2a118dca194da01ff5187907d6ed44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joachim=20Stro=CC=88mbergson?= Date: Sat, 20 Dec 2014 08:58:05 +0100 Subject: Adding initial version of the argparser. --- src/sw/trng_extract.py | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/sw/trng_extract.py b/src/sw/trng_extract.py index a47fb54..9492f53 100755 --- a/src/sw/trng_extract.py +++ b/src/sw/trng_extract.py @@ -318,22 +318,40 @@ def looptest(dev): # main #---------------------------------------------------------------- def main(): - if VERBOSE: - print("Starting trng data extraction.") - - my_commdev = Comm() + # my_commdev = Comm() # looptest(my_commdev) # get_avalanche_entropy() # get_avalanche_delta() - get_rosc_entropy(my_commdev) + # get_rosc_entropy(my_commdev) # get_rosc_raw() # get_rng_data() + parser = argparse.ArgumentParser() + + parser.add_argument('-d', '--debug', dest='debug', action='store_true', + help='Pring debug information.') + + parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', + help='Increase verbosity.') + + parser.add_argument('-i', dest='device', default=I2C_DEVICE, + help='I2C device name (default ' + I2C_DEVICE + ')') + + parser.add_argument('-n', dest='num_words', default=NUM_WORDS, + help='Number of 32-bit words to extract (default ' + + str(NUM_WORDS) + ')') + + + args = parser.parse_args() + DEBUG = args.debug + VERBOSE = args.verbose + + #------------------------------------------------------------------- # __name__ # Python thingy which allows the file to be run standalone as -- cgit v1.2.3