예제 #1
0
    cmd = CmdNDIRConf()

    if not cmd.is_valid():
        cmd.print_help(sys.stderr)
        exit(2)

    if cmd.verbose:
        print("ndir_conf: %s" % cmd, file=sys.stderr)
        sys.stderr.flush()

    # ----------------------------------------------------------------------------------------------------------------
    # resources...

    # NDIRConf...
    conf = NDIRConf.load(Host)

    # ----------------------------------------------------------------------------------------------------------------
    # run...

    if cmd.set():
        if conf is None and not cmd.is_complete():
            print(
                "ndir_conf: No configuration is stored - you must therefore set all fields.",
                file=sys.stderr)
            cmd.print_help(sys.stderr)
            exit(2)

        model = cmd.model if cmd.model else conf.model
        tally = cmd.tally if cmd.tally else conf.tally
예제 #2
0
        # Interface...
        interface_conf = InterfaceConf.load(Host)

        if interface_conf is None:
            print("ndir_sampler: InterfaceConf not available.",
                  file=sys.stderr)
            exit(1)

        interface = interface_conf.interface()

        if interface is None:
            print("ndir_sampler: Interface not available.", file=sys.stderr)
            exit(1)

        # NDIRConf...
        ndir_conf = NDIRConf.load(Host)

        if ndir_conf is None:
            print("ndir_sampler: NDIRConf not available.", file=sys.stderr)
            exit(1)

        # NDIR...
        ndir = ndir_conf.ndir(interface, Host)

        if cmd.verbose:
            print("ndir_sampler: %s" % ndir, file=sys.stderr)
            sys.stderr.flush()

        # ------------------------------------------------------------------------------------------------------------
        # run...
예제 #3
0
    # ------------------------------------------------------------------------------------------------------------
    # resources...

    # Interface...
    interface_conf = InterfaceConf.load(Host)

    if interface_conf is None:
        print("InterfaceConf not available.")
        exit(1)

    interface = interface_conf.interface()
    print(interface)

    # NDIR...
    conf = NDIRConf("t1f1", 5)
    print("conf: %s" % conf)

    ndir = SPINDIRt1f1(interface, Host.ndir_spi_bus(), Host.ndir_spi_device())
    print("ndir: %s" % ndir)
    print("-")

    ndir.power_on()

    monitor = NDIRMonitor(ndir, conf)
    print("monitor: %s" % monitor)

    firmware = monitor.firmware()
    print("firmware: %s" % firmware)
    print("-")