예제 #1
0
    def __init__(self,
                 init_state=1,
                 mode=1,
                 frequency=None,
                 time_period=None,
                 on_time=None,
                 off_time=None):

        threading.Thread.__init__(self)

        if frequency is not None:
            self.time_period = 1.0 / frequency
        if time_period is not None:
            self.time_period = time_period
        if time_period is None and frequency is None:
            self.time_period = 1
        self.mode = mode

        if on_time is not None and off_time is not None:
            self.on_time = on_time
            self.off_time = off_time
        else:
            self.on_time = self.time_period / 2
            self.off_time = self.time_period / 2

        self.init_state = init_state
        self.curr_state = init_state
        self.exitFlag = False
        self.daemon = True
        self.A = Connector(self.init_state)
        self.update = False
예제 #2
0
파일: digital.py 프로젝트: rbs-pli/BinPy
    def __init__(self, init_state=1, frequency=None, time_period=None, name=None):
        threading.Thread.__init__(self)
        if frequency != None:
            self.time_period = 1.0/frequency
        if time_period != None:
            self.time_period = time_period
        if time_period==None and frequency==None:
            self.time_period = 1

        self.init_state = init_state
        self.name = name
        self.curr_state = init_state
        self.exitFlag = 0
        self.daemon = True
        self.A = Connector(0)
예제 #3
0
# <headingcell level=2>

# Example for Bus

# <codecell>

# Imports

from __future__ import print_function
from BinPy import Bus, Connector

# <codecell>

# Initiating the Bus with connectors

bit_1 = Connector(0)
bit_2 = Connector(1)
bit_3 = Connector(0)
bit_4 = Connector(0)

bus_a = Bus(bit_1, bit_2, bit_3, bit_4)

# <codecell>

# Probing the logic of the Bus

bus_a.get_logic_all()

# <codecell>

# Probing the voltage of the Bus